Changeset 10612 for trunk/psModules/test/astrom/tap_pmAstrometryWCS.c
- Timestamp:
- Dec 10, 2006, 8:30:07 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/test/astrom/tap_pmAstrometryWCS.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/test/astrom/tap_pmAstrometryWCS.c
r10606 r10612 83 83 } 84 84 85 { 86 diag("test pmAstromReadWCS"); 87 psMemId id = psMemGetId(); 88 89 psPlaneTransform *wcsTrans = psPlaneTransformAlloc (1, 1); 90 wcsTrans->x->coeff[0][0] = 0.0; 91 wcsTrans->y->coeff[0][0] = 0.0; 92 wcsTrans->x->coeff[1][0] = 1.0; 93 wcsTrans->x->coeff[0][1] = 0.0; 94 wcsTrans->y->coeff[1][0] = 0.0; 95 wcsTrans->y->coeff[0][1] = 1.0; 96 97 98 99 // construct a header with a simple set of WCS values 100 // convert to pmFPA components and check 101 102 psMetadata *header = psMetadataAlloc(); 103 104 psMetadataAddStr (header, PS_LIST_TAIL, "CTYPE1", PS_META_REPLACE, "", "RA---TAN"); 105 psMetadataAddStr (header, PS_LIST_TAIL, "CTYPE2", PS_META_REPLACE, "", "DEC--TAN"); 106 107 // center coords (R,D) 108 psMetadataAddF32 (header, PS_LIST_TAIL, "CRVAL1", PS_META_REPLACE, "", 0.0); 109 psMetadataAddF32 (header, PS_LIST_TAIL, "CRVAL2", PS_META_REPLACE, "", 0.0); 110 111 // center coords (X,Y) 112 psMetadataAddF32 (header, PS_LIST_TAIL, "CRPIX1", PS_META_REPLACE, "", 10.0); 113 psMetadataAddF32 (header, PS_LIST_TAIL, "CRPIX2", PS_META_REPLACE, "", 10.0); 114 115 // degrees per pixel 116 psMetadataAddF32 (header, PS_LIST_TAIL, "CDELT1", PS_META_REPLACE, "", 1.0/3600.0); 117 psMetadataAddF32 (header, PS_LIST_TAIL, "CDELT2", PS_META_REPLACE, "", 1.0/3600.0); 118 119 // rotation matrix 120 psMetadataAddF32 (header, PS_LIST_TAIL, "PC001001", PS_META_REPLACE, "", 1.0); 121 psMetadataAddF32 (header, PS_LIST_TAIL, "PC001002", PS_META_REPLACE, "", 0.0); 122 psMetadataAddF32 (header, PS_LIST_TAIL, "PC002001", PS_META_REPLACE, "", 0.0); 123 psMetadataAddF32 (header, PS_LIST_TAIL, "PC002002", PS_META_REPLACE, "", 1.0); 124 125 pmFPA *fpa = pmFPAAlloc (NULL); 126 pmChip *chip = pmChipAlloc (NULL, "test"); 127 128 // toFPA carries pixel scale (pixels per micron) 129 // toTPA carries plate scale (microns per arcsecond) 130 bool status = pmAstromReadWCS (fpa, chip, header, 25.0*PS_RAD_DEG/3600.0, false); 131 ok (status, "converted WCS keywords to FPA astrometry"); 132 skip_start (!status, 1, "*** WCS Conversion FAILS *** : skipping related tests"); 133 134 ok(fpa->toSky->type == PS_PROJ_TAN, "correct projection (TAN)"); 135 136 // make these tests double 137 ok_float(fpa->toSky->R*PS_DEG_RAD, 0.0, "projection center RA %f", fpa->toSky->R*PS_DEG_RAD); 138 ok_float(fpa->toSky->R*PS_DEG_RAD, 0.0, "projection center DEC %f", fpa->toSky->R*PS_DEG_RAD); 139 140 ok_float(fpa->toSky->Xs, 25.0*PS_RAD_DEG/3600.0, "projection X scale %f", fpa->toSky->Xs); 141 ok_float(fpa->toSky->Ys, 25.0*PS_RAD_DEG/3600.0, "projection X scale %f", fpa->toSky->Ys); 142 143 ok_float(fpa->toTPA->x->coeff[1][0][0][0], 0.04, "TP scale (mm per pixel): %f", fpa->toTPA->x->coeff[1][0][0][0]); 144 ok_float(fpa->toTPA->y->coeff[0][1][0][0], 0.04, "TP scale (mm per pixel): %f", fpa->toTPA->x->coeff[1][0][0][0]); 145 146 ok_float(chip->toFPA->x->coeff[0][0], -10.0, "ref pixel X: %f", chip->toFPA->x->coeff[0][0]); 147 ok_float(chip->toFPA->y->coeff[0][0], -10.0, "ref pixel Y: %f", chip->toFPA->y->coeff[0][0]); 148 149 ok_float(chip->toFPA->x->coeff[1][0], 1.0, "CD1_1: %f", chip->toFPA->x->coeff[1][0]); 150 ok_float(chip->toFPA->x->coeff[0][1], 0.0, "CD1_2: %f", chip->toFPA->x->coeff[0][1]); 151 ok_float(chip->toFPA->y->coeff[1][0], 0.0, "CD2_1: %f", chip->toFPA->y->coeff[1][0]); 152 ok_float(chip->toFPA->y->coeff[0][1], 1.0, "CD2_2: %f", chip->toFPA->y->coeff[0][1]); 153 154 // apply both systems to real data: 155 156 157 psFree (fpa); 158 psFree (chip); 159 psFree (header); 160 161 skip_end(); 162 ok(!psMemCheckLeaks (id, NULL, stderr, false), "no memory leaks"); 163 } 164 85 165 return exit_status(); 86 166 }
Note:
See TracChangeset
for help on using the changeset viewer.
