catalystneuro / dombeck-lab-to-nwb

NWB Conversion project for the Dombeck lab at Northwestern University.
MIT License
0 stars 0 forks source link

Add traces from PicoScope #2

Closed weiglszonja closed 6 months ago

weiglszonja commented 7 months ago

This PR adds the raw voltage traces from a PicoScope 6 acquisition system.

Description from #1 : Simultaneous traces (velocity from rotary encoder, trigger signals for reward, air puff and light stimuli delivery, licking from a lick sensor, fluorescence detected by photomultiplier tubes (PMTs) from one or two optic fibers and output from waveform generator used to alternate 405-nm and 470-nm illumination every 10 ms) were collected at 4 kHz by a PicoScope 6 data acquisition system.

weiglszonja commented 6 months ago

@alessandratrapani

I'm adding an ElectricalSeries for the velocity and fluorescence signals as the follows:

Screenshot 2024-03-13 at 15 49 50 (2)

The binary signals (licking (if not empty), reward, air puff, light) are added to an ndx_events.AnnotatedEventsTable DynamicTable with description:

Screenshot 2024-03-13 at 15 55 24 (2)

Uploaded 20200129-0001.nwb that contains these changes.

If you'll agree with this approach I just need to update the UML image and this is ready.

alessandratrapani commented 6 months ago

I was looking at the ndx-event documentation, there is a subtype of LabeledEvents, called TTLs. Why don't we used that one, for Ch405 and Ch470? I think it's ok to keep the Light stimulus trigger, the Airpuff trigger and the Reward delivery trigger as AnnotatedEventsTable

weiglszonja commented 6 months ago

I was looking at the ndx-event documentation, there is a subtype of LabeledEvents, called TTLs. Why don't we used that one, for Ch405 and Ch470? I think it's ok to keep the Light stimulus trigger, the Airpuff trigger and the Reward delivery trigger as AnnotatedEventsTable

I don't see an advantage to store the pulse values (which are either 0s or 5s) in addition to event_times and labels. Maybe I'm missing something here?

Ah now I see, for TTLs the data attribute should be the indices of event types, something like this:

TTLs(
  name="abc"
  timestamps=[0.1, 0.2, 0.3, 0.4],
  data=[0, 1, 0, 1],
  labels=["event 1", "event 2"],
)

But this actually doesn't work for me 😅

RuntimeError: unable to write attribute 'labels' on object '/acquisition/TTLs/data'

Maybe I'm using it wrong...

alessandratrapani commented 6 months ago

Ah well, let's keep things easy then. I was suggesting the TTL type because for Ch405 and Ch470 the onset duration might be relevant, and TTLs type seemed just right. We can come back on it in a follow-up PR