magland / sortingview

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

Retrieving curation labels from figurl #217

Open khl02007 opened 1 year ago

khl02007 commented 1 year ago
url = '...'

# from chatGPT
import urllib.parse
import json

parsed_url = urllib.parse.urlparse(url)

query_dict = urllib.parse.parse_qs(parsed_url.query)
v = query_dict['v'][0]
d = query_dict['d'][0]
label = query_dict['label'][0]
zone = query_dict['zone'][0]

s_str = query_dict['s'][0]
s_dict = json.loads(s_str)

initial_sorting_curation = s_dict['initialSortingCuration']
sorting_curation = s_dict['sortingCuration']

# env var for the private gh repo containing curation.json
import os

os.environ['SORTING_CURATIONS_REPO'] = '...'

# replace the gh repo with local path
local_path = sorting_curation.replace('gh://...', os.environ['SORTING_CURATIONS_REPO'])

# open
import json

with open(local_path, 'r') as f:
    data = json.load(f)
magland commented 1 year ago

Great thank you!

-- Sent from my phone