nwb-guide icon indicating copy to clipboard operation
nwb-guide copied to clipboard

Time alignment

Open garrettmflynn opened this issue 1 year ago • 10 comments

This PR implements time alignment.

@CodyCBakerPhD Would be great to get your help on a few final things:

  1. Can you point me to an example for setting up a Dummy Recording for a sorting interface so that we can simply set timestamps / starting time?
  2. The current iteration isn't properly setting timestamps on the preview conversion. Is there a reason this is happening?

Besides the above caveats, this is properly updating the time alignment information and requesting it back on the Source Data popup.

garrettmflynn avatar Apr 22 '24 20:04 garrettmflynn

Can you point me to an example for setting up a Dummy Recording for a sorting interface so that we can simply set timestamps / starting time?

Not a 'dummy' example, but a proper test case from example data: https://github.com/catalystneuro/neuroconv/blob/179711773fc67a2a733ebc6522afa0bea6f2f305/tests/test_on_data/test_sorting_interfaces.py#L29-L33

https://github.com/catalystneuro/neuroconv/blob/179711773fc67a2a733ebc6522afa0bea6f2f305/src/neuroconv/tools/testing/data_interface_mixins.py#L586-L589

Easy way to truly do a 'dummy' one is the use the official Mock one: https://github.com/catalystneuro/neuroconv/blob/179711773fc67a2a733ebc6522afa0bea6f2f305/tests/test_ecephys/test_ecephys_interfaces.py#L127-L131

The current iteration isn't properly setting timestamps on the preview conversion. Is there a reason this is happening?

I'll look into it

CodyCBakerPhD avatar Apr 23 '24 15:04 CodyCBakerPhD

And just to confirm, we actually do want to allow users to specify timestamps or a start time for Sorting Interfaces, independent of any active Recording Interfaces?

Mentioned this to Ben at the developer hackathon and he was a bit confused about what this actually would mean.

garrettmflynn avatar Apr 23 '24 15:04 garrettmflynn

If the exact recording interface used to generate the sorting is present in the pipeline, then they should link the sorting to the recording and adjust timestamps or shift starting time of the recording

Otherwise, they still need to be able to set timestamps and shift starting time as if they had chosen to include the original recording

CodyCBakerPhD avatar Apr 23 '24 16:04 CodyCBakerPhD

Ah gotcha. Makes sense now

garrettmflynn avatar Apr 23 '24 16:04 garrettmflynn

So this is practically ready for review.

Now that I've expanded my tests beyond the SpikeGLX-Phy test case, though, I've realized that the Phy Sorting Interface in the tutorial data seems to be locked to the SpikeGLX Recording Interface regardless of any user-defined parameters. Is this an expected behavior?

Screenshot 2024-04-24 at 2 44 37 PM

This was the previous behavior before https://github.com/catalystneuro/neuroconv/pull/823—though an error was thrown about the None and int addition. If providing a mock recording interface, the specified start time would take effect but it wasn't clear what it was shifting.

garrettmflynn avatar Apr 24 '24 21:04 garrettmflynn

Also confirmed that this time offset on the Recording Interface does not show up in stub files but can be seen from Neurosift after a full conversion.

garrettmflynn avatar Apr 24 '24 21:04 garrettmflynn

@garrettmflynn I don't see the link recording button on my end

image

CodyCBakerPhD avatar May 20 '24 18:05 CodyCBakerPhD

This is by design. I've implemented a check that determines what interfaces are compatible with a given SortingInterface before display, ensuring that users only select valid options.

garrettmflynn avatar May 20 '24 20:05 garrettmflynn

It's possible to disable the option—possibly with a related message on hover—instead of removing it completely. Would that be preferable?

garrettmflynn avatar May 20 '24 20:05 garrettmflynn

This is by design. I've implemented a check that determines what interfaces are compatible with a given SortingInterface before display, ensuring that users only select valid options.

Ahh, right you are - silly me I was using a nonsensible pipeline

That part is working as intended then

CodyCBakerPhD avatar May 20 '24 20:05 CodyCBakerPhD

A couple things I noticed testing this

i) the option of linking between compatible sorting and recording is now failing for the tutorial data (no button shows up)

ii) I set timestamps for Suite2p (single plane; 250 frames); they seem to have 'uploaded' to the interface fine because the alignment bar did say the proper start and stop interval according to the timestamps; but then they do not show up even in the final converted file

iii) Nothing seems to be applying to stub mode, I'm investigating that one myself

CodyCBakerPhD avatar May 30 '24 03:05 CodyCBakerPhD

Updated so that (i) works! Can you try again? Would be interested to get the file you're using too so I can replicate.

  • When I do (i), I am getting an error during the conversion—but I can successfully associate the two.

Just FYI I was able to use the Suite2P test pipeline and align to an arbitrary start time, which I could observe across stub and full conversions.

garrettmflynn avatar May 30 '24 16:05 garrettmflynn

FYI the issue I had with timestamps was a non-issue; the timestamps vector I was trying to set was regular, and NeuroConv magic automatically detected that and set to a regular rate. There's ongoing discussions over there about whether that should even happen at all though

CodyCBakerPhD avatar May 30 '24 19:05 CodyCBakerPhD

Also confirmed the issue with the recording interfaces in stub mode is on the NeuroConv side; will push a fix for that in the future so shouldn't hold up this PR

CodyCBakerPhD avatar May 30 '24 19:05 CodyCBakerPhD