Skip to content

Commit c4a3adf

Browse files
committed
Run formatter
1 parent 709ca99 commit c4a3adf

4 files changed

Lines changed: 34 additions & 23 deletions

File tree

src/Emulator.jl

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,22 +146,16 @@ function Emulator(
146146

147147
encoder_schedule = create_encoder_schedule(encoder_schedule)
148148
(encoded_io_pairs, input_structure_mats, output_structure_mats, _, _) =
149-
initialize_and_encode_with_schedule!(
150-
encoder_schedule,
151-
input_output_pairs;
152-
obs_noise_cov,
153-
encoder_kwargs...,
154-
)
149+
initialize_and_encode_with_schedule!(encoder_schedule, input_output_pairs; obs_noise_cov, encoder_kwargs...)
155150

156151
# build the machine learning tool in the encoded space
157-
build_models!(
152+
build_models!(machine_learning_tool, encoded_io_pairs, input_structure_mats, output_structure_mats; mlt_kwargs...)
153+
return Emulator{FT, typeof(encoder_schedule)}(
158154
machine_learning_tool,
155+
input_output_pairs,
159156
encoded_io_pairs,
160-
input_structure_mats,
161-
output_structure_mats;
162-
mlt_kwargs...,
157+
encoder_schedule,
163158
)
164-
return Emulator{FT, typeof(encoder_schedule)}(machine_learning_tool, input_output_pairs, encoded_io_pairs, encoder_schedule)
165159
end
166160

167161
"""

src/Utilities.jl

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ function get_structure_vec(structure_vecs, name = nothing)
8686
elseif isempty(structure_vecs)
8787
throw(ArgumentError("Please provide a structure vector."))
8888
else
89-
throw(ArgumentError("Structure vectors $(collect(keys(structure_vecs))) are present. Please indicate which to use."))
89+
throw(
90+
ArgumentError(
91+
"Structure vectors $(collect(keys(structure_vecs))) are present. Please indicate which to use.",
92+
),
93+
)
9094
end
9195
else
9296
if haskey(structure_vecs, name)
@@ -104,7 +108,11 @@ function get_structure_mat(structure_mats, name = nothing)
104108
elseif isempty(structure_mats)
105109
throw(ArgumentError("Please provide a structure matrix."))
106110
else
107-
throw(ArgumentError("Structure matrices $(collect(keys(structure_mats))) are present. Please indicate which to use."))
111+
throw(
112+
ArgumentError(
113+
"Structure matrices $(collect(keys(structure_mats))) are present. Please indicate which to use.",
114+
),
115+
)
108116
end
109117
else
110118
if haskey(structure_mats, name)
@@ -268,14 +276,20 @@ function initialize_and_encode_with_schedule!(
268276
)
269277

270278
if apply_to == "in"
271-
input_structure_mats =
272-
Dict{Symbol, StructureMatrix}(name => encode_structure_matrix(processor, mat) for (name, mat) in input_structure_mats)
273-
input_structure_vecs = Dict{Symbol, StructureVector}(name => encode_data(processor, vec) for (name, vec) in input_structure_vecs)
279+
input_structure_mats = Dict{Symbol, StructureMatrix}(
280+
name => encode_structure_matrix(processor, mat) for (name, mat) in input_structure_mats
281+
)
282+
input_structure_vecs = Dict{Symbol, StructureVector}(
283+
name => encode_data(processor, vec) for (name, vec) in input_structure_vecs
284+
)
274285
processed_io_pairs = PairedDataContainer(processed, get_outputs(processed_io_pairs))
275286
elseif apply_to == "out"
276-
output_structure_mats =
277-
Dict{Symbol, StructureMatrix}(name => encode_structure_matrix(processor, mat) for (name, mat) in output_structure_mats)
278-
output_structure_vecs = Dict{Symbol, StructureVector}(name => encode_data(processor, vec) for (name, vec) in output_structure_vecs)
287+
output_structure_mats = Dict{Symbol, StructureMatrix}(
288+
name => encode_structure_matrix(processor, mat) for (name, mat) in output_structure_mats
289+
)
290+
output_structure_vecs = Dict{Symbol, StructureVector}(
291+
name => encode_data(processor, vec) for (name, vec) in output_structure_vecs
292+
)
279293
processed_io_pairs = PairedDataContainer(get_inputs(processed_io_pairs), processed)
280294
end
281295
end

test/MarkovChainMonteCarlo/runtests.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ function test_gp_and_agp_1(y, σ2_y, iopairs::PairedDataContainer)
100100
) for model_params in gp_opt_params
101101
]
102102

103-
em_agp =
104-
Emulator(agp, iopairs, (obs_noise_cov = σ2_y,); encoder_schedule = [], kernel_params = kernel_params)
103+
em_agp = Emulator(agp, iopairs, (obs_noise_cov = σ2_y,); encoder_schedule = [], kernel_params = kernel_params)
105104

106105
return em, em_agp
107106
end

test/Utilities/runtests.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,12 @@ end
145145
(encoded_io_pairs, encoded_input_structure_mats, encoded_output_structure_mats, _, _) =
146146
initialize_and_encode_with_schedule!(encoder_schedule, io_pairs; prior_cov, obs_noise_cov)
147147

148-
(decoded_io_pairs, decoded_input_structure_mat, decoded_output_structure_mat) =
149-
decode_with_schedule(encoder_schedule, encoded_io_pairs, encoded_input_structure_mats[:prior_cov], encoded_output_structure_mats[:obs_noise_cov])
148+
(decoded_io_pairs, decoded_input_structure_mat, decoded_output_structure_mat) = decode_with_schedule(
149+
encoder_schedule,
150+
encoded_io_pairs,
151+
encoded_input_structure_mats[:prior_cov],
152+
encoded_output_structure_mats[:obs_noise_cov],
153+
)
150154
for (enc_dat, dec_dat, test_dat, enc_covv, dec_covv, test_covv, dim) in zip(
151155
(get_inputs(encoded_io_pairs), get_outputs(encoded_io_pairs)),
152156
(get_inputs(decoded_io_pairs), get_outputs(decoded_io_pairs)),

0 commit comments

Comments
 (0)