Skip to content

Commit e720c9f

Browse files
Use ProgressMeter.jl rather than internal implementation
1 parent e8ec73f commit e720c9f

16 files changed

+22
-135
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "QuantumToolbox"
22
uuid = "6c2fb7c5-b903-41d2-bc5e-5a7c320b9fab"
3-
authors = ["Alberto Mercurio", "Yi-Te Huang"]
43
version = "0.37.0"
4+
authors = ["Alberto Mercurio", "Yi-Te Huang"]
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
@@ -18,6 +18,7 @@ LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
1818
OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8"
1919
OrdinaryDiffEqTsit5 = "b1df2697-797e-41e3-8120-5422d3b24e4a"
2020
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
21+
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
2122
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
2223
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
2324
SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
@@ -60,6 +61,7 @@ Makie = "0.24"
6061
OrdinaryDiffEqCore = "1"
6162
OrdinaryDiffEqTsit5 = "1"
6263
Pkg = "1"
64+
ProgressMeter = "1.11.0"
6365
Random = "1"
6466
SciMLBase = "2.105"
6567
SciMLOperators = "1.4"

src/QuantumToolbox.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import Graphs: connected_components, DiGraph
6262
import IncompleteLU: ilu
6363
import LaTeXStrings: @L_str
6464
import Pkg
65+
import ProgressMeter: Progress, next!
6566
import Random: AbstractRNG, default_rng, seed!
6667
import SpecialFunctions: loggamma
6768
import StaticArraysCore: SVector, MVector
@@ -81,7 +82,6 @@ export cache_operator, iscached, isconstant
8182
include("settings.jl")
8283
include("utilities.jl")
8384
include("versioninfo.jl")
84-
include("progress_bar.jl")
8585
include("linear_maps.jl")
8686

8787
# Quantum Object

src/progress_bar.jl

Lines changed: 0 additions & 85 deletions
This file was deleted.

src/time_evolution/callback_helpers/callback_helpers.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ end
5757
function _generate_save_callback(e_ops, tlist, progress_bar, method)
5858
e_ops_data = e_ops isa Nothing ? nothing : _get_e_ops_data(e_ops, method)
5959

60-
progr = getVal(progress_bar) ? ProgressBar(length(tlist), enable = getVal(progress_bar)) : nothing
60+
progr = getVal(progress_bar) ? Progress(length(tlist), showspeed=true, enabled = getVal(progress_bar)) : nothing
6161

6262
expvals = e_ops isa Nothing ? nothing : Array{ComplexF64}(undef, length(e_ops), length(tlist))
6363

@@ -69,7 +69,7 @@ function _generate_stochastic_save_callback(e_ops, sc_ops, tlist, store_measurem
6969
e_ops_data = e_ops isa Nothing ? nothing : _get_e_ops_data(e_ops, method)
7070
m_ops_data = _get_m_ops_data(sc_ops, method)
7171

72-
progr = getVal(progress_bar) ? ProgressBar(length(tlist), enable = getVal(progress_bar)) : nothing
72+
progr = getVal(progress_bar) ? Progress(length(tlist), showspeed=true, enabled = getVal(progress_bar)) : nothing
7373

7474
expvals = e_ops isa Nothing ? nothing : Array{ComplexF64}(undef, length(e_ops), length(tlist))
7575
m_expvals = getVal(store_measurement) ? Array{Float64}(undef, length(sc_ops), length(tlist) - 1) : nothing

src/time_evolution/callback_helpers/mcsolve_callback_helpers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function _generate_mcsolve_kwargs(ψ0, T, e_ops, tlist, c_ops, jump_callback, rn
106106
end
107107

108108
if e_ops isa Nothing
109-
# We are implicitly saying that we don't have a `ProgressBar`
109+
# We are implicitly saying that we don't have a `Progress`
110110
kwargs2 =
111111
haskey(kwargs, :callback) ? merge(kwargs, (callback = CallbackSet(cb1, kwargs.callback),)) :
112112
merge(kwargs, (callback = cb1,))

src/time_evolution/callback_helpers/mesolve_callback_helpers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Helper functions for the mesolve callbacks.
33
=#
44

5-
struct SaveFuncMESolve{TE,PT<:Union{Nothing,ProgressBar},IT,TEXPV<:Union{Nothing,AbstractMatrix}} <: AbstractSaveFunc
5+
struct SaveFuncMESolve{TE,PT<:Union{Nothing,Progress},IT,TEXPV<:Union{Nothing,AbstractMatrix}} <: AbstractSaveFunc
66
e_ops::TE
77
progr::PT
88
iter::IT

src/time_evolution/callback_helpers/sesolve_callback_helpers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Helper functions for the sesolve callbacks.
33
=#
44

5-
struct SaveFuncSESolve{TE,PT<:Union{Nothing,ProgressBar},IT,TEXPV<:Union{Nothing,AbstractMatrix}} <: AbstractSaveFunc
5+
struct SaveFuncSESolve{TE,PT<:Union{Nothing,Progress},IT,TEXPV<:Union{Nothing,AbstractMatrix}} <: AbstractSaveFunc
66
e_ops::TE
77
progr::PT
88
iter::IT

src/time_evolution/callback_helpers/smesolve_callback_helpers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ struct SaveFuncSMESolve{
66
SM,
77
TE,
88
TE2,
9-
PT<:Union{Nothing,ProgressBar},
9+
PT<:Union{Nothing,Progress},
1010
IT,
1111
TEXPV<:Union{Nothing,AbstractMatrix},
1212
TMEXPV<:Union{Nothing,AbstractMatrix},

src/time_evolution/callback_helpers/ssesolve_callback_helpers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ struct SaveFuncSSESolve{
66
SM,
77
TE,
88
TE2,
9-
PT<:Union{Nothing,ProgressBar},
9+
PT<:Union{Nothing,Progress},
1010
IT,
1111
TEXPV<:Union{Nothing,AbstractMatrix},
1212
TMEXPV<:Union{Nothing,AbstractMatrix},

src/time_evolution/mcsolve.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ If the environmental measurements register a quantum jump, the wave function und
205205
- `jump_callback`: The Jump Callback type: Discrete or Continuous. The default is `ContinuousLindbladJumpCallback()`, which is more precise.
206206
- `progress_bar`: Whether to show the progress bar. Using non-`Val` types might lead to type instabilities.
207207
- `prob_func`: Function to use for generating the ODEProblem.
208-
- `output_func`: a `Tuple` containing the `Function` to use for generating the output of a single trajectory, the (optional) `ProgressBar` object, and the (optional) `RemoteChannel` object.
208+
- `output_func`: a `Tuple` containing the `Function` to use for generating the output of a single trajectory, the (optional) `Progress` object, and the (optional) `RemoteChannel` object.
209209
- `kwargs`: The keyword arguments for the ODEProblem.
210210
211211
# Notes
@@ -332,7 +332,7 @@ If the environmental measurements register a quantum jump, the wave function und
332332
- `jump_callback`: The Jump Callback type: Discrete or Continuous. The default is `ContinuousLindbladJumpCallback()`, which is more precise.
333333
- `progress_bar`: Whether to show the progress bar. Using non-`Val` types might lead to type instabilities.
334334
- `prob_func`: Function to use for generating the ODEProblem.
335-
- `output_func`: a `Tuple` containing the `Function` to use for generating the output of a single trajectory, the (optional) `ProgressBar` object, and the (optional) `RemoteChannel` object.
335+
- `output_func`: a `Tuple` containing the `Function` to use for generating the output of a single trajectory, the (optional) `Progress` object, and the (optional) `RemoteChannel` object.
336336
- `keep_runs_results`: Whether to save the results of each trajectory. Default to `Val(false)`.
337337
- `normalize_states`: Whether to normalize the states. Default to `Val(true)`.
338338
- `kwargs`: The keyword arguments for the ODEProblem.

0 commit comments

Comments
 (0)