np-services 0.1.49__tar.gz → 0.1.51__tar.gz

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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: np-services
3
- Version: 0.1.49
3
+ Version: 0.1.51
4
4
  Summary: Tools for interfacing with devices and services used in Mindscope Neuropixels experiments at the Allen Institute.
5
5
  Author: bjhardcastle
6
6
  Author-email: ben.hardcastle@alleninstitute.org
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "np-services"
3
- version = "0.1.49"
3
+ version = "0.1.51"
4
4
  description = "Tools for interfacing with devices and services used in Mindscope Neuropixels experiments at the Allen Institute."
5
5
  authors = ["bjhardcastle <ben.hardcastle@alleninstitute.org>"]
6
6
  readme = "README.md"
@@ -5,7 +5,7 @@ package_dir = \
5
5
  {'': 'src'}
6
6
 
7
7
  packages = \
8
- ['np_services']
8
+ ['np_services', 'np_services.resources']
9
9
 
10
10
  package_data = \
11
11
  {'': ['*']}
@@ -24,7 +24,7 @@ install_requires = \
24
24
 
25
25
  setup_kwargs = {
26
26
  'name': 'np-services',
27
- 'version': '0.1.49',
27
+ 'version': '0.1.51',
28
28
  'description': 'Tools for interfacing with devices and services used in Mindscope Neuropixels experiments at the Allen Institute.',
29
29
  'long_description': '# service usage\n![Services](./services.drawio.svg)',
30
30
  'author': 'bjhardcastle',
@@ -1,4 +1,5 @@
1
1
  import np_services.open_ephys as OpenEphys
2
+ from np_services.stim_computer_theme_changer import *
2
3
  from np_services.protocols import *
3
4
  try:
4
5
  from np_services.proxies import *
@@ -25,9 +25,9 @@ import pydantic
25
25
  import yaml
26
26
  import pandas as pd
27
27
 
28
- import np_services.mvr as mvr
28
+ import np_services.resources.mvr_connector as mvr_connector
29
29
  import np_services.utils as utils
30
- import np_services.zro as zro
30
+ import np_services.resources.zro as zro
31
31
  from np_services.protocols import *
32
32
 
33
33
  logger = np_logging.getLogger(__name__)
@@ -907,12 +907,12 @@ class MVR(CamstimSyncShared):
907
907
  del cls.proxy
908
908
 
909
909
  @classmethod
910
- def get_proxy(cls) -> mvr.MVRConnector:
910
+ def get_proxy(cls) -> mvr_connector.MVRConnector:
911
911
  with contextlib.suppress(AttributeError):
912
912
  return cls.proxy
913
913
  cls.ensure_config()
914
914
  logger.debug("Creating %s proxy to %s:%s", cls.__name__, cls.host, cls.port)
915
- cls.proxy = mvr.MVRConnector({"host": cls.host, "port": cls.port})
915
+ cls.proxy = mvr_connector.MVRConnector({"host": cls.host, "port": cls.port})
916
916
  cls.proxy._mvr_sock.settimeout(cls.timeout)
917
917
  return cls.get_proxy()
918
918
 
@@ -0,0 +1,29 @@
1
+
2
+ #Modify Path to the picture accordingly to reflect your infrastructure
3
+ $imgPath="\\allen\programs\mindscope\workgroups\dynamicrouting\ben\black_wallpaper.bmp"
4
+ $code = @'
5
+ using System.Runtime.InteropServices;
6
+ namespace Win32{
7
+
8
+ public class Wallpaper{
9
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
10
+ static extern int SystemParametersInfo (int uAction , int uParam , string lpvParam , int fuWinIni) ;
11
+
12
+ public static void SetWallpaper(string thePath){
13
+ SystemParametersInfo(20,0,thePath,3);
14
+ }
15
+ }
16
+ }
17
+ '@
18
+
19
+ add-type $code
20
+
21
+ #Apply the Change on the system
22
+ [Win32.Wallpaper]::SetWallpaper($imgPath)
23
+
24
+ (New-Object -ComObject shell.application).toggleDesktop()
25
+
26
+ #Hide icons on the Desktop
27
+ $Path="HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
28
+ Set-ItemProperty -Path $Path -Name "HideIcons" -Value 1
29
+ Get-Process "explorer"| Stop-Process
@@ -0,0 +1,29 @@
1
+
2
+ #Modify Path to the picture accordingly to reflect your infrastructure
3
+ $imgPath="\\allen\programs\mindscope\workgroups\dynamicrouting\ben\grey_wallpaper.bmp"
4
+ $code = @'
5
+ using System.Runtime.InteropServices;
6
+ namespace Win32{
7
+
8
+ public class Wallpaper{
9
+ [DllImport("user32.dll", CharSet=CharSet.Auto)]
10
+ static extern int SystemParametersInfo (int uAction , int uParam , string lpvParam , int fuWinIni) ;
11
+
12
+ public static void SetWallpaper(string thePath){
13
+ SystemParametersInfo(20,0,thePath,3);
14
+ }
15
+ }
16
+ }
17
+ '@
18
+
19
+ add-type $code
20
+
21
+ #Apply the Change on the system
22
+ [Win32.Wallpaper]::SetWallpaper($imgPath)
23
+
24
+ (New-Object -ComObject shell.application).toggleDesktop()
25
+
26
+ #Hide icons on the Desktop
27
+ $Path="HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
28
+ Set-ItemProperty -Path $Path -Name "HideIcons" -Value 1
29
+ Get-Process "explorer"| Stop-Process
@@ -0,0 +1,32 @@
1
+ import pathlib
2
+ from typing import ClassVar
3
+
4
+ import fabric
5
+ import np_config
6
+
7
+ from np_services.proxies import NoCamstim
8
+
9
+ class ThemeSetter(NoCamstim):
10
+ """Base class for setting the background wallpaper on a remote machine,
11
+ then hiding all desktop icons, hiding the taskbar, minimizing all windows"""
12
+ local_file: ClassVar[str | pathlib.Path]
13
+ remote_file: ClassVar[str | pathlib.Path]
14
+
15
+ extra_args: ClassVar[list[str]] = []
16
+ ssh: ClassVar[fabric.Connection]
17
+ user: ClassVar[str] = 'svc_neuropix'
18
+ password: ClassVar[str] = np_config.fetch('logins')['svc_neuropix']['password']
19
+
20
+ @classmethod
21
+ def initialize(cls):
22
+ with cls.get_ssh() as ssh:
23
+ ssh.put(cls.local_file, cls.remote_file)
24
+ super().initialize()
25
+
26
+ class BlackThemeSetter(ThemeSetter):
27
+ local_file = pathlib.Path(__file__).parent / 'resources' / 'black_wallpaper.ps1'
28
+ remote_file: ClassVar[str | pathlib.Path] = 'c:/users/svc_neuropix/desktop/black_wallpaper.ps1'
29
+
30
+ class GreyThemeSetter(ThemeSetter):
31
+ local_file = pathlib.Path(__file__).parent / 'resources' / 'grey_wallpaper.ps1'
32
+ remote_file: ClassVar[str | pathlib.Path] = 'c:/users/svc_neuropix/desktop/grey_wallpaper.ps1'
@@ -15,7 +15,7 @@ import np_config
15
15
  import np_logging
16
16
 
17
17
  import np_services.protocols as protocols
18
- import np_services.zro as zro
18
+ import np_services.resources.zro as zro
19
19
 
20
20
  logger = np_logging.getLogger(__name__)
21
21
 
File without changes