Skip to content

Commit 9138f7e

Browse files
committed
Remove trailing whitespaces
1 parent 4940b66 commit 9138f7e

File tree

2 files changed

+43
-43
lines changed

2 files changed

+43
-43
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![DOI:10.5194/gmd-2023-38](https://img.shields.io/badge/Journal_article-10.5194/gmd--2023--38-d4a519.svg)](https://doi.org/10.5194/gmd-2023-38)
99
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
1010

11-
`ParticleDA.jl` is a Julia package to perform data assimilation with particle filters,
11+
`ParticleDA.jl` is a Julia package to perform data assimilation with particle filters,
1212
supporting both thread-based parallelism and distributed processing using MPI.
1313

1414
This project is developed in collaboration with the

test/runtests.jl

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using ParticleDA
22
using ParticleDA.Kalman
3-
using HDF5, LinearAlgebra, MPI, PDMats, Random, StableRNGs, Statistics, Test, YAML
3+
using HDF5, LinearAlgebra, MPI, PDMats, Random, StableRNGs, Statistics, Test, YAML
44

55
include(joinpath(@__DIR__, "models", "llw2d.jl"))
66
include(joinpath(@__DIR__, "models", "lorenz63.jl"))
@@ -96,7 +96,7 @@ end
9696
check_hdf5_group_valid(file, group, group_name)
9797
@test read(group, dataset_name) == test_array
9898
@test all([
99-
read_attribute(group[dataset_name], k) == test_attributes[k]
99+
read_attribute(group[dataset_name], k) == test_attributes[k]
100100
for k in keys(test_attributes)
101101
])
102102
# test writing to existing dataset name results in warning and does not update
@@ -111,9 +111,9 @@ end
111111
# test writing timer data
112112
timer_strings = ["ab", "cde", "fg", "hij"]
113113
ParticleDA.write_timers(
114-
map(length, timer_strings),
115-
length(timer_strings),
116-
codeunits(join(timer_strings)),
114+
map(length, timer_strings),
115+
length(timer_strings),
116+
codeunits(join(timer_strings)),
117117
output_filename
118118
)
119119
h5open(output_filename, "cw") do file
@@ -128,7 +128,7 @@ end
128128

129129

130130
@testset (
131-
"Generic model interface unit tests - $(parentmodule(typeof(model)))"
131+
"Generic model interface unit tests - $(parentmodule(typeof(model)))"
132132
) for model in (
133133
LLW2d.init(Dict()),
134134
Lorenz63.init(Dict()),
@@ -155,7 +155,7 @@ end
155155
"x_length" => 100e3,
156156
"y_length" => 100e3,
157157
"station_boundary_x" => 30e3,
158-
"station_boundary_y" => 30e3,
158+
"station_boundary_y" => 30e3,
159159
)
160160
)
161161
),
@@ -178,7 +178,7 @@ end
178178
config.model,
179179
seed,
180180
estimate_bound_constant,
181-
config.estimate_n_samples;
181+
config.estimate_n_samples;
182182
RNGType=StableRNG
183183
)
184184
end
@@ -219,7 +219,7 @@ end
219219
avg=mean(states; dims=2), var=var(states, corrected=true; dims=2)
220220
)
221221
for statistics_type in (
222-
ParticleDA.NaiveMeanSummaryStat,
222+
ParticleDA.NaiveMeanSummaryStat,
223223
ParticleDA.NaiveMeanAndVarSummaryStat,
224224
ParticleDA.MeanSummaryStat,
225225
ParticleDA.MeanAndVarSummaryStat
@@ -275,12 +275,12 @@ end
275275
new_states = copy(states)
276276
Random.seed!(rng, seed)
277277
ParticleDA.sample_proposal_and_compute_log_weights!(
278-
new_states,
279-
log_weights,
280-
observation,
281-
time_index,
282-
model,
283-
filter_data,
278+
new_states,
279+
log_weights,
280+
observation,
281+
time_index,
282+
model,
283+
filter_data,
284284
filter_type,
285285
rng
286286
)
@@ -295,12 +295,12 @@ end
295295
# Check filter update gives deterministic updates when rng state is fixed
296296
Random.seed!(rng, seed)
297297
ParticleDA.sample_proposal_and_compute_log_weights!(
298-
new_states_2,
299-
log_weights_2,
300-
observation,
301-
time_index,
302-
model,
303-
filter_data,
298+
new_states_2,
299+
log_weights_2,
300+
observation,
301+
time_index,
302+
model,
303+
filter_data,
304304
filter_type,
305305
rng
306306
)
@@ -314,10 +314,10 @@ end
314314
n_task = 1
315315
model_params_dict = Dict(
316316
"llw2d" => Dict(
317-
"nx" => 32,
318-
"ny" => 32,
319-
"n_stations_x" => 4,
320-
"n_stations_y" => 4,
317+
"nx" => 32,
318+
"ny" => 32,
319+
"n_stations_x" => 4,
320+
"n_stations_y" => 4,
321321
"padding" => 0
322322
)
323323
)
@@ -336,8 +336,8 @@ end
336336
online_matrices = ParticleDA.init_online_matrices(model, 1)
337337
for f in nfields(online_matrices)
338338
matrix = getfield(online_matrices, f)
339-
@test isa(matrix, AbstractMatrix)
340-
end
339+
@test isa(matrix, AbstractMatrix)
340+
end
341341
state_dimension = ParticleDA.get_state_dimension(model)
342342
updated_indices = ParticleDA.get_state_indices_correlated_to_observations(
343343
model
@@ -377,10 +377,10 @@ end
377377
# X = F(x) + U and Y = HX + V where x is the previous state value, F the forward
378378
# operator for the deterministic state dynamics, U ~ Normal(0, Q) the additive
379379
# state noise, X the state at the next time step, H the linear observation
380-
# operator, V ~ Normal(0, R) the additive observation noise and Y the modelled
381-
# observations, is Normal(m, C) where
380+
# operator, V ~ Normal(0, R) the additive observation noise and Y the modelled
381+
# observations, is Normal(m, C) where
382382
# m = F(x) + QHᵀ(HQHᵀ + R)⁻¹(y − HF(x))
383-
# = F(x) + cov(X, Y) @ cov(Y, Y)⁻¹ (y − HF(x))
383+
# = F(x) + cov(X, Y) @ cov(Y, Y)⁻¹ (y − HF(x))
384384
# and C = Q − QHᵀ(HQHᵀ + R)⁻¹HQ = cov(X, X) - cov(X, Y) cov(Y, Y)⁻¹ cov(X, Y)ᵀ
385385
analytic_mean = copy(state)
386386
@view(analytic_mean[updated_indices]) .+= (
@@ -400,7 +400,7 @@ end
400400
# Create set of state 'particles' all equal to propagated state
401401
states = Matrix{ParticleDA.get_state_eltype(model)}(
402402
undef, (state_dimension, nprt)
403-
)
403+
)
404404
states .= state
405405
updated_states = copy(states)
406406
for state in eachcol(updated_states)
@@ -410,21 +410,21 @@ end
410410
# Mean of noise added by update_particle_noise! should be zero in all components
411411
# and empirical mean should therefore be zero to within Monte Carlo error. The
412412
# constant in the tolerance below was set by looking at scale of typical
413-
# deviation, the point of check is that errors scale at expected O(1/√N) rate.
414-
@test maximum(abs.(mean(noise, dims=2))) < (10. / sqrt(nprt))
413+
# deviation, the point of check is that errors scale at expected O(1/√N) rate.
414+
@test maximum(abs.(mean(noise, dims=2))) < (10. / sqrt(nprt))
415415
# Covariance of noise added by update_particle_noise! to observed state
416416
# components should be cov_X_X as computed above and empirical covariance of
417417
# these components should therefore be within Monte Carlo error of cov_X_X. The
418418
# constant in tolerance below was set by looking at scale of typical deviations,
419-
# the point of check is that errors scale at expected O(1/√N) rate.
419+
# the point of check is that errors scale at expected O(1/√N) rate.
420420
noise_cov = cov(noise, dims=2)
421-
@test maximum(abs.(noise_cov .- cov_X_X)) < (10. / sqrt(nprt))
421+
@test maximum(abs.(noise_cov .- cov_X_X)) < (10. / sqrt(nprt))
422422
ParticleDA.update_states_given_observations!(
423423
updated_states, observation, model, filter_data, rng
424424
)
425425
updated_mean = mean(updated_states, dims=2)
426426
updated_cov = cov(updated_states, dims=2)
427-
# Mean and covariance of updated particles should be within O(1/√N) Monte Carlo
427+
# Mean and covariance of updated particles should be within O(1/√N) Monte Carlo
428428
# error of analytic values - constants in tolerances were set by looking at
429429
# scale of typical deviations, main point of checks are that errors scale at
430430
# expected O(1/√N) rate.
@@ -469,24 +469,24 @@ end
469469
end
470470
471471
472-
@testset "Integration test -- $(input_file) with $(filter_type) and $(stat_type)" for
472+
@testset "Integration test -- $(input_file) with $(filter_type) and $(stat_type)" for
473473
filter_type in (ParticleDA.BootstrapFilter, ParticleDA.OptimalFilter),
474474
stat_type in (ParticleDA.MeanSummaryStat, ParticleDA.MeanAndVarSummaryStat),
475475
input_file in ["integration_test_$i.yaml" for i in 1:6]
476476
observation_file_path = tempname()
477477
ParticleDA.simulate_observations_from_model(
478-
LLW2d.init,
479-
joinpath(@__DIR__, input_file),
478+
LLW2d.init,
479+
joinpath(@__DIR__, input_file),
480480
observation_file_path
481481
)
482482
observation_sequence = h5open(
483483
ParticleDA.read_observation_sequence, observation_file_path, "r"
484484
)
485485
@test !any(isnan.(observation_sequence))
486486
states, statistics = ParticleDA.run_particle_filter(
487-
LLW2d.init,
488-
joinpath(@__DIR__, input_file),
489-
observation_file_path,
487+
LLW2d.init,
488+
joinpath(@__DIR__, input_file),
489+
observation_file_path,
490490
filter_type,
491491
stat_type,
492492
)

0 commit comments

Comments
 (0)