Skip to content

Commit

Permalink
[MRG] Fix indexing for batch simulations (#5)
Browse files Browse the repository at this point in the history
* ENH BatchSimulate for JSON path handling

Signed-off-by: samadpls <[email protected]>

* Fix: Docstring of dic_to_network

Signed-off-by: samadpls <[email protected]>

* ENH: Reorder the init params

Signed-off-by: samadpls <[email protected]>

* Added record_isec vsec validation test

Signed-off-by: samadpls <[email protected]>

* Removed net_json param and update test

Signed-off-by: samadpls <[email protected]>

* Refactored  Example and initialize parameters

Co-authored-by: Nicholas Tolley <[email protected]>
Signed-off-by: samadpls <[email protected]>

* Enh: visualization of dipole responses in plot_batch_simulate

Co-authored-by: Nicholas Tolley <[email protected]>
Signed-off-by: samadpls <[email protected]>

* Refactor batch simulation parameters and backend

Signed-off-by: samadpls <[email protected]>

* batches run in parallel

---------

Signed-off-by: samadpls <[email protected]>
Co-authored-by: samadpls <[email protected]>
  • Loading branch information
ntolley and samadpls committed Dec 3, 2024
1 parent 4759e37 commit a6114c9
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions hnn_core/batch_simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,13 @@ def run(self, param_grid, return_output=True,
param_combinations = self._generate_param_combinations(
param_grid, combinations)
total_sims = len(param_combinations)
num_sims_per_batch = max(total_sims // self.batch_size, 1)
batch_size = min(self.batch_size, total_sims)

results = []
simulated_data = []
for i in range(0, total_sims, num_sims_per_batch):
for i in range(0, total_sims, batch_size):
start_idx = i
end_idx = min(i + num_sims_per_batch, total_sims)
if i == batch_size - 1:
end_idx = len(param_combinations)
end_idx = min(i + batch_size, total_sims)
batch_results = self.simulate_batch(
param_combinations[start_idx:end_idx],
n_jobs=n_jobs,
Expand Down

0 comments on commit a6114c9

Please sign in to comment.