Skip to content

Commit

Permalink
Fix mutation of params bug
Browse files Browse the repository at this point in the history
- `taskScript` was being updated every time the script was run
  • Loading branch information
bjhardcastle committed May 21, 2024
1 parent 05fdd22 commit a4265e5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/np_workflows/shared/base_experiments.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import abc
import configparser
import contextlib
import copy
import enum
import functools
import pathlib
Expand Down Expand Up @@ -677,14 +678,14 @@ def camstim_script(self) -> upath.UPath:

def run_script(self, stim: Literal['sound_test', 'mapping', 'task', 'opto', 'optotagging', 'spontaneous', 'spontaneous_rewards']) -> None:

params = getattr(self, f'{stim.replace(" ", "_")}_params')
params = copy.deepcopy(getattr(self, f'{stim.replace(" ", "_")}_params'))

# add mouse and user info for MPE
params['mouse_id'] = str(self.mouse.id)
params['user_id'] = self.user.id if self.user else 'ben.hardcastle'

script: str = params['taskScript']
params['taskScript'] = (self.task_script_base / script).as_posix()
if self.task_script_base not in params['taskScript']:
params['taskScript'] = (self.task_script_base / params['taskScript']).as_posix()

if self.is_pretest:
params['maxFrames'] = 60 * 15
Expand Down

0 comments on commit a4265e5

Please sign in to comment.