API
 
Loading...
Searching...
No Matches
efcControl.py
Go to the documentation of this file.
1import sys
2import logging
3from enum import Enum
4import time
5import numpy as np
6
7import xconf
8
9from magaox.indi.device import XDevice, BaseConfig
10from magaox.camera import XCam
11from magaox.deformable_mirror import XDeformableMirror, XFourierMirror, XPokeMirror
12from magaox.constants import StateCodes
13
14from purepyindi2 import device, properties, constants
15from purepyindi2.messages import DefNumber, DefSwitch, DefLight, DefText
16
17from utils import *
18
19@xconf.config
21 """
22 """
23 shmim : str = xconf.field(help="Name of the camera device (specifically, the associated shmim, if different)")
24 dark_shmim : str = xconf.field(help="Name of the dark frame shmim associated with this camera device")
25
26@xconf.config
27class efcControlConfig(BaseConfig):
28 """Automatic coronagraph alignment assistant
29 """
30 camera : CameraConfig = xconf.field(help="Camera to use")
31 sleep_interval_sec : float = xconf.field(default=0.25, help="Sleep interval between loop() calls")
32
33class States(Enum):
34 IDLE = 0
35
36class efcControl(XDevice):
37 config : efcControlConfig
38
39 def setup(self):
40 self.log.debug(f"I was configured! See? {self.config=}")
41 fsm = properties.TextVector(name='fsm')
42 fsm.add_element(DefText(name='state', _value=StateCodes.INITIALIZED.name))
43 self.add_property(fsm)
44
45 self.log.info("Found camera: {:s}".format(self.config.camera.shmim))
46 self.camera = XCam(self.config.camera.shmim, use_hcipy=True)
47 self._state = States.IDLE
48
49 self.properties['fsm']['state'] = StateCodes.READY.name
50 self.update_property(self.properties['fsm'])
51
52 def loop(self):
53 pass
54 # Basic EFC loop
55 # Acquire sequence of images
56 # Need to trigger based on start of exposure?
57 # Send DM command
58 # Get
efcControlConfig config
Definition efcControl.py:37