Skip to content

Commit 7dfae5d

Browse files
committed
tspan -> timespan.
1 parent d30732b commit 7dfae5d

File tree

22 files changed

+71
-71
lines changed

22 files changed

+71
-71
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ include("scripts/pendulum.jl")
2828

2929
type = Float32 # Float16 etc.
3030
# get data
31-
qp_data = GeometricMachineLearning.apply_toNT(a -> CuArray(type.(a)), pendulum_data((q=[0.], p=[1.]); tspan=(0.,100.)))
31+
qp_data = GeometricMachineLearning.apply_toNT(a -> CuArray(type.(a)), pendulum_data((q=[0.], p=[1.]); timespan=(0.,100.)))
3232
# call the DataLoader
3333
dl = DataLoader(qp_data)
3434

docs/src/tutorials/adjusting_the_loss_function.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ using GeometricProblems.HarmonicOscillator: hodeproblem
2020
import Random # hide
2121
Random.seed!(123) # hide
2222
23-
sol = integrate(hodeproblem(; tspan = 100), ImplicitMidpoint())
23+
sol = integrate(hodeproblem(; timespan = 100), ImplicitMidpoint())
2424
data = DataLoader(sol; suppress_info = true)
2525
2626
nn = NeuralNetwork(GSympNet(2))

docs/src/tutorials/symplectic_autoencoder.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ using GeometricIntegrators: integrate, ImplicitMidpoint
7979
using GeometricMachineLearning
8080
import Random # hide
8181
82-
pr = tl.hodeproblem(; tspan = (0.0, 800.))
82+
pr = tl.hodeproblem(; timespan = (0.0, 800.))
8383
sol = integrate(pr, ImplicitMidpoint())
8484
nothing # hide
8585
```

docs/src/tutorials/sympnet_tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import Random # hide
2727
Random.seed!(1234) # hide
2828
2929
# the problem is the ODE of the harmonic oscillator
30-
ho_problem = ho.hodeproblem(; tspan = 500)
30+
ho_problem = ho.hodeproblem(; timespan = 500)
3131
3232
# integrate the system
3333
solution = integrate(ho_problem, ImplicitMidpoint())

docs/src/tutorials/volume_preserving_transformer_rigid_body.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ We now generate the data by integrating with:
2727

2828
```@example rigid_body
2929
const timestep = .2
30-
const tspan = (0., 20.)
30+
const timespan = (0., 20.)
3131
nothing # hide
3232
```
3333

@@ -38,7 +38,7 @@ using GeometricMachineLearning # hide
3838
using GeometricIntegrators: integrate, ImplicitMidpoint
3939
using GeometricProblems.RigidBody: odeproblem, odeensemble, default_parameters
4040
41-
ensemble_problem = odeensemble(ics; tspan = tspan, timestep = timestep, parameters = default_parameters)
41+
ensemble_problem = odeensemble(ics; timespan = timespan, timestep = timestep, parameters = default_parameters)
4242
ensemble_solution = integrate(ensemble_problem, ImplicitMidpoint())
4343
4444
dl_cpu = DataLoader(ensemble_solution; suppress_info = true)
@@ -228,7 +228,7 @@ ics_val₂ = [0., sin(1.1), cos(1.1)]
228228
const t_validation = 120
229229
230230
function produce_trajectory(ics_val)
231-
problem = odeproblem(ics_val; tspan = (0, t_validation),
231+
problem = odeproblem(ics_val; timespan = (0, t_validation),
232232
timestep = timestep,
233233
parameters = default_parameters)
234234
solution = integrate(problem, ImplicitMidpoint())
@@ -314,7 +314,7 @@ We can see that the volume-preserving transformer performs much better than the
314314
We also compare the times it takes to integrate the system with (i) implicit midpoint, (ii) the volume-preserving transformer and (iii) the standard transformer:
315315
```@example rigid_body
316316
function timing() # hide
317-
problem = odeproblem(ics_val₁; tspan = (0, t_validation), timestep = timestep, parameters = default_parameters) # hide
317+
problem = odeproblem(ics_val₁; timespan = (0, t_validation), timestep = timestep, parameters = default_parameters) # hide
318318
solution = integrate(problem, ImplicitMidpoint()) # hide
319319
@time "Implicit Midpoint" solution = integrate(problem, ImplicitMidpoint())
320320
trajectory = Float32.(DataLoader(solution; suppress_info = true).input)

scripts/Script_using_fully_GML/data_problem.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ end
8585
########################################################################################
8686
# get data of a problem for Sypmnet (results is (data = target =(q,p))) from Hamiltonian
8787

88-
function get_phase_space_data(nameproblem, q₀, p₀, tspan = (0., 100.), timestep = 0.1)
88+
function get_phase_space_data(nameproblem, q₀, p₀, timespan = (0., 100.), timestep = 0.1)
8989

9090
# get the Hamiltonien corresponding to name_problem
9191
H_problem, n_dim = dict_problem_H[nameproblem]
9292

93-
q,p = compute_phase_space(H_problem, q₀, p₀, tspan, timestep)
93+
q,p = compute_phase_space(H_problem, q₀, p₀, timespan, timestep)
9494

9595
return (q, p)
9696
end
@@ -102,15 +102,15 @@ function get_phase_space_multiple_trajectoy(nameproblem; singlematrix = true, n_
102102
H_problem, n_dim = dict_problem_H[nameproblem]
103103

104104
#define timespan
105-
tspan=(0.,n_points*timestep)
105+
timespan=(0.,n_points*timestep)
106106

107107
#compute phase space for each trajectory staring from a random point
108108
trajectory_q = [zeros(n_points+1,n_dim) for _ in 1:n_trajectory]
109109
trajectory_p = [zeros(n_points+1,n_dim) for _ in 1:n_trajectory]
110110
for i in 1:n_trajectory
111111
q₀ = [rand()*(qmax-qmin)+qmin for _ in 1:n_dim]
112112
p₀ = [rand()*(pmax-pmin)+pmin for _ in 1:n_dim]
113-
trajectory_q[i],trajectory_p[i] = compute_phase_space(H_problem, q₀, p₀, tspan, timestep)
113+
trajectory_q[i],trajectory_p[i] = compute_phase_space(H_problem, q₀, p₀, timespan, timestep)
114114
end
115115

116116
if singlematrix
@@ -125,7 +125,7 @@ end
125125
###############################################################################
126126
# compute phase space from the Hamiltonian
127127

128-
function compute_phase_space(H_problem, q₀, p₀, tspan = (0., 100.), timestep = 0.1)
128+
function compute_phase_space(H_problem, q₀, p₀, timespan = (0., 100.), timestep = 0.1)
129129

130130
n_dim = length(q₀)
131131

@@ -144,7 +144,7 @@ function compute_phase_space(H_problem, q₀, p₀, tspan = (0., 100.), timestep
144144
h(t, q, p, params) = H2(q,p)
145145

146146
# simulate data with geometric Integrators
147-
ode = HODEProblem(v, f, h, tspan, timestep, q₀, p₀)
147+
ode = HODEProblem(v, f, h, timespan, timestep, q₀, p₀)
148148

149149
#return sol = integrate(ode, SymplecticEulerA())
150150
return sol = integrate(ode, SymplecticTableau(TableauExplicitEuler()))
@@ -175,7 +175,7 @@ function get_multiple_trajectory_structure(nameproblem; n_trajectory = 1, n_poin
175175
H_problem, n_dim = dict_problem_H[nameproblem]
176176

177177
#define timespan
178-
tspan=(0.,n_points*timestep)
178+
timespan=(0.,n_points*timestep)
179179

180180
#compute phase space for each trajectory staring from a random point
181181
pre_data = NamedTuple()
@@ -184,7 +184,7 @@ function get_multiple_trajectory_structure(nameproblem; n_trajectory = 1, n_poin
184184

185185
q₀ = [rand()*(qmax-qmin)+qmin for _ in 1:n_dim]
186186
p₀ = [rand()*(pmax-pmin)+pmin for _ in 1:n_dim]
187-
q, p = compute_phase_space(H_problem, q₀, p₀, tspan, timestep)
187+
q, p = compute_phase_space(H_problem, q₀, p₀, timespan, timestep)
188188

189189
Data = [(q[n], p[n]) for n in 1:size(q,1)]
190190

@@ -217,7 +217,7 @@ function get_multiple_trajectory_structure_with_target(nameproblem; n_trajectory
217217
dH(x) = symplectic_matrix * ∇H(x)
218218

219219
#define timespan
220-
tspan=(0.,n_points*timestep)
220+
timespan=(0.,n_points*timestep)
221221

222222
#compute phase space for each trajectory staring from a random point
223223
pre_data = NamedTuple()
@@ -227,7 +227,7 @@ function get_multiple_trajectory_structure_with_target(nameproblem; n_trajectory
227227

228228
q₀ = [rand()*(qmax-qmin)+qmin for _ in 1:n_dim]
229229
p₀ = [rand()*(pmax-pmin)+pmin for _ in 1:n_dim]
230-
q, p = compute_phase_space(H_problem, q₀, p₀, tspan, timestep)
230+
q, p = compute_phase_space(H_problem, q₀, p₀, timespan, timestep)
231231

232232
Data = [(q[n], p[n]) for n in 1:size(q,1)]
233233
data_calc = [[q[n]..., p[n]...] for n in 1:size(q,1)]
@@ -265,7 +265,7 @@ function get_multiple_trajectory_structure_Lagrangian(nameproblem; n_trajectory
265265
H_problem, n_dim = dict_problem_L[nameproblem]
266266

267267
#define timespan
268-
tspan=(0.,n_points*timestep)
268+
timespan=(0.,n_points*timestep)
269269

270270
#compute phase space for each trajectory staring from a random point
271271
pre_data = []
@@ -278,7 +278,7 @@ function get_multiple_trajectory_structure_Lagrangian(nameproblem; n_trajectory
278278

279279
q₀ = [rand()*(qmax-qmin)+qmin for _ in 1:n_dim]
280280
p₀ = [rand()*(pmax-pmin)+pmin for _ in 1:n_dim]
281-
q, p = compute_phase_space(H_problem, q₀, p₀, tspan, timestep)
281+
q, p = compute_phase_space(H_problem, q₀, p₀, timespan, timestep)
282282

283283
Data = [q[n] for n in 1:size(q,1)]
284284

scripts/ensemblesolution/harmonic_oscillator.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ using GeometricProblems.HarmonicOscillator: hodeensemble, hamiltonian, default_p
88

99

1010
#create the object ensemble_solution
11-
ensemble_problem = hodeensemble(tspan = (0.0,4.0))
11+
ensemble_problem = hodeensemble(timespan = (0.0,4.0))
1212
ensemble_solution = exact_solution(ensemble_problem )
1313

1414
include("plots.jl")

scripts/pendulum.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ end
3232
@doc raw"""
3333
Generates data for a pendulum in 2d with optional arguments:
3434
- `T`: the type of the data (`Float32`, `Float64`, `Float16`, etc.)
35-
- `tspan`: default is `(0., 100.)`
35+
- `timespan`: default is `(0., 100.)`
3636
- `timestep` default is `0.1`
3737
- `q0`: default is `randn(1)`
3838
- `p0`: default is `rand(1)`.
3939
"""
40-
function pendulum_data(; T = Float64, tspan = (T(0.), T(100.)), timestep = T(0.1), q0 = T.(randn(1)), p0 = T.(randn(1)))
40+
function pendulum_data(; T = Float64, timespan = (T(0.), T(100.)), timestep = T(0.1), q0 = T.(randn(1)), p0 = T.(randn(1)))
4141
# simulate data with geometric Integrators
42-
ode = HODEProblem(v, f, H, tspan, timestep, q0, p0)
42+
ode = HODEProblem(v, f, H, timespan, timestep, q0, p0)
4343

4444
# sol = integrate(ode, SymplecticEulerA())
4545
sol = integrate(ode, ImplicitMidpoint())
@@ -52,6 +52,6 @@ function pendulum_data(; T = Float64, tspan = (T(0.), T(100.)), timestep = T(0.1
5252
return (q=q, p=p)
5353
end
5454

55-
function pendulum_data(ics::NamedTuple{(:q, :p), Tuple{AT, AT}}; tspan = (T(0.), T(100.)), timestep = T(0.1)) where {T, AT<:AbstractVector{T}}
56-
pendulum_data(; T=T, tspan=tspan, timestep=timestep, q0=ics.q, p0=ics.p)
55+
function pendulum_data(ics::NamedTuple{(:q, :p), Tuple{AT, AT}}; timespan = (T(0.), T(100.)), timestep = T(0.1)) where {T, AT<:AbstractVector{T}}
56+
pendulum_data(; T=T, timespan=timespan, timestep=timestep, q0=ics.q, p0=ics.p)
5757
end

scripts/symplectic_autoencoders/integration.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ p_zero = false
1919
μ_right = T(4/6)
2020

2121
function perform_integration(params, n_time_steps)
22-
tspan = (T(0),T(1))
23-
timestep = T((tspan[2] - tspan[1])/(n_time_steps-1))
22+
timespan = (T(0),T(1))
23+
timestep = T((timespan[2] - timespan[1])/(n_time_steps-1))
2424
ics_offset = p_zero ? get_initial_condition2(params.μ, params.Ñ) : get_initial_condition(params.μ, params.Ñ)
2525
ics = (q=ics_offset.q.parent, p=ics_offset.p.parent)
26-
ode = HODEProblem(v_f_hamiltonian(params)..., parameters=params, tspan, timestep, ics)
26+
ode = HODEProblem(v_f_hamiltonian(params)..., parameters=params, timespan, timestep, ics)
2727
sol = integrate(ode, ImplicitMidpoint())
2828
end
2929

scripts/symplectic_autoencoders/online_sympnet.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Random
99
backend = CUDABackend()
1010

1111
params = [(α = α̃ ^ 2, N = 200) for α̃ in 0.8 : .1 : 0.8]
12-
pr = hodeensemble(; tspan = (0.0, 800.), parameters = params)
12+
pr = hodeensemble(; timespan = (0.0, 800.), parameters = params)
1313
sol = integrate(pr, ImplicitMidpoint())
1414
dl_cpu_64 = DataLoader(sol; autoencoder = true)
1515
dl = DataLoader(dl_cpu_64, backend, Float32)

0 commit comments

Comments
 (0)