Skip to content

Add run_from_experiment to stochastic solvers.#2318

Merged
Ericgig merged 22 commits into
qutip:masterfrom
Ericgig:feature.stochastic_from_experiments
Apr 25, 2024
Merged

Add run_from_experiment to stochastic solvers.#2318
Ericgig merged 22 commits into
qutip:masterfrom
Ericgig:feature.stochastic_from_experiments

Conversation

@Ericgig

@Ericgig Ericgig commented Feb 6, 2024

Copy link
Copy Markdown
Member

Description
Add the capacity of stochastic solver to run from know noise or measurements.
In the lab, the measurement can be obtained, but that measurements is a mix of and expectation values and noise. The stochastic solver can be used to split these components to study the system.

The new method for this is SMESolver.run_from_experiment. It works similarly to run of deterministic solver: it compute a single trajectory. It can take either dW or measurement as the noise input. (dW is the default). dW input is available with every integration method, but measurement input is limited to euler, milstein, pred_corr, platen.

The measurement is expect(m_ops, state_t) + dW / dt. For run_from_experiment it has no choice but to take state_t at the start of the interval, but for the result for smesovle, it was taken at the end of the interval. I updated the store_measurement options to allow the user the choose where it is taken between start, end and middle. When start is used, the run's result's measurement can be feed back to run_from_experiment to recompute the same trajectory. (The theory is the integral of the expectation value over the interval.)

Another change in this PR is to keep the dW in the wiener and result class. We used to sum them into W, but the dW are what we use so it just end up being extra calls to np.cumsum and np.diff.

@Ericgig Ericgig marked this pull request as draft February 6, 2024 18:04
@coveralls

coveralls commented Feb 6, 2024

Copy link
Copy Markdown

Coverage Status

coverage: 86.079% (+0.01%) from 86.069%
when pulling cc389c6 on Ericgig:feature.stochastic_from_experiments
into 91273c4 on qutip:master.

@Ericgig Ericgig marked this pull request as ready for review February 6, 2024 22:44
@Ericgig Ericgig requested review from hodgestar and pmenczel April 10, 2024 14:57

@pmenczel pmenczel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a cool new feature! I do not think that I have much to add.

Just as a side note, I used this opportunity to finally try to understand what exactly happens with the heterodyne option, and it took me quite a while to figure out. In the users guide, there is the definition of the homodyne current; I think it could be useful to add a definition of the heterodyne currents as well? (But I don't know if that's in the scope of this PR.)

Comment thread qutip/solver/multitraj.py
Comment thread qutip/solver/stochastic.py Outdated
Comment thread qutip/solver/stochastic.py Outdated
Comment thread qutip/solver/stochastic.py
Comment thread qutip/tests/solver/test_stochastic.py Outdated
Comment thread qutip/solver/sode/_noise.py Outdated
@Ericgig Ericgig force-pushed the feature.stochastic_from_experiments branch from 42c9b93 to 3c14639 Compare April 18, 2024 21:11
@Ericgig Ericgig force-pushed the feature.stochastic_from_experiments branch 2 times, most recently from 82f0bae to 04994a2 Compare April 19, 2024 14:37
@Ericgig Ericgig force-pushed the feature.stochastic_from_experiments branch from 04994a2 to b508e4b Compare April 19, 2024 14:58
@Ericgig Ericgig merged commit 7d6c72e into qutip:master Apr 25, 2024
@Ericgig Ericgig deleted the feature.stochastic_from_experiments branch April 25, 2024 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants