diff --git a/notebooks/10_Spike_SortingV0.ipynb b/notebooks/10_Spike_SortingV0.ipynb index 5174c136b..4c9e50ff6 100644 --- a/notebooks/10_Spike_SortingV0.ipynb +++ b/notebooks/10_Spike_SortingV0.ipynb @@ -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", + " \n", + " \n", + " Information about lab member in the context of Frank lab network\n", + "
\n", + " \n", + " \n", + " \n", + "\n", + "\n", + "\n", + "
\n", + "

lab_member_name

\n", + " \n", + "
\n", + "

google_user_name

\n", + " For permission to curate\n", + "
\n", + "

datajoint_user_name

\n", + " For permission to delete\n", + "
\n", + "

admin

\n", + " Ignore permission checks\n", + "
Firstname Lastnameexample@gmail.comuser0
\n", + " \n", + "

Total: 1

\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\", \"example@gmail.com\", \"user\"\n", + "# Full name, Google email address, DataJoint username, admin\n", + "name, email, dj_user, admin = (\n", + " \"Firstname Lastname\",\n", + " \"example@gmail.com\",\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" ] }, { diff --git a/notebooks/10_Spike_SortingV1.ipynb b/notebooks/10_Spike_SortingV1.ipynb index 451f0cd06..0c00fc498 100644 --- a/notebooks/10_Spike_SortingV1.ipynb +++ b/notebooks/10_Spike_SortingV1.ipynb @@ -47,7 +47,7 @@ "outputs": [], "source": [ "import spyglass.common as sgc\n", - "import spyglass.spikesorting as sgs\n", + "import spyglass.spikesorting.v1 as sgs\n", "import spyglass.data_import as sgi" ] }, @@ -115,7 +115,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.SortGroup.set_group_by_shank(nwb_file_name=nwb_file_name2)" + "sgs.SortGroup.set_group_by_shank(nwb_file_name=nwb_file_name2)" ] }, { @@ -149,7 +149,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.SpikeSortingRecordingSelection.insert_selection(key)" + "sgs.SpikeSortingRecordingSelection.insert_selection(key)" ] }, { @@ -159,7 +159,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.SpikeSortingRecordingSelection()" + "sgs.SpikeSortingRecordingSelection()" ] }, { @@ -177,7 +177,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.SpikeSortingRecording.populate()" + "sgs.SpikeSortingRecording.populate()" ] }, { @@ -187,7 +187,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.SpikeSortingRecording()" + "sgs.SpikeSortingRecording()" ] }, { @@ -198,7 +198,7 @@ "outputs": [], "source": [ "key = (\n", - " sgs.v1.SpikeSortingRecordingSelection & {\"nwb_file_name\": nwb_file_name2}\n", + " sgs.SpikeSortingRecordingSelection & {\"nwb_file_name\": nwb_file_name2}\n", ").fetch1()" ] }, @@ -217,7 +217,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.ArtifactDetectionSelection.insert_selection(\n", + "sgs.ArtifactDetectionSelection.insert_selection(\n", " {\"recording_id\": key[\"recording_id\"], \"artifact_param_name\": \"default\"}\n", ")" ] @@ -237,7 +237,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.ArtifactDetection.populate()" + "sgs.ArtifactDetection.populate()" ] }, { @@ -247,7 +247,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.ArtifactDetection()" + "sgs.ArtifactDetection()" ] }, { @@ -286,7 +286,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.SpikeSortingSelection()" + "sgs.SpikeSortingSelection()" ] }, { @@ -296,7 +296,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.SpikeSortingSelection.insert_selection(key)" + "sgs.SpikeSortingSelection.insert_selection(key)" ] }, { @@ -306,7 +306,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.SpikeSortingSelection()" + "sgs.SpikeSortingSelection()" ] }, { @@ -324,7 +324,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.SpikeSorting.populate()" + "sgs.SpikeSorting.populate()" ] }, { @@ -334,7 +334,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.SpikeSorting()" + "sgs.SpikeSorting()" ] }, { @@ -352,7 +352,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.CurationV1.insert_curation(\n", + "sgs.CurationV1.insert_curation(\n", " sorting_id=(\n", " sgs.SpikeSortingSelection & {\"recording_id\": key[\"recording_id\"]}\n", " ).fetch1(\"sorting_id\"),\n", @@ -367,7 +367,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.CurationV1()" + "sgs.CurationV1()" ] }, { @@ -387,7 +387,7 @@ "source": [ "key = {\n", " \"sorting_id\": (\n", - " sgs.v1.SpikeSortingSelection & {\"recording_id\": key[\"recording_id\"]}\n", + " sgs.SpikeSortingSelection & {\"recording_id\": key[\"recording_id\"]}\n", " ).fetch1(\"sorting_id\"),\n", " \"curation_id\": 0,\n", " \"waveform_param_name\": \"default_not_whitened\",\n", @@ -403,7 +403,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.MetricCurationSelection.insert_selection(key)" + "sgs.MetricCurationSelection.insert_selection(key)" ] }, { @@ -413,7 +413,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.MetricCurationSelection()" + "sgs.MetricCurationSelection()" ] }, { @@ -423,7 +423,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.MetricCuration.populate()" + "sgs.MetricCuration.populate()" ] }, { @@ -433,7 +433,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.MetricCuration()" + "sgs.MetricCuration()" ] }, { @@ -453,7 +453,7 @@ "source": [ "key = {\n", " \"metric_curation_id\": (\n", - " sgs.v1.MetricCurationSelection & {\"sorting_id\": key[\"sorting_id\"]}\n", + " sgs.MetricCurationSelection & {\"sorting_id\": key[\"sorting_id\"]}\n", " ).fetch1(\"metric_curation_id\")\n", "}" ] @@ -465,7 +465,7 @@ "metadata": {}, "outputs": [], "source": [ - "labels = sgs.v1.MetricCuration.get_labels(key)" + "labels = sgs.MetricCuration.get_labels(key)" ] }, { @@ -475,7 +475,7 @@ "metadata": {}, "outputs": [], "source": [ - "merge_groups = sgs.v1.MetricCuration.get_merge_groups(key)" + "merge_groups = sgs.MetricCuration.get_merge_groups(key)" ] }, { @@ -485,7 +485,7 @@ "metadata": {}, "outputs": [], "source": [ - "metrics = sgs.v1.MetricCuration.get_metrics(key)" + "metrics = sgs.MetricCuration.get_metrics(key)" ] }, { @@ -495,9 +495,9 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.CurationV1.insert_curation(\n", + "sgs.CurationV1.insert_curation(\n", " sorting_id=(\n", - " sgs.v1.MetricCurationSelection\n", + " sgs.MetricCurationSelection\n", " & {\"metric_curation_id\": key[\"metric_curation_id\"]}\n", " ).fetch1(\"sorting_id\"),\n", " parent_curation_id=0,\n", @@ -515,7 +515,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.CurationV1()" + "sgs.CurationV1()" ] }, { @@ -533,7 +533,7 @@ "metadata": {}, "outputs": [], "source": [ - "curation_uri = sgs.v1.FigURLCurationSelection.generate_curation_uri(\n", + "curation_uri = sgs.FigURLCurationSelection.generate_curation_uri(\n", " {\n", " \"sorting_id\": (\n", " sgs.MetricCurationSelection\n", @@ -553,7 +553,7 @@ "source": [ "key = {\n", " \"sorting_id\": (\n", - " sgs.v1.MetricCurationSelection\n", + " sgs.MetricCurationSelection\n", " & {\"metric_curation_id\": key[\"metric_curation_id\"]}\n", " ).fetch1(\"sorting_id\"),\n", " \"curation_id\": 1,\n", @@ -569,7 +569,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.FigURLCurationSelection()" + "sgs.FigURLCurationSelection()" ] }, { @@ -579,7 +579,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.FigURLCurationSelection.insert_selection(key)" + "sgs.FigURLCurationSelection.insert_selection(key)" ] }, { @@ -589,7 +589,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.FigURLCurationSelection()" + "sgs.FigURLCurationSelection()" ] }, { @@ -599,7 +599,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.FigURLCuration.populate()" + "sgs.FigURLCuration.populate()" ] }, { @@ -609,7 +609,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.FigURLCuration()" + "sgs.FigURLCuration()" ] }, { @@ -646,7 +646,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.FigURLCurationSelection.insert_selection(key)" + "sgs.FigURLCurationSelection.insert_selection(key)" ] }, { @@ -656,7 +656,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.FigURLCuration.populate()" + "sgs.FigURLCuration.populate()" ] }, { @@ -666,7 +666,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.FigURLCuration()" + "sgs.FigURLCuration()" ] }, { @@ -684,7 +684,7 @@ "metadata": {}, "outputs": [], "source": [ - "labels = sgs.v1.FigURLCuration.get_labels(gh_curation_uri)" + "labels = sgs.FigURLCuration.get_labels(gh_curation_uri)" ] }, { @@ -694,7 +694,7 @@ "metadata": {}, "outputs": [], "source": [ - "merge_groups = sgs.v1.FigURLCuration.get_merge_groups(gh_curation_uri)" + "merge_groups = sgs.FigURLCuration.get_merge_groups(gh_curation_uri)" ] }, { @@ -704,7 +704,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.CurationV1.insert_curation(\n", + "sgs.CurationV1.insert_curation(\n", " sorting_id=key[\"sorting_id\"],\n", " parent_curation_id=1,\n", " labels=labels,\n", @@ -721,7 +721,7 @@ "metadata": {}, "outputs": [], "source": [ - "sgs.v1.CurationV1()" + "sgs.CurationV1()" ] }, {