|
27 | 27 |
|
28 | 28 | __author__ = 'Mihai Cara' |
29 | 29 |
|
30 | | -__all__ = ['WCSCorrector', 'JWSTWCSCorrector', 'FITSWCSCorrector'] |
| 30 | +__all__ = [ |
| 31 | + 'FITSWCSCorrector', |
| 32 | + 'JWSTWCSCorrector', |
| 33 | + 'RomanWCSCorrector', |
| 34 | + 'WCSCorrector', |
| 35 | +] |
31 | 36 |
|
32 | 37 | log = logging.getLogger(__name__) |
33 | 38 | log.setLevel(logging.DEBUG) |
@@ -565,6 +570,7 @@ class JWSTWCSCorrector(WCSCorrector): |
565 | 570 |
|
566 | 571 | """ |
567 | 572 | units = 'arcsec' |
| 573 | + corrector_name = 'JWST tangent-plane linear correction. v1' |
568 | 574 |
|
569 | 575 | def __init__(self, wcs, wcsinfo, meta=None): |
570 | 576 | """ |
@@ -642,18 +648,19 @@ def __init__(self, wcs, wcsinfo, meta=None): |
642 | 648 | self._default_tpcorr = JWSTWCSCorrector._tpcorr_init( |
643 | 649 | v2_ref=v2_ref / 3600.0, |
644 | 650 | v3_ref=v3_ref / 3600.0, |
645 | | - roll_ref=roll_ref |
| 651 | + roll_ref=roll_ref, |
| 652 | + corrector_name=self.corrector_name |
646 | 653 | ) |
647 | 654 | self._partial_tpcorr = JWSTWCSCorrector._v2v3_to_tpcorr_from_full( |
648 | 655 | self._default_tpcorr |
649 | 656 | ) |
650 | 657 |
|
651 | 658 | self._update_transformations() |
652 | 659 |
|
653 | | - @staticmethod |
654 | | - def _check_tpcorr_structure(tpcorr): |
| 660 | + @classmethod |
| 661 | + def _check_tpcorr_structure(cls, tpcorr): |
655 | 662 | # implement a more sophisticated check later |
656 | | - if tpcorr.name != 'JWST tangent-plane linear correction. v1': |
| 663 | + if tpcorr.name != cls.corrector_name: |
657 | 664 | return False |
658 | 665 | return True |
659 | 666 |
|
@@ -694,7 +701,7 @@ def _tpcorr_combine_affines(tpcorr, matrix, shift): |
694 | 701 | tpcorr.inverse['tp_affine_inv'].translation = -np.dot(invm, t) |
695 | 702 |
|
696 | 703 | @staticmethod |
697 | | - def _tpcorr_init(v2_ref, v3_ref, roll_ref): |
| 704 | + def _tpcorr_init(v2_ref, v3_ref, roll_ref, corrector_name="Unnamed"): |
698 | 705 | s2c = SphericalToCartesian(name='s2c', wrap_lon_at=180) |
699 | 706 | c2s = CartesianToSpherical(name='c2s', wrap_lon_at=180) |
700 | 707 |
|
@@ -730,13 +737,13 @@ def _tpcorr_init(v2_ref, v3_ref, roll_ref): |
730 | 737 | unit_conv | s2c | rot | c2tan | affine | |
731 | 738 | tan2c | rot_inv | c2s | unit_conv_inv |
732 | 739 | ) |
733 | | - total_corr.name = 'JWST tangent-plane linear correction. v1' |
| 740 | + total_corr.name = corrector_name |
734 | 741 |
|
735 | 742 | inv_total_corr = ( |
736 | 743 | unit_conv | s2c | rot | c2tan | affine_inv | |
737 | 744 | tan2c | rot_inv | c2s | unit_conv_inv |
738 | 745 | ) |
739 | | - inv_total_corr.name = 'Inverse JWST tangent-plane linear correction. v1' |
| 746 | + inv_total_corr.name = f'Inverse {corrector_name}' |
740 | 747 |
|
741 | 748 | # TODO |
742 | 749 | # re-enable circular inverse definitions once |
@@ -859,7 +866,8 @@ def set_correction(self, matrix=[[1, 0], [0, 1]], shift=[0, 0], |
859 | 866 | self._tpcorr = JWSTWCSCorrector._tpcorr_init( |
860 | 867 | v2_ref=self._wcsinfo['v2_ref'] / 3600.0, |
861 | 868 | v3_ref=self._wcsinfo['v3_ref'] / 3600.0, |
862 | | - roll_ref=self._wcsinfo['roll_ref'] |
| 869 | + roll_ref=self._wcsinfo['roll_ref'], |
| 870 | + corrector_name=self.corrector_name |
863 | 871 | ) |
864 | 872 |
|
865 | 873 | JWSTWCSCorrector._tpcorr_combine_affines( |
@@ -1043,6 +1051,17 @@ def bounding_box(self): |
1043 | 1051 | return self._owcs.pixel_bounds |
1044 | 1052 |
|
1045 | 1053 |
|
| 1054 | +class RomanWCSCorrector(JWSTWCSCorrector): |
| 1055 | + """ A class for holding ``Roman`` ``GWCS`` information and for managing |
| 1056 | + tangent-plane corrections. The units of the tangent plane of this |
| 1057 | + corrector are ``arcsec`` and the axes are not along parallel to the |
| 1058 | + axes of the detector's coordinate system. |
| 1059 | +
|
| 1060 | + """ |
| 1061 | + units = 'arcsec' |
| 1062 | + corrector_name = 'Roman tangent-plane linear correction. v1' |
| 1063 | + |
| 1064 | + |
1046 | 1065 | @deprecated(since='0.8.0', alternative='WCSCorrector') |
1047 | 1066 | class TPWCS(WCSCorrector): |
1048 | 1067 | pass |
|
0 commit comments