update 07 to use new hashing

This commit is contained in:
Valentin Boettcher 2022-04-21 16:27:20 +02:00
parent c29569ed8b
commit 0809c1a76f
2 changed files with 291 additions and 980 deletions

File diff suppressed because it is too large Load diff

View file

@ -22,7 +22,7 @@ Init ray and silence stocproc.
#+end_src
#+RESULTS:
| node_ip_address | : | 141.30.17.221 | raylet_ip_address | : | 141.30.17.221 | redis_address | : | hline | object_store_address | : | /tmp/ray/session_2022-04-21_16-15-09_598127_25703/sockets/plasma_store | raylet_socket_name | : | /tmp/ray/session_2022-04-21_16-15-09_598127_25703/sockets/raylet | webui_url | : | hline | session_dir | : | /tmp/ray/session_2022-04-21_16-15-09_598127_25703 | metrics_export_port | : | 64861 | gcs_address | : | 141.30.17.221:45866 | address | : | 141.30.17.221:45866 | node_id | : | fbe39e432feebd7f9fcc6bc8fee33c1b97fd050aad1349cfc0bbb757 |
| node_ip_address | : | 141.30.17.221 | raylet_ip_address | : | 141.30.17.221 | redis_address | : | hline | object_store_address | : | /tmp/ray/session_2022-04-21_16-23-22_125157_28182/sockets/plasma_store | raylet_socket_name | : | /tmp/ray/session_2022-04-21_16-23-22_125157_28182/sockets/raylet | webui_url | : | hline | session_dir | : | /tmp/ray/session_2022-04-21_16-23-22_125157_28182 | metrics_export_port | : | 65168 | gcs_address | : | 141.30.17.221:54526 | address | : | 141.30.17.221:54526 | node_id | : | 806bca127b0340571172a7c98f4bebb739adc17d1aba1100723d6722 |
#+begin_src jupyter-python :results none :tangle scripts/integrate_slip.py
from hops.util.logging_setup import logging_setup
@ -43,8 +43,8 @@ We use a logspaced time to resolve the initial slip.
#+RESULTS:
:RESULTS:
| <matplotlib.lines.Line2D | at | 0x7f130b64e940> |
[[file:./.ob-jupyter/752676933111c678082642f6e3e60bb7666a5df0.svg]]
| <matplotlib.lines.Line2D | at | 0x7f7218506be0> |
[[file:./.ob-jupyter/fc9b4a3f486432abd1d441383ea3ba30f2594ffb.svg]]
:END:
* Convergence Woes
@ -247,8 +247,134 @@ We could try the same with another truncation scheme.
#+RESULTS:
:RESULTS:
| <Figure | size | 432x288 | with | 1 | Axes> | <AxesSubplot:xlabel= | $τ$ | ylabel= | $\langle H_\mathrm{I}\rangle$ | > |
[[file:./.ob-jupyter/4d65797073284e10d6239710532004a5b8ae0fc3.svg]]
: Loading: 0% 0/400 [00:03<?, ?it/s]
# [goto error]
#+begin_example
---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
Input In [10], in <cell line: 1>()
----> 1 plot_interaction_consistency(
 2  k_models,
 3  #k_models[-1],
 4  label_fn=lambda m: fr"k=${m.k_max}$",
 5  **ensmeble_arg
 6  )
File ~/Documents/Projects/UNI/master/masterarb/python/energy_flow_proper/07_one_bath_systematics/figsaver.py:317, in plot_interaction_consistency(models, reference, label_fn, **kwargs)
 315 for model in models:
 316 with aux.get_data(model) as data:
--> 317 energy = model.interaction_energy(data, **kwargs)
 318 interaction_ref = model.interaction_energy_from_conservation(data, **kwargs)
 319 diff = abs(interaction_ref - energy)
File ~/src/two_qubit_model/hiro_models/model_base.py:310, in Model.interaction_energy(self, data, **kwargs)
 299 """Calculates interaction energy from the hierarchy data
 300 ``data``.
 301
 (...)
 305 :returns: See :any:`hopsflow.util.interaction_energy_ensemble`.
 306 """
 308 N, kwargs = _get_N_kwargs(kwargs, data)
--> 310 return hopsflow.hopsflow.interaction_energy_ensemble(
 311  data.valid_sample_iterator(data.stoc_traj), # type: ignore
 312  data.valid_sample_iterator(data.aux_states), # type: ignore
 313  self.hopsflow_system,
 314  (data.valid_sample_iterator(data.rng_seed), self.hopsflow_therm(data.time[:])), # type: ignore
 315  N=N,
 316  save=f"interaction_{self.hexhash}",
 317  **kwargs,
 318 )
File ~/src/hopsflow/hopsflow/hopsflow.py:485, in interaction_energy_ensemble(ψ_0s, ψ_1s, params, therm_args, **kwargs)
 481 energy += interaction_energy_therm(run, therm_run)
 483 return energy
--> 485 return util.ensemble_mean(
 486  iter(zip(ψ_0s, ψ_1s, therm_args[0]))
 487  if therm_args
 488  else iter(zip(ψ_0s, ψ_1s, itertools.repeat(0))),
 489  interaction_energy_task,
 490  **kwargs,
 491 )
File ~/src/hopsflow/hopsflow/util.py:655, in ensemble_mean(arg_iter, function, N, every, save, overwrite_cache, chunk_size)
 651 @ray.remote
 652 def remote_function(chunk: tuple):
 653 return [function(arg) for arg in chunk]
--> 655 handles = [
 656 remote_function.remote(chunk)
 657 for chunk in tqdm(
 658 _grouper(
 659 chunk_size, itertools.islice(arg_iter, None, N - 1 if N else None)
 660 ),
 661 total=int((N - 1) / chunk_size + 1) if N is not None else None,
 662 desc="Loading",
 663 )
 664 ]
 666 progress = tqdm(total=len(handles), desc="Processing")
 668 for ref in handles:
File ~/src/hopsflow/hopsflow/util.py:655, in <listcomp>(.0)
 651 @ray.remote
 652 def remote_function(chunk: tuple):
 653 return [function(arg) for arg in chunk]
--> 655 handles = [
 656 remote_function.remote(chunk)
 657 for chunk in tqdm(
 658 _grouper(
 659 chunk_size, itertools.islice(arg_iter, None, N - 1 if N else None)
 660 ),
 661 total=int((N - 1) / chunk_size + 1) if N is not None else None,
 662 desc="Loading",
 663 )
 664 ]
 666 progress = tqdm(total=len(handles), desc="Processing")
 668 for ref in handles:
File /nix/store/v8al73piyplb4zsr88jnspqc62njjpxq-python3-3.9.10-env/lib/python3.9/site-packages/tqdm/std.py:1195, in tqdm.__iter__(self)
 1192 time = self._time
 1194 try:
-> 1195 for obj in iterable:
 1196 yield obj
 1197 # Update and possibly print the progressbar.
 1198 # Note: does not call self.update(1) for speed optimisation.
File ~/src/hopsflow/hopsflow/util.py:587, in _grouper(n, iterable)
 584 """Groups the iteartor into tuples of at most length ``n``."""
 586 while True:
--> 587 chunk = tuple(itertools.islice(iterable, n))
 588 if not chunk:
 589 return
File ~/src/hops/hops/core/hierarchy_data.py:1223, in HIData.valid_sample_iterator(self, iterator)
 1216 def valid_sample_iterator(self, iterator: Iterator[T]) -> Iterator[T]:
 1217 """
 1218  Takes an ``iterator`` that yields a sequence of items related to
 1219  the sequence of samples and yields them if the sample is
 1220  actually present in the data.
 1221  """
-> 1223 for i, item in enumerate(iterator):
 1224 if self.has_sample(i):
 1225 yield item
File /nix/store/v8al73piyplb4zsr88jnspqc62njjpxq-python3-3.9.10-env/lib/python3.9/site-packages/h5py/_hl/dataset.py:664, in Dataset.__iter__(self)
 662 raise TypeError("Can't iterate over a scalar dataset")
 663 for i in range(shape[0]):
--> 664 yield self[i]
File h5py/_objects.pyx:54, in h5py._objects.with_phil.wrapper()
File h5py/_objects.pyx:55, in h5py._objects.with_phil.wrapper()
File /nix/store/v8al73piyplb4zsr88jnspqc62njjpxq-python3-3.9.10-env/lib/python3.9/site-packages/h5py/_hl/dataset.py:793, in Dataset.__getitem__(self, args, new_dtype)
 791 mspace = h5s.create_simple(selection.mshape)
 792 fspace = selection.id
--> 793 self.id.read(mspace, fspace, arr, mtype, dxpl=self._dxpl)
 795 # Patch up the output for NumPy
 796 if arr.shape == ():
KeyboardInterrupt:
#+end_example
[[file:./.ob-jupyter/d81cd0cee8f06820ba9fdad3107ae9833dcff026.svg]]
:END:
#+begin_src jupyter-python