Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Original channel idx #133

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions atlaselectrophysiology/load_data_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class LoadDataLocal:
def __init__(self):
ONE(silent=True, password='international')
ONE(base_url='https://openalyx.internationalbrainlab.org', silent=True, password='international')
self.brain_atlas = atlas.AllenAtlas(25)
self.franklin_atlas = None
self.folder_path = None
Expand Down Expand Up @@ -99,8 +99,11 @@ def get_data(self):

shank_chns = np.bitwise_and(self.chn_coords_all[:, 0] >= shanks[self.shank_idx][0],
self.chn_coords_all[:, 0] <= shanks[self.shank_idx][1])
self.orig_idx = np.where(shank_chns)[0]
self.chn_coords = self.chn_coords_all[shank_chns, :]

else:
self.orig_idx = None
self.chn_coords = self.chn_coords_all

chn_depths = self.chn_coords[:, 1]
Expand Down Expand Up @@ -261,8 +264,7 @@ def upload_data(self, feature, track, xyz_channels):
with open(self.folder_path.joinpath(prev_align_filename), "w") as f:
json.dump(original_json, f, indent=2, separators=(',', ': '))

@staticmethod
def create_channel_dict(brain_regions):
def create_channel_dict(self, brain_regions):
"""
Create channel dictionary in form to write to json file
:param brain_regions: information about location of electrode channels in brain atlas
Expand All @@ -281,6 +283,9 @@ def create_channel_dict(brain_regions):
'brain_region_id': int(brain_regions.id[i]),
'brain_region': brain_regions.acronym[i]
}
if self.orig_idx is not None:
channel['original_channel_idx'] = int(self.orig_idx[i])

data = {'channel_' + str(i): channel}
channel_dict.update(data)

Expand Down
Loading