Beispiel #1
0
    def __init__(self, index, silent=False):

        super().__init__(
            index=index,
            descr="Perform target acquisition and data taking"
            " for LATISS instrument.",
        )

        self.atcs = ATCS(self.domain, log=self.log)
        self.latiss = LATISS(
            self.domain,
            log=self.log,
            tcs_ready_to_take_data=self.atcs.ready_to_take_data,
        )
        # instantiate the quick measurement class
        try:
            qm_config = QuickFrameMeasurementTask.ConfigClass()
            self.qm = QuickFrameMeasurementTask(config=qm_config)
        except NameError:
            self.log.warning(
                "Library unavailable certain tests will be skipped")
        # Set timeout
        self.cmd_timeout = 30  # [s]

        # Suppress verbosity
        self.silent = silent
Beispiel #2
0
    def __init__(self, index, silent=False):

        super().__init__(
            index=index,
            descr="Test QuickFrameMeasurementTask.",
        )

        # instantiate the quick measurement class
        qm_config = QuickFrameMeasurementTask.ConfigClass()
        self.qm = QuickFrameMeasurementTask(config=qm_config)
    def __init__(self, index=1, remotes=True):

        super().__init__(
            index=index,
            descr="Perform optical alignment procedure of the Rubin Auxiliary "
            "Telescope with LATISS using Curvature-Wavefront Sensing "
            "Techniques.",
        )

        self.atcs = None
        self.latiss = None
        if remotes:
            self.atcs = ATCS(self.domain, log=self.log)
            self.latiss = LATISS(
                self.domain,
                log=self.log,
                tcs_ready_to_take_data=self.atcs.ready_to_take_data,
            )

        # instantiate the quick measurement class
        try:
            qm_config = QuickFrameMeasurementTask.ConfigClass()
            self.qm = QuickFrameMeasurementTask(config=qm_config)
        except NameError:
            self.log.warning(
                "Library unavailable certain tests will be skipped")

        # Timeouts used for telescope commands
        self.short_timeout = 5.0  # used with hexapod offset command
        self.long_timeout = 30.0  # used to wait for in-position event from hexapod
        # Have discovered that the occasional image will take 12+ seconds
        # to ingest
        self.timeout_get_image = 20.0

        # Sensitivity matrix: mm of hexapod motion for nm of wfs. To figure out
        # the hexapod correction multiply the calculcated zernikes by this.
        # Note that the zernikes must be derotated to
        #         self.sensitivity_matrix = [
        #         [1.0 / 161.0, 0.0, 0.0],
        #         [0.0, -1.0 / 161.0, (107.0/161.0)/4200],
        #         [0.0, 0.0, -1.0 / 4200.0]
        #         ]
        self.sensitivity_matrix = [
            [1.0 / 206.0, 0.0, 0.0],
            [0.0, -1.0 / 206.0, -(109.0 / 206.0) / 4200],
            [0.0, 0.0, 1.0 / 4200.0],
        ]

        # Rotation matrix to take into account angle between camera and
        # boresight
        self.rotation_matrix = lambda angle: np.array([
            [np.cos(np.radians(angle)), -np.sin(np.radians(angle)), 0.0],
            [np.sin(np.radians(angle)),
             np.cos(np.radians(angle)), 0.0],
            [0.0, 0.0, 1.0],
        ])

        # Matrix to map hexapod offset to alt/az offset in the focal plane
        # units are arcsec/mm. X-axis is Elevation
        # Measured with data from AT run SUMMIT-5027, still unverified.
        # x-offset measured with images 2021060800432 - 2021060800452
        # y-offset measured with images 2021060800452 - 2021060800472
        self.hexapod_offset_scale = [
            [52.459, 0.0, 0.0],
            [0.0, 50.468, 0.0],
            [0.0, 0.0, 0.0],
        ]

        # Angle between camera and boresight
        # Assume perfect mechanical mounting
        self.camera_rotation_angle = 0.0

        # The following attributes are set via the configuration:
        self.filter = None
        self.grating = None
        # exposure time for the intra/extra images (in seconds)
        self.exposure_time = None

        # Assume the time-on-target is 10 minutes (600 seconds)
        # for rotator positioning
        self.time_on_target = 600

        # offset for the intra/extra images
        self._dz = None
        # butler data path.
        self.datapath = None
        # end of configurable attributes

        # Set (oversized) stamp size for centroid estimation
        self.pre_side = 300
        # Set stamp size for WFE estimation
        # 192 pix is size for dz=1.5, but gets automatically
        # scaled based on dz later, so can multiply by an
        # arbitrary factor here to make it larger
        self._side = 192 * 1.1  # normally 1.1
        # self.selected_source_centroid = None

        # angle between elevation axis and nasmyth2 rotator
        self.angle = None

        self.intra_visit_id = None
        self.extra_visit_id = None

        self.intra_exposure = None
        self.extra_exposure = None
        self.extra_focal_position_out_of_range = None
        self.detection_exp = None

        self.I1 = []
        self.I2 = []
        self.fieldXY = [0.0, 0.0]

        self.inst = None
        # set binning of images to increase processing speed
        # at the expense of resolution
        self._binning = 1
        self.algo = None

        self.zern = None
        self.hexapod_corr = None

        # make global to expose for unit tests
        self.total_focus_offset = 0.0
        self.total_coma_x_offset = 0.0
        self.total_coma_y_offset = 0.0

        self.data_pool_sleep = 5.0

        self.log.info("latiss_cwfs_align initialized!")