Skip to content

Conversation

@oameye
Copy link
Member

@oameye oameye commented Jun 6, 2025

@oameye oameye marked this pull request as draft June 21, 2025 19:12
@oameye
Copy link
Member Author

oameye commented Jun 30, 2025

Only one test failure left:

order = 2 #order of the cumulant expansion
@cnumbers N Δ g κ Γ R ν M

hc = FockSpace(:cavity)
ha = NLevelSpace(:atom, 2)

h = hc  ha

k = Index(h, :k, N, ha)
l = Index(h, :l, N, ha)
m = Index(h, :m, N, ha)
n = Index(h, :n, N, ha)

@qnumbers a::Destroy(h)

σ(i, j, k) = IndexedOperator(Transition(h, , i, j), k)
σn(i, j, k) = NumberedOperator(Transition(h, , i, j), k)

# Define the Hamiltonian
H = -Δ*a'a + g*(Σ(a'*σ(1, 2, k), k) + Σ(a*σ(2, 1, k), k))

J = [a, σ(1, 2, l), σ(2, 1, l), σ(2, 2, l)]
rates = [κ, Γ, R, ν]
ops = [a'*a, σ(2, 2, m)]
eqs = meanfield(ops, H, J; rates = rates, order = order)

# System parameters
N_ = 2e5
Γ_ = 1.0 #Γ=1mHz
Δ_ = 2500Γ_ #Δ=2.5Hz
g_ = 1000Γ_ #g=1Hz
κ_ = 5e6*Γ_ #κ=5kHz
R_ = 1000Γ_ #R=1Hz
ν_ = 1000Γ_ #ν=1Hz

ps = [N, Δ, g, κ, Γ, R, ν]
p0 = [N_, Δ_, g_, κ_, Γ_, R_, ν_]

op1 = σ(1, 2, m)
op2 = σ(2, 1, n)

# Test system with no filter func to evaluate corr function

eqs_c_2 = complete(eqs);
eqs_ev = evaluate(eqs_c_2; limits = (N=>3))

u0_ev = zeros(ComplexF64, length(eqs_ev))

@named sys_ev = ODESystem(eqs_ev)
prob_ev = ODEProblem(sys_ev, u0_ev, (0.0, 0.1/50Γ_), ps .=> p0);
sol_ev = solve(prob_ev, Tsit5(), maxiters = 1e7)

corr3 = CorrelationFunction(op1, op2, eqs_c_2)
corr3_ev = evaluate(corr3, 1, 2; limits = (N=>3));

@named csys3 = ODESystem(corr3_ev)

p0_c3 = correlation_p0(corr3_ev, sol_ev.u[end], ps .=> p0)
u0_c3 = correlation_u0(corr3_ev, sol_ev.u[end])
dict = merge(Dict(u0_c3), Dict(p0_c3))

# "var\"⟨σ122⟩\"(τ)" ∈ string.(unknowns(csys3))
# "var\"⟨σ122⟩\"(τ)" ∈ string.(first.(u0_c3))

prob_c3 = ODEProblem(csys3, dict, (0.0, 0.05))
sol_c3 = solve(prob_c3, Tsit5(); saveat = 0.001, maxiters = 1e8);

@codecov
Copy link

codecov bot commented Jul 2, 2025

Codecov Report

❌ Patch coverage is 93.75000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.78%. Comparing base (b99c9ae) to head (8d2db63).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/measurement_backaction_indices.jl 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #243      +/-   ##
==========================================
- Coverage   79.38%   78.78%   -0.61%     
==========================================
  Files          17       17              
  Lines        3235     3214      -21     
==========================================
- Hits         2568     2532      -36     
- Misses        667      682      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@oameye oameye marked this pull request as ready for review July 2, 2025 16:22
@oameye
Copy link
Member Author

oameye commented Sep 28, 2025

Only two examples in the docs remain to be fixed: unique_squeezing.md and ramsey_spectroscopy.md.

@ChristophHotter Can you have a look at them?

@oameye
Copy link
Member Author

oameye commented Sep 28, 2025

Migration to new ModelingToolkit.jl API:

  • Replaces all instances of ODESystem with System in documentation, markdown examples, and Jupyter notebooks, reflecting the updated ModelingToolkit.jl API. Updates related explanatory text accordingly. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]

  • Updates all example code to use the new approach for passing initial conditions and parameters to ODEProblem, using dictionaries and merging as required by the latest ModelingToolkit.jl conventions. [1] [2] [3] [4] [5] [6] [7]

Documentation and example improvements:

  • Updates explanatory text in markdown and notebooks to refer to System instead of ODESystem, and clarifies the new parameter/initial condition handling. [1] [2] [3] [4] [5] [6]

Dependency and CI configuration updates:

  • Updates the SymbolicUtils dependency in docs/Project.toml to a newer version for compatibility.
  • Comments out the 'pre' Julia version in the test matrix and disables some example documentation pages that may not be compatible with the latest changes. [1] [2]
  • Updates the Julia version in the documentation deployment workflow from 'lts' to '1'.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates QuantumCumulants.jl to work with ModelingToolkit v10 (MTKV10), implementing breaking changes in the API. The main change is replacing ODESystem with System and updating the corresponding function signatures and parameter handling throughout the codebase.

  • Replace ODESystem constructor with System across all files
  • Update ODEProblem creation to use dict-based parameter/initial condition merging instead of separate parameter lists
  • Refactor internal functions to support the new ModelingToolkit API

Reviewed Changes

Copilot reviewed 56 out of 57 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
Multiple test files Update from ODESystem to System and change ODEProblem parameter syntax
src/diffeq.jl Major refactoring of system creation logic and parameter extraction
src/correlation.jl Update correlation function system creation
src/measurement_backaction_indices.jl Replace ODESystem with System and move utility function
src/utils.jl Add utility function for averaging operations
docs/ files Update documentation examples to use new syntax

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@ChristophHotter ChristophHotter left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for your work!
I will fix adapt the jupyter notebooks and look at the issue with SQA v0.4.2 later.

Project.toml Outdated
Random = "1.10"
SciMLBase = "1, 2"
SecondQuantizedAlgebra = "0.3.1"
SecondQuantizedAlgebra = "<0.4.2"
Copy link
Member

Choose a reason for hiding this comment

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

Fix to 0.4.1 for now.
I will look at v0.4.2 later.

Copy link
Member

Choose a reason for hiding this comment

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

The dict for the ODEProblem needs to be added also for the jupyter-notebooks. I will do it in a separate PR later.

tf = 1/20Γ_ # free evolution without drive
function f(t)
global function f(t)
Copy link
Member

Choose a reason for hiding this comment

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

Why does the function need to be global?

Copy link
Member Author

Choose a reason for hiding this comment

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

I doesn't, think. I remnant of when I was trying to debug

@oameye
Copy link
Member Author

oameye commented Sep 30, 2025

Can we do SQA 4.2 in a seperate PR?

@oameye
Copy link
Member Author

oameye commented Sep 30, 2025

We should implement a Literate.jl workflow such that the jupyter notebooks should not be updated manually. I propose we merge and do this in a seperate PR.

@oameye oameye merged commit 5213402 into master Sep 30, 2025
5 checks passed
@oameye oameye deleted the MTK@v10 branch September 30, 2025 09:55
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