You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
spring cleaning: removing bugs and code smells (#261)
* removed non-existing argument from aln docstring
* removed params['bold'] option
* cleaned up bold initialization check
* removed unreachable condition
* fix continue_run order
* fix typo
* clean up simulateBold
* fix continue_run for chunkwise=True
* simplified outputDict.items()
* major fixes: setOutput / BOLD
* remove unused arguments
* fixed aln minimal notebook
* fixes to multimodel, testexploration, and continue_run
* reverted to automatic append for BOLD outputs
* remove duplicate arguments
* removed unnecessary append after reverting to default append for BOLD
* remove unused `self.start_t`, fix BOLD append for multimodel
* allow `continue_run=True` on first model run
* allow continue_run=True on first multimodel run
* removed first run continue_run warnings
# transform bold input according to self.boldInputTransform
92
-
ifself.boldInputTransform:
93
-
bold_input=self.boldInputTransform(bold_input)
94
-
95
-
# simulate bold model
96
-
self.boldModel.run(bold_input, append=append)
97
-
98
-
t_BOLD=self.boldModel.t_BOLD
99
-
BOLD=self.boldModel.BOLD
100
-
self.setOutput("BOLD.t_BOLD", t_BOLD)
101
-
self.setOutput("BOLD.BOLD", BOLD)
102
-
else:
103
-
logging.warn(
104
-
f"Will not simulate BOLD if output {bold_input.shape[1]*self.params['dt']} not at least of duration {self.boldModel.samplingRate_NDt*self.params['dt']}"
105
-
)
106
-
else:
77
+
ifnotself.boldInitialized:
107
78
logging.warn("BOLD model not initialized, not simulating BOLD. Use `run(bold=True)`")
79
+
return
80
+
81
+
bold_input=bold_variable[:, self.startindt :]
82
+
# logging.debug(f"BOLD input `{svn}` of shape {bold_input.shape}")
f"Will not simulate BOLD if output {bold_input.shape[1]*self.params['dt']} not at least of duration {self.boldModel.samplingRate_NDt*self.params['dt']}"
86
+
)
87
+
return
88
+
89
+
# only if the length of the output has a zero mod to the sampling rate,
90
+
# the downsampled output from the boldModel can correctly appended to previous data
91
+
# so: we are lazy here and simply disable appending in that case ...
2) `model.run(chunkwise=True)` runs the simulation in chunks of length `chunksize`.
198
-
3) `mode.run(continue_run=True)` continues the simulation of a previous run.
195
+
3) `mode.run(continue_run=True)` continues the simulation of a previous run. This has no effect during the first run.
199
196
200
197
:param inputs: list of inputs to the model, must have the same order as model.input_vars. Note: no sanity check is performed for performance reasons. Take care of the inputs yourself.
201
198
:type inputs: list[np.ndarray|]
@@ -205,28 +202,24 @@ def run(
205
202
:type chunksize: int, optional
206
203
:param bold: simulate BOLD signal (only for chunkwise integration), defaults to False
207
204
:type bold: bool, optional
208
-
:param append: append the chunkwise outputs to the outputs attribute, defaults to False, defaults to False
209
-
:type append: bool, optional
210
-
:param continue_run: continue a simulation by using the initial values from a previous simulation
205
+
:param append_outputs: append new and chunkwise outputs to the outputs attribute, defaults to False. Note: BOLD outputs are always appended.
206
+
:type append_outputs: bool, optional
207
+
:param continue_run: continue a simulation by using the initial values from a previous simulation. This has no effect during the first run.
211
208
:type continue_run: bool
212
209
"""
213
-
# TODO: legacy argument support
214
-
ifappend_outputsisnotNone:
215
-
append=append_outputs
210
+
self.initializeRun(initializeBold=bold)
216
211
217
212
# if a previous run is not to be continued clear the model's state
0 commit comments