From d19986cc442749b017dfe09edba1dda87aec0ccd Mon Sep 17 00:00:00 2001 From: Mayo Faulkner Date: Wed, 27 Mar 2024 10:53:34 +0000 Subject: [PATCH] make sure probe insertion not overwritten on partial update --- atlaselectrophysiology/load_data.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/atlaselectrophysiology/load_data.py b/atlaselectrophysiology/load_data.py index 74aa80e..12701f8 100644 --- a/atlaselectrophysiology/load_data.py +++ b/atlaselectrophysiology/load_data.py @@ -42,6 +42,10 @@ def __init__(self, one=None, brain_atlas=None, testing=False, probe_id=None, self.brain_regions = self.one.alyx.rest('brain-regions', 'list') self.chn_coords = None self.chn_depths = None + # Download bwm aggregate tables for for ephys feature gui + table_path = self.one.cache_dir.joinpath('bwm_features') + s3, bucket_name = aws.get_s3_from_alyx(alyx=self.one.alyx) + aws.s3_download_folder("aggregates/bwm/latest", table_path, s3=s3, bucket_name=bucket_name) # Initialise all variables that get assigned self.sess_with_hist = None @@ -65,11 +69,6 @@ def __init__(self, one=None, brain_atlas=None, testing=False, probe_id=None, self.alyx_str = None self.sr = None - # Download bwm aggregate tables for for ephys feature gui - table_path = self.one.cache_dir.joinpath('bwm_features') - s3, bucket_name = aws.get_s3_from_alyx(alyx=self.one.alyx) - aws.s3_download_folder("aggregates/bwm/latest", table_path, s3=s3, bucket_name=bucket_name) - if probe_id is not None: self.sess = self.one.alyx.rest('insertions', 'list', id=probe_id) @@ -578,7 +577,7 @@ def update_json(self, json_data): # Get the new trajectory ephys_traj = self.one.alyx.rest('trajectories', 'list', probe_insertion=self.probe_id, provenance='Ephys aligned histology track', no_cache=True) - patch_dict = {'json': json_data} + patch_dict = {'probe_insertion': self.probe_id, 'json': json_data} self.one.alyx.rest('trajectories', 'partial_update', id=ephys_traj[0]['id'], data=patch_dict)