-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
185 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,7 +84,7 @@ | |
"dj.config.load(\"dj_local_conf.json\") # load config for database connection info\n", | ||
"\n", | ||
"import spyglass.common as sgc\n", | ||
"import spyglass.spikesorting as sgs\n", | ||
"import spyglass.spikesorting.v0 as sgs\n", | ||
"\n", | ||
"# ignore datajoint+jupyter async warnings\n", | ||
"import warnings\n", | ||
|
@@ -109,19 +109,120 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 14, | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"\n", | ||
" \n", | ||
" <style type=\"text/css\">\n", | ||
" .Table{\n", | ||
" border-collapse:collapse;\n", | ||
" }\n", | ||
" .Table th{\n", | ||
" background: #A0A0A0; color: #ffffff; padding:4px; border:#f0e0e0 1px solid;\n", | ||
" font-weight: normal; font-family: monospace; font-size: 100%;\n", | ||
" }\n", | ||
" .Table td{\n", | ||
" padding:4px; border:#f0e0e0 1px solid; font-size:100%;\n", | ||
" }\n", | ||
" .Table tr:nth-child(odd){\n", | ||
" background: #ffffff;\n", | ||
" color: #000000;\n", | ||
" }\n", | ||
" .Table tr:nth-child(even){\n", | ||
" background: #f3f1ff;\n", | ||
" color: #000000;\n", | ||
" }\n", | ||
" /* Tooltip container */\n", | ||
" .djtooltip {\n", | ||
" }\n", | ||
" /* Tooltip text */\n", | ||
" .djtooltip .djtooltiptext {\n", | ||
" visibility: hidden;\n", | ||
" width: 120px;\n", | ||
" background-color: black;\n", | ||
" color: #fff;\n", | ||
" text-align: center;\n", | ||
" padding: 5px 0;\n", | ||
" border-radius: 6px;\n", | ||
" /* Position the tooltip text - see examples below! */\n", | ||
" position: absolute;\n", | ||
" z-index: 1;\n", | ||
" }\n", | ||
" #primary {\n", | ||
" font-weight: bold;\n", | ||
" color: black;\n", | ||
" }\n", | ||
" #nonprimary {\n", | ||
" font-weight: normal;\n", | ||
" color: white;\n", | ||
" }\n", | ||
"\n", | ||
" /* Show the tooltip text when you mouse over the tooltip container */\n", | ||
" .djtooltip:hover .djtooltiptext {\n", | ||
" visibility: visible;\n", | ||
" }\n", | ||
" </style>\n", | ||
" \n", | ||
" <b>Information about lab member in the context of Frank lab network</b>\n", | ||
" <div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n", | ||
" <table border=\"1\" class=\"Table\">\n", | ||
" <thead> <tr style=\"text-align: right;\"> <th> <div class=\"djtooltip\">\n", | ||
" <p id=\"primary\">lab_member_name</p>\n", | ||
" <span class=\"djtooltiptext\"></span>\n", | ||
" </div></th><th><div class=\"djtooltip\">\n", | ||
" <p id=\"nonprimary\">google_user_name</p>\n", | ||
" <span class=\"djtooltiptext\">For permission to curate</span>\n", | ||
" </div></th><th><div class=\"djtooltip\">\n", | ||
" <p id=\"nonprimary\">datajoint_user_name</p>\n", | ||
" <span class=\"djtooltiptext\">For permission to delete</span>\n", | ||
" </div></th><th><div class=\"djtooltip\">\n", | ||
" <p id=\"nonprimary\">admin</p>\n", | ||
" <span class=\"djtooltiptext\">Ignore permission checks</span>\n", | ||
" </div> </th> </tr> </thead>\n", | ||
" <tbody> <tr> <td>Firstname Lastname</td>\n", | ||
"<td>[email protected]</td>\n", | ||
"<td>user</td>\n", | ||
"<td>0</td> </tr> </tbody>\n", | ||
" </table>\n", | ||
" \n", | ||
" <p>Total: 1</p></div>\n", | ||
" " | ||
], | ||
"text/plain": [ | ||
"*lab_member_na google_user_na datajoint_user admin \n", | ||
"+------------+ +------------+ +------------+ +-------+\n", | ||
"Firstname Last example@gmail. user 0 \n", | ||
" (Total: 1)" | ||
] | ||
}, | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"name, email, dj_user = \"Firstname Lastname\", \"[email protected]\", \"user\"\n", | ||
"# Full name, Google email address, DataJoint username, admin\n", | ||
"name, email, dj_user, admin = (\n", | ||
" \"Firstname Lastname\",\n", | ||
" \"[email protected]\",\n", | ||
" \"user\",\n", | ||
" 0,\n", | ||
")\n", | ||
"sgc.LabMember.insert_from_name(name)\n", | ||
"sgc.LabMember.LabMemberInfo.insert1(\n", | ||
" [name, email, dj_user], skip_duplicates=True\n", | ||
")\n", | ||
"sgc.LabTeam.LabTeamMember.insert1(\n", | ||
" {\"team_name\": \"My Team\", \"lab_member_name\": name},\n", | ||
" [\n", | ||
" name,\n", | ||
" email,\n", | ||
" dj_user,\n", | ||
" admin,\n", | ||
" ],\n", | ||
" skip_duplicates=True,\n", | ||
")" | ||
")\n", | ||
"sgc.LabMember.LabMemberInfo()" | ||
] | ||
}, | ||
{ | ||
|
@@ -137,17 +238,9 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 15, | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"You made it in!\n" | ||
] | ||
} | ||
], | ||
"outputs": [], | ||
"source": [ | ||
"my_team_members = (\n", | ||
" (sgc.LabTeam.LabTeamMember & {\"team_name\": \"My Team\"})\n", | ||
|
@@ -206,8 +299,6 @@ | |
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"/home/cb/wrk/spyglass/src/spyglass/data_import/insert_sessions.py:41: UserWarning: Cannot insert data from minirec20230622.nwb: minirec20230622_.nwbis already in Nwbfile table.\n", | ||
" warnings.warn(\n" | ||
] | ||
} | ||
], | ||
|
@@ -265,7 +356,7 @@ | |
} | ||
], | ||
"source": [ | ||
"sgs.v0.SortGroup().set_group_by_shank(nwb_file_name)" | ||
"sgs.SortGroup().set_group_by_shank(nwb_file_name)" | ||
] | ||
}, | ||
{ | ||
|
@@ -423,7 +514,7 @@ | |
} | ||
], | ||
"source": [ | ||
"sgs.v0.SortGroup.SortGroupElectrode & {\"nwb_file_name\": nwb_file_name}" | ||
"sgs.SortGroup.SortGroupElectrode & {\"nwb_file_name\": nwb_file_name}" | ||
] | ||
}, | ||
{ | ||
|
@@ -625,7 +716,7 @@ | |
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"sgs.v0.SortInterval.insert1(\n", | ||
"sgs.SortInterval.insert1(\n", | ||
" {\n", | ||
" \"nwb_file_name\": nwb_file_name,\n", | ||
" \"sort_interval_name\": sort_interval_name,\n", | ||
|
@@ -658,7 +749,7 @@ | |
"source": [ | ||
"print_interval_duration(\n", | ||
" (\n", | ||
" sgs.v0.SortInterval\n", | ||
" sgs.SortInterval\n", | ||
" & {\n", | ||
" \"nwb_file_name\": nwb_file_name,\n", | ||
" \"sort_interval_name\": sort_interval_name,\n", | ||
|
@@ -772,7 +863,7 @@ | |
} | ||
], | ||
"source": [ | ||
"sgs.v0.SpikeSortingPreprocessingParameters()" | ||
"sgs.SpikeSortingPreprocessingParameters()" | ||
] | ||
}, | ||
{ | ||
|
@@ -796,9 +887,9 @@ | |
} | ||
], | ||
"source": [ | ||
"sgs.v0.SpikeSortingPreprocessingParameters().insert_default()\n", | ||
"sgs.SpikeSortingPreprocessingParameters().insert_default()\n", | ||
"preproc_params = (\n", | ||
" sgs.v0.SpikeSortingPreprocessingParameters()\n", | ||
" sgs.SpikeSortingPreprocessingParameters()\n", | ||
" & {\"preproc_params_name\": \"default\"}\n", | ||
").fetch1(\"preproc_params\")\n", | ||
"print(preproc_params)" | ||
|
@@ -819,7 +910,7 @@ | |
"outputs": [], | ||
"source": [ | ||
"preproc_params[\"frequency_min\"] = 600\n", | ||
"sgs.v0.SpikeSortingPreprocessingParameters().insert1(\n", | ||
"sgs.SpikeSortingPreprocessingParameters().insert1(\n", | ||
" {\n", | ||
" \"preproc_params_name\": \"default_hippocampus\",\n", | ||
" \"preproc_params\": preproc_params,\n", | ||
|
@@ -991,8 +1082,8 @@ | |
} | ||
], | ||
"source": [ | ||
"sgs.v0.SpikeSortingRecordingSelection.insert1(ssr_key, skip_duplicates=True)\n", | ||
"sgs.v0.SpikeSortingRecordingSelection() & ssr_key" | ||
"sgs.SpikeSortingRecordingSelection.insert1(ssr_key, skip_duplicates=True)\n", | ||
"sgs.SpikeSortingRecordingSelection() & ssr_key" | ||
] | ||
}, | ||
{ | ||
|
@@ -1013,7 +1104,7 @@ | |
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 38, | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
|
@@ -1039,8 +1130,8 @@ | |
} | ||
], | ||
"source": [ | ||
"ssr_pk = (sgs.v0.SpikeSortingRecordingSelection & ssr_key).proj()\n", | ||
"sgs.v0.SpikeSortingRecording.populate([ssr_pk])" | ||
"ssr_pk = (sgs.SpikeSortingRecordingSelection & ssr_key).proj()\n", | ||
"sgs.SpikeSortingRecording.populate([ssr_pk])" | ||
] | ||
}, | ||
{ | ||
|
@@ -1160,7 +1251,7 @@ | |
} | ||
], | ||
"source": [ | ||
"sgs.v0.SpikeSortingRecording() & ssr_key" | ||
"sgs.SpikeSortingRecording() & ssr_key" | ||
] | ||
}, | ||
{ | ||
|
@@ -1183,8 +1274,8 @@ | |
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"sgs.v0.ArtifactDetectionParameters().insert_default()\n", | ||
"artifact_key = (sgs.v0.SpikeSortingRecording() & ssr_key).fetch1(\"KEY\")\n", | ||
"sgs.ArtifactDetectionParameters().insert_default()\n", | ||
"artifact_key = (sgs.SpikeSortingRecording() & ssr_key).fetch1(\"KEY\")\n", | ||
"artifact_key[\"artifact_params_name\"] = \"none\"" | ||
] | ||
}, | ||
|
@@ -1307,8 +1398,8 @@ | |
} | ||
], | ||
"source": [ | ||
"sgs.v0.ArtifactDetectionSelection().insert1(artifact_key)\n", | ||
"sgs.v0.ArtifactDetectionSelection() & artifact_key" | ||
"sgs.ArtifactDetectionSelection().insert1(artifact_key)\n", | ||
"sgs.ArtifactDetectionSelection() & artifact_key" | ||
] | ||
}, | ||
{ | ||
|
@@ -1333,7 +1424,7 @@ | |
} | ||
], | ||
"source": [ | ||
"sgs.v0.ArtifactDetection.populate(artifact_key)" | ||
"sgs.ArtifactDetection.populate(artifact_key)" | ||
] | ||
}, | ||
{ | ||
|
@@ -1461,7 +1552,7 @@ | |
} | ||
], | ||
"source": [ | ||
"sgs.v0.ArtifactRemovedIntervalList() & artifact_key" | ||
"sgs.ArtifactRemovedIntervalList() & artifact_key" | ||
] | ||
}, | ||
{ | ||
|
@@ -1494,12 +1585,12 @@ | |
} | ||
], | ||
"source": [ | ||
"sgs.v0.SpikeSorterParameters().insert_default()\n", | ||
"sgs.SpikeSorterParameters().insert_default()\n", | ||
"\n", | ||
"# Let's look at the default params\n", | ||
"sorter_name = \"mountainsort4\"\n", | ||
"ms4_default_params = (\n", | ||
" sgs.v0.SpikeSorterParameters\n", | ||
" sgs.SpikeSorterParameters\n", | ||
" & {\"sorter\": sorter_name, \"sorter_params_name\": \"default\"}\n", | ||
").fetch1()\n", | ||
"print(ms4_default_params)" | ||
|
@@ -1599,7 +1690,7 @@ | |
], | ||
"source": [ | ||
"sorter_params_name = \"hippocampus_tutorial\"\n", | ||
"sgs.v0.SpikeSorterParameters.insert1(\n", | ||
"sgs.SpikeSorterParameters.insert1(\n", | ||
" {\n", | ||
" \"sorter\": sorter_name,\n", | ||
" \"sorter_params_name\": sorter_params_name,\n", | ||
|
@@ -1608,7 +1699,7 @@ | |
" skip_duplicates=True,\n", | ||
")\n", | ||
"(\n", | ||
" sgs.v0.SpikeSorterParameters\n", | ||
" sgs.SpikeSorterParameters\n", | ||
" & {\"sorter\": sorter_name, \"sorter_params_name\": sorter_params_name}\n", | ||
").fetch1()" | ||
] | ||
|
@@ -1652,8 +1743,8 @@ | |
], | ||
"source": [ | ||
"ss_key = dict(\n", | ||
" **(sgs.v0.ArtifactDetection & ssr_key).fetch1(\"KEY\"),\n", | ||
" **(sgs.v0.ArtifactRemovedIntervalList() & ssr_key).fetch1(\"KEY\"),\n", | ||
" **(sgs.ArtifactDetection & ssr_key).fetch1(\"KEY\"),\n", | ||
" **(sgs.ArtifactRemovedIntervalList() & ssr_key).fetch1(\"KEY\"),\n", | ||
" sorter=sorter_name,\n", | ||
" sorter_params_name=sorter_params_name,\n", | ||
")\n", | ||
|
@@ -1779,8 +1870,8 @@ | |
} | ||
], | ||
"source": [ | ||
"sgs.v0.SpikeSortingSelection.insert1(ss_key, skip_duplicates=True)\n", | ||
"(sgs.v0.SpikeSortingSelection & ss_key)" | ||
"sgs.SpikeSortingSelection.insert1(ss_key, skip_duplicates=True)\n", | ||
"(sgs.SpikeSortingSelection & ss_key)" | ||
] | ||
}, | ||
{ | ||
|
@@ -2267,7 +2358,7 @@ | |
], | ||
"source": [ | ||
"# [(sgs.SpikeSortingSelection & ss_key).proj()]\n", | ||
"sgs.v0.SpikeSorting.populate()" | ||
"sgs.SpikeSorting.populate()" | ||
] | ||
}, | ||
{ | ||
|
@@ -2399,7 +2490,7 @@ | |
} | ||
], | ||
"source": [ | ||
"sgs.v0.SpikeSorting() & ss_key" | ||
"sgs.SpikeSorting() & ss_key" | ||
] | ||
}, | ||
{ | ||
|
Oops, something went wrong.