From 588e120ad292a83acea6a5e4344a76d84b0346bb Mon Sep 17 00:00:00 2001 From: "alala@scexao" Date: Wed, 22 Mar 2023 19:36:48 -1000 Subject: [PATCH] reorganize viewer scripts into python module --- camstack/cams/dcamcam.py | 14 +++----- camstack/viewers/__init__.py | 0 camstack/viewers/viewers/__init__.py | 0 .../viewers/viewers}/anycam.py | 0 .../viewers/viewers}/apapane.py | 0 .../viewers/viewers}/firstcam.py | 34 ++++++++++++++----- .../viewers/viewers}/palila.py | 0 {viewers => camstack/viewers/viewers}/pueo.py | 0 .../viewers/viewers}/vpupcam.py | 0 setup.py | 12 +++---- 10 files changed, 37 insertions(+), 23 deletions(-) create mode 100644 camstack/viewers/__init__.py create mode 100644 camstack/viewers/viewers/__init__.py rename {viewers => camstack/viewers/viewers}/anycam.py (100%) rename {viewers => camstack/viewers/viewers}/apapane.py (100%) rename {viewers => camstack/viewers/viewers}/firstcam.py (56%) mode change 100755 => 100644 rename {viewers => camstack/viewers/viewers}/palila.py (100%) rename {viewers => camstack/viewers/viewers}/pueo.py (100%) rename {viewers => camstack/viewers/viewers}/vpupcam.py (100%) diff --git a/camstack/cams/dcamcam.py b/camstack/cams/dcamcam.py index fe5e435..6d876b5 100644 --- a/camstack/cams/dcamcam.py +++ b/camstack/cams/dcamcam.py @@ -207,19 +207,15 @@ class OrcaQuest(DCAMCamera): # yapf: disable MODES = { FIRST: CameraMode(x0=1028, x1=2991, y0=492, y1=727, tint=0.001), - FULL: CameraMode(x0=0, x1=4095, y0=0, y1=2303, tint=0.001), - 0: CameraMode(x0=0, x1=4095, y0=0, y1=2303, tint=0.001), # Also full - 1: CameraMode(x0=1196, x1=2127, y0=784, y1=1039, tint=0.001), # Kyohoon is Using for WFS mode + FULL: CameraMode(x0=0, x1=2303, y0=0, y1=4095, tint=0.01), + 1: CameraMode(x0=1636, x1=2735, y0=1104, y1=1279, tint=0.001), # Kyohoon is Using for WFS mode 11: CameraMode(x0=1536, x1=2335, y0=976, y1=1231, tint=0.1), # Same as 1 no tint. 2: CameraMode(x0=800, x1=3295, y0=876, y1=1531, tint=0.001), # Kyohoon is Using for WFS align - 3: CameraMode(x0=1148, x1=2947, y0=696, y1=1807, tint=0.001), - 4: CameraMode(x0=1700, x1=1963, y0=760, y1=1015, tint=0.001), # Jen is using for focal plane mode + 3: CameraMode(x0=2280, x1=3303, y0=1044, y1=2067, tint=0.01), + 4: CameraMode(x0=2072, x1=2327, y0=1024, y1=1279, tint=0.000001), # Jen is using for focal plane mode .000001 tint DICHROIC: CameraMode(x0=2336, x1=3135, y0=0, y1=2303, tint=0.01), # Dichroic stack mode } - # yapf: enable - - KEYWORDS = {} - KEYWORDS.update(DCAMCamera.KEYWORDS) + MODES[0] = MODES[FULL] def __init__(self, name: str, stream_name: str, mode_id: Union[CameraMode, Tuple[int, diff --git a/camstack/viewers/__init__.py b/camstack/viewers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/camstack/viewers/viewers/__init__.py b/camstack/viewers/viewers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/viewers/anycam.py b/camstack/viewers/viewers/anycam.py similarity index 100% rename from viewers/anycam.py rename to camstack/viewers/viewers/anycam.py diff --git a/viewers/apapane.py b/camstack/viewers/viewers/apapane.py similarity index 100% rename from viewers/apapane.py rename to camstack/viewers/viewers/apapane.py diff --git a/viewers/firstcam.py b/camstack/viewers/viewers/firstcam.py old mode 100755 new mode 100644 similarity index 56% rename from viewers/firstcam.py rename to camstack/viewers/viewers/firstcam.py index a88a0ac..48ee85b --- a/viewers/firstcam.py +++ b/camstack/viewers/viewers/firstcam.py @@ -1,3 +1,22 @@ +import docopt + +from camstack.viewers.generic_viewer_frontend import GenericViewerFrontend +from camstack.viewers.generic_viewer_backend import GenericViewerBackend + +class FirstViewerBackend(GenericViewerBackend): + pass + +class FirstViewerFrontend(GenericViewerFrontend): + WINDOW_NAME = 'FIRST camera' + CARTOON_FILE = 'io.png' + + def __init__(self, system_zoom, fps, display_base_size): + + # Hack the arguments BEFORE + GenericViewerFrontend.__init__(self, system_zoom, fps, + display_base_size) + + # Finalize some specifics AFTER #!/usr/bin/env python DEFAULT_SHM_NAME = "orcam" @@ -18,21 +37,20 @@ -b SHM binning factor [default: 1] ''' -import docopt - -from camstack.viewers.generic_viewer_frontend import FirstViewerFrontend -from camstack.viewers.generic_viewer_backend import FirstViewerBackend - -if __name__ == '__main__': - +def main(): + # parse arguments args = docopt.docopt(__doc__) zoom = int(args['-z']) shm_name = args[''] if shm_name is None: shm_name = DEFAULT_SHM_NAME + # setup viewer backend = FirstViewerBackend(shm_name) - frontend = FirstViewerFrontend(zoom, 20, backend.shm_shape) frontend.register_backend(backend) + # go frontend.run() + +if __name__ == '__main__': + main() diff --git a/viewers/palila.py b/camstack/viewers/viewers/palila.py similarity index 100% rename from viewers/palila.py rename to camstack/viewers/viewers/palila.py diff --git a/viewers/pueo.py b/camstack/viewers/viewers/pueo.py similarity index 100% rename from viewers/pueo.py rename to camstack/viewers/viewers/pueo.py diff --git a/viewers/vpupcam.py b/camstack/viewers/viewers/vpupcam.py similarity index 100% rename from viewers/vpupcam.py rename to camstack/viewers/viewers/vpupcam.py diff --git a/setup.py b/setup.py index fee285c..0ded013 100644 --- a/setup.py +++ b/setup.py @@ -29,12 +29,12 @@ def run(self): long_description = f.read() scripts = [ - './viewers/anycam.py', - './viewers/pueo.py', - './viewers/apapane.py', - './viewers/palila.py', - './viewers/firstcam.py', - './viewers/vpupcam.py', + './camstack/viewers/viewers/anycam.py', + './camstack/viewers/viewers/pueo.py', + './camstack/viewers/viewers/apapane.py', + './camstack/viewers/viewers/palila.py', + './camstack/viewers/viewers/firstcam.py', + './camstack/viewers/viewers/vpupcam.py', './scripts/cam-restartdeps', './scripts/cam-apapanestart', './scripts/cam-palilastart',