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

Sortingview couldn't find functions for loading curated results #1215

Open
xlsun79 opened this issue Jan 29, 2025 · 3 comments
Open

Sortingview couldn't find functions for loading curated results #1215

xlsun79 opened this issue Jan 29, 2025 · 3 comments

Comments

@xlsun79
Copy link
Contributor

xlsun79 commented Jan 29, 2025

Describe the bug
This problem started happening after I pulled a recent version of spyglass (in December). After manual curation, when inserting curated results into the tables, it needs to load labels from sort-curations, but spyglass reported "module 'sortingview' has no attribute 'trythis_load_sorting_curation'"

To Reproduce
Steps to reproduce the behavior:

max_id = 2
nwb_file_name = 'senor20201116'
sort_interval_name = 'sleeps_runs_noPrePostTrialTimes raw data valid times'
preproc_param_name = 'default'
sorter_param_name = 'franklab_probe_ctx_30KHz_115rad_new_mountainsort2'
team_name = 'ac_em_xs'
sort_group_ids = [24]
for sort_group_id in sort_group_ids:
    file_key = {'nwb_file_name' : nwb_file_name,
               'sort_group_id': sort_group_id,
               'sort_interval_name': sort_interval_name,
               'preproc_params_name': preproc_param_name,
               'sorter_params_name':sorter_param_name,
               'team_name': team_name}

    jot_file_name = (CurationFigurl & file_key).fetch('new_curation_uri')[0]
    print(jot_file_name)
    manual_curation_key = (SpikeSorting & file_key).fetch1('KEY')
    manual_curation_key['curation_id'] = max_id-1
    SortingviewWorkspace().insert_manual_curation(manual_curation_key, jot_file_name) 
Error Stack
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In [19], line 1
----> 1 SortingviewWorkspace().insert_manual_curation(manual_curation_key, jot_file_name) 

File ~/code/spyglass/src/spyglass/spikesorting/v0/sortingview.py:193, in SortingviewWorkspace.insert_manual_curation(self, key, url, description)
    176 """Based on information in key for an SortingviewWorkspace, loads the
    177 curated sorting from sortingview, saves it (with labels and the
    178 optional description) and inserts it to CuratedSorting
   (...)
    187     description of curated sorting
    188 """
    190 # get the labels and remove the non-primary merged units
    191 # labels = workspace.get_sorting_curation(sorting_id=sortingview_sorting_id)
    192 # labels = sv.trythis_load_sorting_curation('jot://xTzzyDieQPkW')
--> 193 labels = sv.trythis_load_sorting_curation(url)
    195 # turn labels to list of str, only including accepted units.
    196 # if bool(labels["mergeGroups"]):
    197 if bool(labels.get("mergeGroups", [])):
    198     # clusters were merged, so we empty out metrics

AttributeError: module 'sortingview' has no attribute 'trythis_load_sorting_curation'
@edeno
Copy link
Collaborator

edeno commented Jan 29, 2025

Did you change your environment as well? This seems like a sortingview version problem.

@xlsun79
Copy link
Contributor Author

xlsun79 commented Jan 29, 2025

Don't think I've changed my environment lately/after pulling new spyglass. I checked and it's 0.13.3, and the latest sorting view 0.13.5 was released last July (before I git pull spyglass) hmmmm

@xlsun79
Copy link
Contributor Author

xlsun79 commented Jan 30, 2025

@samuelbray32 @edeno @CBroz1 I figured that I don't necessarily need to insert curation to the sortingview workspace, but just need to be able to load the url to get merge groups & unit labels from the manual curation which should be inserted into the Curation table before I can populate the CuratedSpikesorting table. Do you happen to know if we have any function to load the url and get a dictionary of the manual curation related metrics? Thanks!

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