np-workflows 1.6.89__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- np_workflows/__init__.py +7 -0
- np_workflows/assets/images/logo_np_hab.png +0 -0
- np_workflows/assets/images/logo_np_vis.png +0 -0
- np_workflows/experiments/__init__.py +1 -0
- np_workflows/experiments/dynamic_routing/__init__.py +2 -0
- np_workflows/experiments/dynamic_routing/main.py +117 -0
- np_workflows/experiments/dynamic_routing/widgets.py +82 -0
- np_workflows/experiments/openscope_P3/P3_workflow_widget.py +83 -0
- np_workflows/experiments/openscope_P3/__init__.py +2 -0
- np_workflows/experiments/openscope_P3/main_P3_pilot.py +217 -0
- np_workflows/experiments/openscope_barcode/__init__.py +2 -0
- np_workflows/experiments/openscope_barcode/barcode_workflow_widget.py +83 -0
- np_workflows/experiments/openscope_barcode/camstim_scripts/barcode_mapping_script.py +138 -0
- np_workflows/experiments/openscope_barcode/camstim_scripts/barcode_opto_script.py +219 -0
- np_workflows/experiments/openscope_barcode/main_barcode_pilot.py +217 -0
- np_workflows/experiments/openscope_loop/__init__.py +2 -0
- np_workflows/experiments/openscope_loop/camstim_scripts/barcode_mapping_script.py +138 -0
- np_workflows/experiments/openscope_loop/camstim_scripts/barcode_opto_script.py +219 -0
- np_workflows/experiments/openscope_loop/loop_workflow_widget.py +83 -0
- np_workflows/experiments/openscope_loop/main_loop_pilot.py +217 -0
- np_workflows/experiments/openscope_psycode/__init__.py +2 -0
- np_workflows/experiments/openscope_psycode/main_psycode_pilot.py +217 -0
- np_workflows/experiments/openscope_psycode/psycode_workflow_widget.py +83 -0
- np_workflows/experiments/openscope_v2/__init__.py +2 -0
- np_workflows/experiments/openscope_v2/main_v2_pilot.py +217 -0
- np_workflows/experiments/openscope_v2/v2_workflow_widget.py +83 -0
- np_workflows/experiments/openscope_vippo/__init__.py +2 -0
- np_workflows/experiments/openscope_vippo/main_vippo_pilot.py +217 -0
- np_workflows/experiments/openscope_vippo/vippo_workflow_widget.py +83 -0
- np_workflows/experiments/task_trained_network/__init__.py +2 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/make_tt_stims.py +23 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/oct22_tt_stim_script.py +69 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_00.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_01.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_02.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_03.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_04.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_05.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_06.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_07.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_08.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_09.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_10.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_11.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_12.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_13.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_14.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_15.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_16.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_17.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/densely_annotated_18.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/flash_250ms.stim +20 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/gabor_20_deg_250ms.stim +30 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/old_stim.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/shuffle_reversed.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/shuffle_reversed_1st.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/stims/shuffle_reversed_2nd.stim +5 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/ttn_main_script.py +130 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/ttn_mapping_script.py +138 -0
- np_workflows/experiments/task_trained_network/camstim_scripts/ttn_opto_script.py +219 -0
- np_workflows/experiments/task_trained_network/main_ttn_pilot.py +263 -0
- np_workflows/experiments/task_trained_network/ttn_session_widget.py +83 -0
- np_workflows/experiments/task_trained_network/ttn_stim_config.py +213 -0
- np_workflows/experiments/templeton/__init__.py +2 -0
- np_workflows/experiments/templeton/main.py +105 -0
- np_workflows/experiments/templeton/widgets.py +82 -0
- np_workflows/shared/__init__.py +3 -0
- np_workflows/shared/base_experiments.py +826 -0
- np_workflows/shared/camstim_scripts/flash_250ms.stim +20 -0
- np_workflows/shared/camstim_scripts/gabor_20_deg_250ms.stim +30 -0
- np_workflows/shared/npxc.py +187 -0
- np_workflows/shared/widgets.py +705 -0
- np_workflows-1.6.89.dist-info/METADATA +85 -0
- np_workflows-1.6.89.dist-info/RECORD +76 -0
- np_workflows-1.6.89.dist-info/WHEEL +4 -0
- np_workflows-1.6.89.dist-info/entry_points.txt +4 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import configparser
|
|
2
|
+
import contextlib
|
|
3
|
+
import copy
|
|
4
|
+
import enum
|
|
5
|
+
import functools
|
|
6
|
+
from typing import ClassVar, Literal, NamedTuple, NoReturn, Optional, TypedDict
|
|
7
|
+
|
|
8
|
+
import IPython.display
|
|
9
|
+
import ipywidgets as ipw
|
|
10
|
+
import np_config
|
|
11
|
+
import np_logging
|
|
12
|
+
import np_session
|
|
13
|
+
import np_workflows
|
|
14
|
+
from pyparsing import Any
|
|
15
|
+
|
|
16
|
+
from np_workflows.experiments.templeton.main import Ephys, Hab
|
|
17
|
+
from np_workflows.shared.base_experiments import DynamicRoutingExperiment
|
|
18
|
+
|
|
19
|
+
# for widget, before creating a experiment --------------------------------------------- #
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class SelectedWorkflow:
|
|
23
|
+
def __init__(self, workflow: str | DynamicRoutingExperiment.Workflow, mouse: str | int | np_session.Mouse):
|
|
24
|
+
if isinstance(workflow, str):
|
|
25
|
+
workflow = DynamicRoutingExperiment.Workflow[workflow] # uses enum name (not value)
|
|
26
|
+
self.workflow = workflow
|
|
27
|
+
self.mouse = str(mouse)
|
|
28
|
+
|
|
29
|
+
def __repr__(self) -> str:
|
|
30
|
+
return f"{self.__class__.__name__}({self.workflow}, {self.mouse})"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def workflow_select_widget(
|
|
34
|
+
mouse: str | int | np_session.Mouse,
|
|
35
|
+
) -> SelectedWorkflow:
|
|
36
|
+
"""Select a session type to run (hab, pretest, ephys).
|
|
37
|
+
|
|
38
|
+
An object with mutable attributes is returned, so the selected session can be
|
|
39
|
+
updated along with the GUI selection. (Preference would be to return an enum
|
|
40
|
+
directly, and change it's value, but that doesn't seem possible.)
|
|
41
|
+
|
|
42
|
+
"""
|
|
43
|
+
# set default
|
|
44
|
+
selection = SelectedWorkflow(DynamicRoutingExperiment.Workflow.PRETEST, mouse)
|
|
45
|
+
|
|
46
|
+
workflow_dropdown = ipw.Select(
|
|
47
|
+
options=tuple(_.name for _ in DynamicRoutingExperiment.Workflow),
|
|
48
|
+
description="Workflow",
|
|
49
|
+
)
|
|
50
|
+
workflow_descriptions = ipw.Select(
|
|
51
|
+
options=tuple(_.value for _ in DynamicRoutingExperiment.Workflow),
|
|
52
|
+
disabled=True,
|
|
53
|
+
value=None
|
|
54
|
+
)
|
|
55
|
+
console = ipw.Output()
|
|
56
|
+
with console:
|
|
57
|
+
if last_workflow := np_session.Mouse(selection.mouse).state.get('last_workflow'):
|
|
58
|
+
print(f"{mouse} last workflow: {last_workflow}")
|
|
59
|
+
print(f"Selected: {selection.workflow.name}")
|
|
60
|
+
|
|
61
|
+
def update(change):
|
|
62
|
+
if change["name"] != "value":
|
|
63
|
+
return
|
|
64
|
+
if (options := getattr(change["owner"], "options", None)) and change[
|
|
65
|
+
"new"
|
|
66
|
+
] not in options:
|
|
67
|
+
return
|
|
68
|
+
if change["new"] == change["old"]:
|
|
69
|
+
return
|
|
70
|
+
selection.__init__(str(workflow_dropdown.value), mouse.id if isinstance(mouse, np_session.Mouse) else str(mouse))
|
|
71
|
+
with console:
|
|
72
|
+
print(f"Selected: {selection.workflow}")
|
|
73
|
+
workflow_dropdown.observe(update, names='value')
|
|
74
|
+
|
|
75
|
+
IPython.display.display(ipw.VBox([ipw.HBox([workflow_dropdown, workflow_descriptions]), console]))
|
|
76
|
+
|
|
77
|
+
return selection
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def photodoc_widget(session: np_session.Session, reminder: str) -> None:
|
|
82
|
+
print(f'Take an image in Vimba Viewer and save as:\n{session.npexp_path.name}_{reminder}.png')
|