-
Notifications
You must be signed in to change notification settings - Fork 261
MaxwellIO: Fix issue due to disparity between routed and mapped channels #1703
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,19 @@ def __init__(self, filename="", rec_name=None): | |
|
||
def _source_name(self): | ||
return self.filename | ||
|
||
def _get_ids_and_electrodes(self, version, stream_id, h5file, mapping): | ||
if int(version) == 20160704: | ||
ids = np.array(mapping["channel"]) | ||
els = np.array(mapping["electrode"]) | ||
else: | ||
ids = np.array(h5file["wells"][stream_id][self.rec_name]["groups"]["routed"]["channels"]) | ||
els = np.array(mapping["electrode"]) | ||
ids = ids[ids >= 0] | ||
|
||
mask = np.unique(mapping["channel"][np.isin(np.array(mapping["channel"]), ids)], | ||
|
||
return_index=True)[1] | ||
return ids, els[mask] | ||
|
||
|
||
def _parse_header(self): | ||
import h5py | ||
|
@@ -175,11 +188,7 @@ def _parse_header(self): | |
} | ||
self._stream_buffer_slice[stream_id] = slice(None) | ||
|
||
channel_ids = np.array(mapping["channel"]) | ||
electrode_ids = np.array(mapping["electrode"]) | ||
mask = channel_ids >= 0 | ||
channel_ids = channel_ids[mask] | ||
electrode_ids = electrode_ids[mask] | ||
channel_ids, electrode_ids = self._get_ids_and_electrodes(version, stream_id, h5file, mapping) | ||
|
||
for i, chan_id in enumerate(channel_ids): | ||
elec_id = electrode_ids[i] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you document where this version number comes from in a comment? Was this dev docs etc. I think knowing magic numbers at all times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took the version number from the existing code. My best guess is that it is actually the release date of the first file version, where the structure was a little different. Our lab works with the MaxTwo device which was released later on so I assume that it never used this version because it needs additional fields to correctly represent the multiple wells of the MaxTwo device. There is also an option for legacy data formats in the software supplied by maxwell, so I assume it must be that.