diff --git a/doc/versionHistory.rst b/doc/versionHistory.rst index 79a3711..b6c671a 100644 --- a/doc/versionHistory.rst +++ b/doc/versionHistory.rst @@ -6,6 +6,13 @@ Version History ################## +------------- +0.9.0 +------------- + +* Remove ZCS coordinate system and transition to CCS. +* Update bending modes to latest versions in batoid_rubin. + ------------- 0.8.4 ------------- diff --git a/python/lsst/ts/imsim/closed_loop_task.py b/python/lsst/ts/imsim/closed_loop_task.py index 9e7aec7..9016e2f 100644 --- a/python/lsst/ts/imsim/closed_loop_task.py +++ b/python/lsst/ts/imsim/closed_loop_task.py @@ -900,52 +900,15 @@ def run_wep( ) sensor_wavefront_data = SensorWavefrontError() - # Rotate from CCS to ZCS/PCS (Phosim Coordinate System) - rotated_name = self.rotate_det_name_ccs_to_zcs( - det_id_map[dataset.dataId["detector"]].getName() - ) - sensor_wavefront_data.sensor_name = rotated_name - sensor_wavefront_data.sensor_id = det_name_map[rotated_name].getId() + sensor_name = det_id_map[dataset.dataId["detector"]].getName() + sensor_wavefront_data.sensor_name = sensor_name + sensor_wavefront_data.sensor_id = det_name_map[sensor_name].getId() sensor_wavefront_data.annular_zernike_poly = zer_coeff list_of_wf_err.append(sensor_wavefront_data) return list_of_wf_err - def rotate_det_name_ccs_to_zcs(self, det_name: str) -> str: - """Rotate the sensor name from CCS (Camera Coordinate System) - to the ZCS (Zemax Coordinate System) that OFC expects. - - Parameters - ---------- - det_name : str - Detector name in CCS. - - Returns - ------- - str - Detector expected at that location in ZCS. - """ - raft, sensor = det_name.split("_") - cam_rx = int(raft[1]) - 2 - cam_ry = int(raft[2]) - 2 - - zcs_rx = -cam_rx - zcs_ry = cam_ry - - zcs_raft = f"R{zcs_rx + 2}{zcs_ry + 2}" - - if sensor.startswith("SW"): - zcs_sensor = sensor - else: - cam_sx = int(sensor[1]) - 1 - cam_sy = int(sensor[2]) - 1 - zcs_sx = -cam_sx - zcs_sy = cam_sy - zcs_sensor = f"S{zcs_sx + 1}{zcs_sy + 1}" - - return f"{zcs_raft}_{zcs_sensor}" - def write_wep_configuration( self, inst_name: str, pipeline_yaml_path: str, filter_type_name: str ) -> None: diff --git a/python/lsst/ts/imsim/opd_metrology.py b/python/lsst/ts/imsim/opd_metrology.py index bd90dd9..db74820 100644 --- a/python/lsst/ts/imsim/opd_metrology.py +++ b/python/lsst/ts/imsim/opd_metrology.py @@ -77,10 +77,6 @@ def set_default_lsst_wfs_gq(self) -> None: self.wt = np.array([1.0, 1.0, 1.0, 1.0]) wfs_field_x, wfs_field_y, sensor_ids = self.get_default_lsst_wfs_gq() self.field_x, self.field_y = (wfs_field_x, wfs_field_y) - # Convert from CCS to ZCS for current OFC - # TODO: Remove this conversion when ts_ofc - # sensitivity matrix is updated. - self.field_x = -1.0 * np.array(self.field_x) self.sensor_ids = sensor_ids def get_default_lsst_wfs_gq(self) -> tuple[list[float], list[float], list[int]]: @@ -170,10 +166,6 @@ def set_wgt_and_field_xy_of_gq(self, inst_name: str) -> None: field_x.append(np.degrees(det_center[1])) self.field_x = np.array(field_x) self.field_y = np.array(field_y) - # Convert from CCS to ZCS for current OFC - # TODO: Remove this conversion when ts_ofc - # sensitivity matrix is updated. - self.field_x = -1.0 * self.field_x def get_zk_from_opd( self, @@ -181,7 +173,6 @@ def get_zk_from_opd( opd_map: np.ndarray | None = None, zk_terms: int = 22, obscuration: float = 0.61, - flip_lr: bool = True, ) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: """Get the wavefront error of OPD in the basis of annular Zernike polynomials. @@ -199,12 +190,6 @@ def get_zk_from_opd( is 22.) obscuration : float, optional Obscuration of annular Zernike polynomial. (the default is 0.61.) - flip_lr : bool, optional - Flip the opd image in the left-right direction. Currently - this flip is needed in the closed loop because ts_ofc - has a sensitivity matrix in the Zemax Coordinate System - instead of the Camera Coordinate System. This will be removed - when ts_ofc changes to use the CCS. (the default is True.) Returns ------- @@ -228,9 +213,6 @@ def get_zk_from_opd( opd = fits.getdata(opd_fits_file) elif opd_map is not None: opd = opd_map.copy() - # TODO: Remove when OFC moves to CCS instead of ZCS - if flip_lr is True: - opd = np.fliplr(opd) # Check the x, y dimensions of OPD are the same if np.unique(opd.shape).size != 1: diff --git a/tests/testData/imsimConfig/imsimConfigLsstCam.yaml b/tests/testData/imsimConfig/imsimConfigLsstCam.yaml index fbe01f3..087a892 100644 --- a/tests/testData/imsimConfig/imsimConfigLsstCam.yaml +++ b/tests/testData/imsimConfig/imsimConfigLsstCam.yaml @@ -71,8 +71,6 @@ input: # There's a whole suite of FEA perturbations available (same as ts_phosim) # Details in the telescope_loader.py file linked above. fea: - bend_dir: bend_legacy - fea_dir: fea_legacy m1m3_gravity: # gravitational flexure of M1M3 zenith: *zenith m1m3_temperature: @@ -369,11 +367,11 @@ output: # Coordinates are parallel to the OCS (https://sitcomtn-003.lsst.io/#the-optical-coordinate-system) # when rotTelPos just above is set to zero, or parallel to the CCS when rotTelPos is set # to the camera rotator angle. - - thx: 1.1902777777777778 deg - thy: -1.1902777777777778 deg - - thx: 1.1902777777777778 deg - thy: 1.1902777777777778 deg - thx: -1.1902777777777778 deg thy: -1.1902777777777778 deg - thx: -1.1902777777777778 deg thy: 1.1902777777777778 deg + - thx: 1.1902777777777778 deg + thy: -1.1902777777777778 deg + - thx: 1.1902777777777778 deg + thy: 1.1902777777777778 deg diff --git a/tests/testData/opd/opd.zer b/tests/testData/opd/opd.zer index 121593d..f9be892 100644 --- a/tests/testData/opd/opd.zer +++ b/tests/testData/opd/opd.zer @@ -1,19 +1,19 @@ # The followings are OPD in rotation angle of -0.00 degree in nm from z4 to z22: -191: [-4.15577837e+02 -4.03053050e+02 6.19438978e+02 -4.44665578e+00 - -1.00741331e+01 3.55263409e+01 9.61023230e+00 1.44900235e-01 - -1.02512184e+00 3.99302251e+01 9.81672032e+00 -1.09511113e+02 - 1.01009395e+00 -1.03280016e+00 -2.30629852e+00 2.55961095e+01 - 1.29456402e+00 3.40161544e+01 -1.13822260e+01] -195: [-407.96514385 69.61576656 631.04232073 50.49126701 -7.97330041 - 252.35981927 -30.87974042 -3.93741576 17.25916179 -25.49876989 - 19.17288935 -113.36121766 -2.97981464 -6.73377281 -6.2956465 - -31.79557922 14.85384164 29.62548445 -10.81317459] -199: [-406.87545247 43.41883523 678.05355873 3.63692016 43.14243043 - 22.29089894 -180.82275562 -5.65229654 -21.64993839 -22.26986463 - 3.69490561 -103.41585077 -7.4490198 3.37207099 42.23624375 - 17.04691 4.30762799 23.83670381 -10.49902789] -203: [-3.89941394e+02 -2.85791837e+02 6.41296675e+02 3.26727427e+01 - 3.35857590e+01 1.90287712e+02 -1.75210163e+02 -1.06136662e+01 - -1.22732198e+01 2.09839551e+01 4.17355247e-01 -1.08153979e+02 - -5.16252005e+00 -1.42877583e+00 3.38332003e+01 -2.19601267e+01 - 5.94293965e+00 3.59018468e+01 -8.63500688e+00] +191: [-4.15577837e+02 4.03053050e+02 6.19438978e+02 -4.44665578e+00 + 1.00741331e+01 3.55263409e+01 -9.61023230e+00 1.44900235e-01 + -1.02512184e+00 -3.99302251e+01 9.81672032e+00 1.09511113e+02 + -1.01009395e+00 -1.03280016e+00 2.30629852e+00 2.55961095e+01 + -1.29456402e+00 3.40161544e+01 -1.13822260e+01] +195: [-407.96514385 -69.61576656 631.04232073 50.49126701 7.97330041 + 252.35981927 30.87974042 -3.93741576 17.25916179 25.49876989 + 19.17288935 113.36121766 2.97981464 -6.73377281 6.2956465 + -31.79557922 -14.85384164 29.62548445 -10.81317459] +199: [-406.87545247 -43.41883523 678.05355873 3.63692016 -43.14243043 + 22.29089894 180.82275562 -5.65229654 -21.64993839 22.26986463 + 3.69490561 103.41585077 7.4490198 3.37207099 -42.23624375 + 17.04691 -4.30762799 23.83670381 -10.49902789] +203: [-3.89941394e+02 2.85791837e+02 6.41296675e+02 3.26727427e+01 + -3.35857590e+01 1.90287712e+02 1.75210163e+02 -1.06136662e+01 + -1.22732198e+01 -2.09839551e+01 4.17355247e-01 1.08153979e+02 + 5.16252005e+00 -1.42877583e+00 -3.38332003e+01 -2.19601267e+01 + -5.94293965e+00 3.59018468e+01 -8.63500688e+00] diff --git a/tests/test_imsim_cmpt.py b/tests/test_imsim_cmpt.py index dfbea0d..eaa8fca 100644 --- a/tests/test_imsim_cmpt.py +++ b/tests/test_imsim_cmpt.py @@ -128,7 +128,7 @@ def test_format_opd_text_lsst_cam(self): self.assertTrue(opd_text.startswith(" opd:")) self.assertTrue( opd_text.endswith( - "- {thx: -1.1902777777777778 deg, thy: 1.1902777777777778 deg}\n" + "- {thx: 1.1902777777777778 deg, thy: 1.1902777777777778 deg}\n" ) ) @@ -242,7 +242,7 @@ def test_rotate_opd_data(self): ) np.testing.assert_almost_equal( - galsim_zernikes.rotate(np.deg2rad(-rotation_angle)).coef[4:], + galsim_zernikes.rotate(np.deg2rad(rotation_angle)).coef[4:], zerinkes_rotation_0[idx, :], decimal=1, )