introduce the split integration and analysis

This commit is contained in:
Valentin Boettcher 2022-08-29 16:47:26 +02:00
parent de7ff3f7f7
commit fc3f39dec2
4 changed files with 91 additions and 43 deletions

View file

@ -0,0 +1,2 @@
from model_cc import *
print(model.all_energies_online("results.fifo"))

View file

@ -2,7 +2,7 @@
Here we try to reproduce the anti zeno engine from the paper.
* Boilerplate
#+begin_src jupyter-python :results none
#+begin_src jupyter-python :results none :tangle model_cc.py
import figsaver as fs
from hiro_models.one_qubit_model import QubitModelMutliBath, StocProcTolerances
import hiro_models.model_auxiliary as aux
@ -19,28 +19,18 @@ Here we try to reproduce the anti zeno engine from the paper.
import plot_utils as pu
#+end_src
Init ray and silence stocproc.
#+begin_src jupyter-python
import ray
ray.shutdown()
ray.init()
#+end_src
#+RESULTS:
: RayContext(dashboard_url='', python_version='3.9.13', ray_version='1.13.0', ray_commit='e4ce38d001dbbe09cd21c497fedd03d692b2be3e', address_info={'node_ip_address': '141.30.17.225', 'raylet_ip_address': '141.30.17.225', 'redis_address': None, 'object_store_address': '/tmp/ray/session_2022-08-26_09-16-24_372243_434989/sockets/plasma_store', 'raylet_socket_name': '/tmp/ray/session_2022-08-26_09-16-24_372243_434989/sockets/raylet', 'webui_url': '', 'session_dir': '/tmp/ray/session_2022-08-26_09-16-24_372243_434989', 'metrics_export_port': 64820, 'gcs_address': '141.30.17.225:62541', 'address': '141.30.17.225:62541', 'node_id': 'b13e6e8fe3cb7e0a8e40b763d39febfe0bac4a37ea2d205950b6dc19'})
#+begin_src jupyter-python :results none
#+begin_src jupyter-python :results none :tangle model_cc.py
from hops.util.logging_setup import logging_setup
import logging
logging_setup(logging.INFO, show_stocproc=False)
#+end_src
* Model Definition
#+begin_src jupyter-python :results none
#+begin_src jupyter-python :results none :tangle model_cc.py
from anti_zeno_engine import *
#+end_src
#+begin_src jupyter-python
#+begin_src jupyter-python :tangle model_cc.py
(
model,
params
@ -49,7 +39,7 @@ Init ray and silence stocproc.
ε=1,#.1,
ω_c=1,
ε_couple=.68,
n=35,
n=60,
detune=.5,
ω_0=20,
T_c=5e3,
@ -58,7 +48,7 @@ Init ray and silence stocproc.
γ=.2,
switch_cycles=1,
therm_initial_state=False,
ε_init=.001/2,
#ε_init=.001/2,
terms=7,
dt=0.01/2,
sp_tol=1e-4,
@ -70,40 +60,45 @@ Init ray and silence stocproc.
#+RESULTS:
#+begin_src jupyter-python :tangle integrate_cc.py
from model_cc import *
import ray
ray.shutdown()
ray.init()
aux.integrate(model, 10, stream_file="results.fifo")
#+end_src
#+begin_src jupyter-python :tangle analyze_cc.py
from model_cc import *
print(model.all_energies_online("results.fifo"))
#+end_src
#+RESULTS:
#+begin_src jupyter-python
ts = model.t # np.linspace(0,10,1000)
proc = model.thermal_process(1)
import hops
z=hops.core.utility.uni_to_gauss(np.random.rand(proc.get_num_y() * 2))
proc.new_process(z)
pu.plot_complex(ts, proc(ts) * model.bcf_scales[1])
flow, interaction, int_pow, system, sys_pow = model.all_energies_online_from_cache()
fig, ax = plt.subplots()
print(sys_pow.N)
pu.plot_with_σ(model.t, (sys_pow+int_pow.sum_baths()).integrate(model.t), ax=ax)
pu.plot_with_σ(model.t, (-1 * flow).sum_baths().integrate(model.t) + interaction.sum_baths() + system + 10, ax=ax)
# with aux.get_data(model) as data:
# #pu.plot_with_σ(model.t, model.total_energy_from_power(data), ax=ax)
# pu.plot_with_σ(model.t, model.interaction_energy(data).sum_baths() - interaction.sum_baths(), ax=ax)
# pu.plot_with_σ(model.t, model.interaction_power(data).sum_baths() - int_pow.sum_baths(), ax=ax)
# pu.plot_with_σ(model.t, model.system_energy(data).sum_baths() - system.sum_baths(), ax=ax)
# pu.plot_with_σ(model.t, model.system_power(data).sum_baths() - sys_pow.sum_baths(), ax=ax)
# pu.plot_with_σ(model.t, model.bath_energy_flow(data).sum_baths() - flow.sum_baths(), ax=ax)
#+end_src
#+RESULTS:
:RESULTS:
| <Figure | size | 520x320 | with | 1 | Axes> | <AxesSubplot:> |
[[file:./.ob-jupyter/458ed32f5b39dff70d717cc2593889573946a962.svg]]
: 10
| hline | <AxesSubplot:> | ((<matplotlib.lines.Line2D at 0x7fec3f75eb80>) <matplotlib.collections.PolyCollection at 0x7fec3f75e9d0>) |
[[file:./.ob-jupyter/72099bcb22465077395cd8acccbecc8f6e768f84.svg]]
:END:
#+begin_src jupyter-python
params.cycles
#+end_src
#+RESULTS:
: 10
#+begin_src jupyter-python
aux.integrate(model, 10)
#+end_src
#+RESULTS:
: [INFO hops.core.integration 14258] Choosing the nonlinear integrator.
: [INFO hops.core.integration 14258] Using 8 integrators.
: [INFO hops.core.integration 14258] Some 9 trajectories have to be integrated.
: [INFO hops.core.integration 14258] Using 680 hierarchy states.
: 0% 0/9 [00:00<?, ?it/s]
#+begin_src jupyter-python
plot_az_coupling_diagram(model, params)
#+end_src
@ -111,7 +106,7 @@ Init ray and silence stocproc.
#+RESULTS:
:RESULTS:
| <Figure | size | 520x320 | with | 1 | Axes> | <AxesSubplot:xlabel= | $\tau$ | > |
[[file:./.ob-jupyter/1f7ffd13448c6001e2f81fb22d1fa2c919b497ab.svg]]
[[file:./.ob-jupyter/d1345d964ba6362247d8f34e3ea98e5b5f91a7db.svg]]
:END:
#+begin_src jupyter-python

View file

@ -0,0 +1,5 @@
from model_cc import *
import ray
ray.shutdown()
ray.init()
aux.integrate(model, 10, stream_file="results.fifo")

View file

@ -0,0 +1,46 @@
import figsaver as fs
from hiro_models.one_qubit_model import QubitModelMutliBath, StocProcTolerances
import hiro_models.model_auxiliary as aux
from hops.util.utilities import relative_entropy, relative_entropy_single, entropy, trace_distance
from hopsflow.util import EnsembleValue
import numpy as np
import qutip as qt
import scipy
import utilities as ut
from hops.util.dynamic_matrix import SmoothStep, Periodic, Harmonic, ConstantMatrix, Piecewise, Shift
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
import plot_utils as pu
from hops.util.logging_setup import logging_setup
import logging
logging_setup(logging.INFO, show_stocproc=False)
from anti_zeno_engine import *
(
model,
params
) = anti_zeno_engine(
Δ=11,
ε=1,#.1,
ω_c=1,
ε_couple=.68,
n=60,
detune=.5,
ω_0=20,
T_c=5e3,
T_h=5e4,
δ=[3.2*.01/10, 1.08*.01/10],
γ=.2,
switch_cycles=1,
therm_initial_state=False,
#ε_init=.001/2,
terms=7,
dt=0.01/2,
sp_tol=1e-4,
init_time_steps=10,
interpolation_multiplier=10,
)
model.k_max = 3