magland / sortingview

Web app for viewing results of ephys spike sorting
Apache License 2.0
25 stars 8 forks source link

high efficiency recording extractor #98

Closed lfrank closed 2 years ago

lfrank commented 3 years ago

Currently sortingview doesn't include the labbox-ephys high efficiency recording extractor. It would be helpful if this was added so we can try to speed up the process of writing the recording extractor to a file.

lfrank commented 3 years ago

I found the extractor, but it's not included in the extractor init.py, so I can't import it. Could you fix that?

magland commented 3 years ago

@lfrank This is now fixed in version 0.2.38 (on pypi)

So you can do:

import sortingview as sv
import kachery_client as kc

recording = ...

X = sv.H5RecordingExtractorV1.write_recording(recording=recording, h5_path='/some/path.h5')

# Load it at a later time
Y = sv.H5RecordingExtractorV1(h5_path='/some/path.h5')

# The recommended/preferred method is to use LabboxEphysRecordingExtractor
recording_uri = kc.link_file('/some/path.h5')
Z = sv.LabboxEphysRecordingExtractor({
    'recording_format': 'h5_v1',
    'data': {'h5_uri': recording_uri}
}

You can examine the source code here: https://github.com/magland/sortingview/blob/09124de0a99a44fad0ff8580cdc0dde379a8be56/src/python/sortingview/extractors/labboxephysrecordingextractor.py#L212-L387

and here: https://github.com/magland/sortingview/blob/09124de0a99a44fad0ff8580cdc0dde379a8be56/src/python/sortingview/extractors/h5extractors/h5recordingextractorv1.py#L12-L48

lfrank commented 3 years ago

@magland: I’ve tried 0.2.38 and 0.3.0 and neither seems to have sv. H5RecordingExtractorV1. Can you check this on your end?

On Aug 9, 2021, at 7:14 AM, Jeremy Magland @.***> wrote:

@lfrank https://github.com/lfrank This is now fixed in version 0.2.38 (on pypi)

So you can do:

import sortingview as sv import kachery_client as kc

recording = ...

X = sv.H5RecordingExtractorV1.write_recording(recording=recording, h5_path='/some/path.h5')

Load it at a later time

Y = sv.H5RecordingExtractorV1(h5_path='/some/path.h5')

The recommended/preferred method is to use LabboxEphysRecordingExtractor

recording_uri = kc.link_file('/some/path.h5') Z = sv.LabboxEphysRecordingExtractor({ 'recording_format': 'h5_v1', 'data': {'h5_uri': recording_uri} } You can examine the source code here: https://github.com/magland/sortingview/blob/09124de0a99a44fad0ff8580cdc0dde379a8be56/src/python/sortingview/extractors/labboxephysrecordingextractor.py#L212-L387 https://github.com/magland/sortingview/blob/09124de0a99a44fad0ff8580cdc0dde379a8be56/src/python/sortingview/extractors/labboxephysrecordingextractor.py#L212-L387 and here: https://github.com/magland/sortingview/blob/09124de0a99a44fad0ff8580cdc0dde379a8be56/src/python/sortingview/extractors/h5extractors/h5recordingextractorv1.py#L12-L48 https://github.com/magland/sortingview/blob/09124de0a99a44fad0ff8580cdc0dde379a8be56/src/python/sortingview/extractors/h5extractors/h5recordingextractorv1.py#L12-L48 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/magland/sortingview/issues/98#issuecomment-895260336, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABV4PSMDGVRXMHTU4BJSLCDT37PFFANCNFSM5BYCXU6A. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.

magland commented 3 years ago

oops, i exported the H5SortingExtractorV1, but not H5RecordingExtractorV1... this will be fixed on the next release.

magland commented 3 years ago

@lfrank This should be fixed in 0.3.1 on pypi. Once you confirm you can close this issue.

lfrank commented 3 years ago

@magland Thanks; I can now see the function.

One question for testing:

the old version for the sorting and recording was as follows:

   le_sorting = sortingview.LabboxEphysSortingExtractor.store_sorting(sorting)
    labbox_sorting = sortingview.LabboxEphysSortingExtractor(le_sorting)
    labbox_recording = sortingview.LabboxEphysRecordingExtractor(recording_uri, download=True)

    R_id = workspace.add_recording(recording=labbox_recording, label=recording_label)
    S_id = workspace.add_sorting(sorting=labbox_sorting, recording_id=R_id, label=sorting_label)     

Would I ideally be using the H5SortingExtractorv1 here as well?

On Aug 11, 2021, at 5:47 AM, Jeremy Magland @.***> wrote:

@lfrank https://github.com/lfrank This should be fixed in 0.3.1 on pypi. Once you confirm you can close this issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/magland/sortingview/issues/98#issuecomment-896679067, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABV4PSPGNOY363E3RLHACJ3T4JBLXANCNFSM5BYCXU6A. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.