python-neo icon indicating copy to clipboard operation
python-neo copied to clipboard

Allow spikegadgets to handle another data style

Open zm711 opened this issue 1 year ago • 4 comments

Fixes #1517

Howdy @RobertoDF,

I think this should fix your problem :)

As I expected with neuropixels you can have different channel/chip ratios then we expected with the intan based chip. I think your colleague's data just happened to line up with the intan expectations. So in this case, I check if the headstage fits our expectations and if it doesn't I revert back to the old way of parsing the data. Note that I don't see your gain problem. Looking at a few random channels I see this:

  ('trode1252chan341', '341', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),
        ('trode1251chan340', '340', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),
        ('trode1250chan277', '277', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),
        ('trode1249chan276', '276', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),
        ('trode1248chan213', '213', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),
        ('trode1247chan212', '212', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),
        ('trode1246chan149', '149', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),
        ('trode1245chan148', '148', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),
        ('trode1244chan85', '85', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),
        ('trode1243chan84', '84', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),
        ('trode1242chan21', '21', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),
        ('trode1241chan20', '20', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),
        ('trode1240chan723', '723', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),
        ('trode1239chan722', '722', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),
        ('trode1238chan659', '659', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),
        ('trode1237chan658', '658', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),
        ('trode1236chan595', '595', 30000., 'int16', 'uV', 0.01831111, 0., 'trodes'),

The gain is correct.

zm711 avatar Aug 02 '24 14:08 zm711

This parsed the file you shared with me on my computer and seemed correct based on my summary look at the data. I'll likely push a couple more commits to add some comments to the code etc, but I should only be making cosmetic changes at this point.

zm711 avatar Aug 02 '24 14:08 zm711

Just tested it and it works. Amazing! Thanks for fixing it so quickly.

RobertoDF avatar Aug 02 '24 14:08 RobertoDF

That's awesome. I'll ping @alejoe91 for a review. But let's wait until end of next week before we merge at minimum so we can hopefully get a test file from you :)

zm711 avatar Aug 02 '24 14:08 zm711

@samuelgarcia, now that you're back you could also look over this. Basically, it spikegadgets doesn't always use an intan chip. i couldn't see any way in the metadata to tell which headstage is used, so if you have a better idea feel free to push, but this prevents the reader from breaking when using neuropixel style data instead of intan headstage style data.

zm711 avatar Aug 27 '24 12:08 zm711