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

Extend trial-aligned view to TimeSeries #190

Open
weiglszonja opened this issue Jul 15, 2024 · 3 comments
Open

Extend trial-aligned view to TimeSeries #190

weiglszonja opened this issue Jul 15, 2024 · 3 comments

Comments

@weiglszonja
Copy link

Can you extend the TimeAlignedSeries view mentioned here to work on this dataset?

We would like to see trial-aligned view for fiber photometry data (added as FiberPhotometryResponseSeries from ndx-fiber-photometry which extends TimeSeries), light and tone stimulus times stored in TimeIntervals.

trial-aligned DF/F in figure B:

https://www.sciencedirect.com/science/article/pii/S0896627323009704#fig4
Screenshot 2024-07-15 at 15 35 27 (2)

@magland
Copy link
Collaborator

magland commented Jul 15, 2024

I have now enabled this for FiberPhotometryResponseSeries

https://neurosift.app/?p=/nwb&url=https://api.dandiarchive.org/api/assets/deb6b7b3-47cb-421e-a600-72a73ae4bad3/download/&dandisetId=001084&dandisetVersion=draft&tab=view:TrialAlignedSeries|/processing/behavior/TimeIntervals^/processing/ophys/DfOverFFiberPhotometryResponseSeriesGreen

You need to click checkboxes to select /processing/behavior/TimeIntervals and /processing/ophys/DfOverFFiberPhotometryResponseSeriesGreen and then the button/link will appear at the bottom of the left panel.

Will need to think about how to make this view more discoverable, because a user will not know to do this.

As a side note, there was an error when I tried to do this with /processing/ophys/BaselineFiberPhotometryResponseSeriesGreen

After doing some investigation, I'm pretty sure that the content of the .nwb file is corrupted for this dataset. It's a large file so I didn't download locally, but for reference the following produces an error.

import remfile
import h5py

url = 'https://api.dandiarchive.org/api/assets/deb6b7b3-47cb-421e-a600-72a73ae4bad3/download/'

rf = remfile.File(url)
f = h5py.File(rf, 'r')

X = f['/processing/ophys/BaselineFiberPhotometryResponseSeriesGreen']
timestamps = X['timestamps']
data = X['data']

print(f'timestamps shape: {timestamps.shape}')
print(f'data shape: {data.shape}')

print(data[30, 30])
print(data[30000, 30])
print(data[30000, 100])

# this is the one that produces the error.
# it seems the chunk is not valid gzip data
print(data[30, 100])

@weiglszonja
Copy link
Author

weiglszonja commented Jul 16, 2024

Thank you @magland!

It would be also useful if the TimeAlignedSeries could group by "event_type" or other columns in the table and then align to "start_time" or "stop_time". Do you think this filtering option could be added to this view?

Will need to think about how to make this view more discoverable, because a user will not know to do this.

How about having a third box showing up here:
Screenshot 2024-07-16 at 11 55 23 (2)
And then the TimeSeries can be selected for which the TimeAlignedSeries view will be triggered?

After doing some investigation, I'm pretty sure that the content of the .nwb file is corrupted for this dataset. It's a large file so I didn't download locally, but for reference the following produces an error.

Thank you for letting me know, I'm looking into it now. Not sure how this dataset became corrupted in the first place, as the other two fiber photometry series data looks fine. But I managed to replicate this error with NWBHDF5IO as well, I'll try to figure out and fix it.

@magland
Copy link
Collaborator

magland commented Sep 6, 2024

@weiglszonja I have updated the above link that I had shared.

To trigger this view, you can go to the TimeIntervals object and click on TrialAlignedSeries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants