np-workflows 1.6.91__py3-none-any.whl → 1.6.93__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.
@@ -1,7 +1,13 @@
1
+ import shutil
2
+ import time
3
+
1
4
  import IPython.display
2
5
  import ipywidgets as ipw
6
+ import np_config
7
+ import np_services
3
8
  import np_session
4
9
 
10
+ import np_workflows.shared.npxc as npxc
5
11
  from np_workflows.shared.base_experiments import DynamicRoutingExperiment
6
12
 
7
13
  # for widget, before creating a experiment --------------------------------------------- #
@@ -82,6 +88,27 @@ def workflow_select_widget(
82
88
 
83
89
 
84
90
  def photodoc_widget(session: np_session.Session, reminder: str) -> None:
91
+ vimba_dir = np_config.local_to_unc(
92
+ session.rig.mon, np_services.config_from_zk()["ImageVimba"]["data"]
93
+ )
94
+ n_files = len(tuple(vimba_dir.iterdir()))
95
+ t0 = time.time()
85
96
  print(
86
- f"Take an image in Vimba Viewer and save as:\n{session.npexp_path.name}_{reminder}.png"
97
+ f"Take an image in Vimba Viewer and save it with the default name (eg should be unique)."
98
+ f"\n\n*This cell will wait for a new file to be created in {vimba_dir}, then copy it to the session folder with suffix {reminder!r}*"
99
+ )
100
+ timeout_s = 120
101
+ while len(files := tuple(vimba_dir.iterdir())) == n_files:
102
+ time.sleep(1)
103
+ if time.time() - t0 > timeout_s:
104
+ raise TimeoutError(
105
+ f"No new image file detected in Vimba folder after {timeout_s} seconds - aborting"
106
+ )
107
+ latest_image = max(
108
+ (p for p in files if p.is_file()), key=lambda f: f.stat().st_ctime
87
109
  )
110
+ print(f"New file detected:\n\t{latest_image.name}\nCopying to session folder")
111
+ new_name = f"{session.npexp_path.name}_{reminder}.png"
112
+ shutil.copy2(latest_image, session.npexp_path / new_name)
113
+ npxc.validate_or_overwrite(session.npexp_path / new_name, latest_image)
114
+ print("Done!")
@@ -13,7 +13,6 @@ from typing import Any, ClassVar, Literal, Optional, Protocol, Type
13
13
 
14
14
  import fabric
15
15
  import invoke
16
- import ipylab
17
16
  import np_config
18
17
  import np_logging
19
18
  import np_services
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: np-workflows
3
- Version: 1.6.91
3
+ Version: 1.6.93
4
4
  Summary: Ecephys and behavior workflows for the Mindscope Neuropixels team.
5
5
  Author-email: Ben Hardcastle <ben.hardcastle@alleninstitute.org>
6
6
  License: MIT
@@ -2,7 +2,7 @@ np_workflows/__init__.py,sha256=5ZC3gO-VV7PfP13WenHePtvU2wlP68ar6j47pJVvUCM,231
2
2
  np_workflows/experiments/__init__.py,sha256=voWNXF2Kl3mmB4PwqnZ4DcD5zhvBq1j2xLUHnLe6So8,39
3
3
  np_workflows/experiments/dynamic_routing/__init__.py,sha256=M2oiBrVpy_Wrt7oC8J1wzHvKTYdA2K1UIb0-_7S6SuQ,123
4
4
  np_workflows/experiments/dynamic_routing/main.py,sha256=BHleH7NmomD_tMhVPVIpbebetABooOoVClFkggLQS10,2617
5
- np_workflows/experiments/dynamic_routing/widgets.py,sha256=kRtpnyKYyKcjM_4oNM2YeCLDNaxEwOUopyDcdK0gNj0,2815
5
+ np_workflows/experiments/dynamic_routing/widgets.py,sha256=WMoewsS-VEgJZcR8bkhiAumQEgnIcAwFKk_9qYP1jXY,3946
6
6
  np_workflows/experiments/openscope_P3/P3_workflow_widget.py,sha256=MmGgo-ir4Xy-PDjY3YRhxy5lATAeQ3F9bsuGtF6Bu5I,2361
7
7
  np_workflows/experiments/openscope_P3/__init__.py,sha256=g1SzGmPdWB4MPzx7Zaye4YQU89BDocywCfcAs2ITC5A,133
8
8
  np_workflows/experiments/openscope_P3/main_P3_pilot.py,sha256=39vcLIEVPoB85TdPQ-QlF0sT7Ej9R7oIQHpGJ-dt1Q0,7007
@@ -38,11 +38,11 @@ np_workflows/experiments/templeton/__init__.py,sha256=LrTnP6DnkTSB-sdadvSOJvLZMZ
38
38
  np_workflows/experiments/templeton/main.py,sha256=En08DQeOilFA1gLyombfahmEJm7gN4raOXlwhSTv6bM,2389
39
39
  np_workflows/experiments/templeton/widgets.py,sha256=5p-IgVqoL4qzjRl5xh4JjwS3o7uTyYjpyWhliVddZRY,2720
40
40
  np_workflows/shared/__init__.py,sha256=YErshr5fY7jU8TJgWqEHz07tUHnEJEZ_mY31DIpQ5H0,132
41
- np_workflows/shared/base_experiments.py,sha256=KyPBkrNhiVcS6xwYF_iDql4MQ3xY5x76jCo_IfauZKQ,35409
41
+ np_workflows/shared/base_experiments.py,sha256=KTxsltWtvNlHmlHJkIbMj7qon-RULAlb_Q224c2dtI0,35395
42
42
  np_workflows/shared/npxc.py,sha256=R6n6xrLGr31epoDX_99D_Wy7BYgmjjiZ6efl3UOoK3Y,6642
43
43
  np_workflows/shared/widgets.py,sha256=xF4PKZugYfyHtCPyYxwYgeH5jpB8vyoGDgenEodTTzo,27799
44
- np_workflows-1.6.91.dist-info/METADATA,sha256=rZ9SQo9a6SA4qwjDObBPlU7JcgoXox9qukZ8t8Ca5BY,3399
45
- np_workflows-1.6.91.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
46
- np_workflows-1.6.91.dist-info/entry_points.txt,sha256=XBvlXc6-LK4_pCjspQZF_yBbopODJIquhZ8J4LhxlaI,41
47
- np_workflows-1.6.91.dist-info/top_level.txt,sha256=lndEdwvoxg_3fCYd2tyIUfcdvCFegVm3lWUdEf85u8M,13
48
- np_workflows-1.6.91.dist-info/RECORD,,
44
+ np_workflows-1.6.93.dist-info/METADATA,sha256=kUh_0cAZ-B49iNlBgKZBQsUxpWCmgPr6MI33GbxadTg,3399
45
+ np_workflows-1.6.93.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
46
+ np_workflows-1.6.93.dist-info/entry_points.txt,sha256=XBvlXc6-LK4_pCjspQZF_yBbopODJIquhZ8J4LhxlaI,41
47
+ np_workflows-1.6.93.dist-info/top_level.txt,sha256=lndEdwvoxg_3fCYd2tyIUfcdvCFegVm3lWUdEf85u8M,13
48
+ np_workflows-1.6.93.dist-info/RECORD,,