Skip to content

Commit 53df9b1

Browse files
committed
fix: apply handlers before doing anything.
1 parent 9fc2967 commit 53df9b1

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/snake/mrd_utils/writer.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,13 @@ def make_base_mrd(
207207
coil_covar : NDArray, optional
208208
The coil covariance matrix, by default None
209209
"""
210+
# Apply the handlers and get the dynamic data, this might modifies the sim_conf !!
211+
if handlers is None:
212+
handlers = []
213+
for h in handlers:
214+
phantom = h.get_static(phantom, sim_conf)
215+
dynamic_data = [h.get_dynamic(phantom, sim_conf) for h in handlers]
216+
210217
try:
211218
log.warning("Existing %s it will be overwritten", filename)
212219
os.remove(filename)
@@ -220,14 +227,6 @@ def make_base_mrd(
220227
with PerfLogger(logger=log, name="acq"):
221228
sampler.add_all_acq_mrd(dataset, sim_conf)
222229

223-
# Apply the handlers and get the dynamic data
224-
if handlers is None:
225-
handlers = []
226-
for h in handlers:
227-
phantom = h.get_static(phantom, sim_conf)
228-
229-
dynamic_data = [h.get_dynamic(phantom, sim_conf) for h in handlers]
230-
231230
with PerfLogger(logger=log, name="phantom"):
232231
add_phantom_mrd(dataset, phantom, sim_conf)
233232

0 commit comments

Comments
 (0)