Changeset 19516 for trunk/psastro/src/psastroModelAnalysis.c
- Timestamp:
- Sep 11, 2008, 3:10:04 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroModelAnalysis.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroModelAnalysis.c
r19386 r19516 1 1 # include "psastroStandAlone.h" 2 # define NONLIN_TOL 0.001 2 3 3 4 bool psastroModelAnalysis (pmConfig *config) { … … 12 13 } 13 14 14 pmFPAfile *output = psMetadataLookupPtr (&status, config->files, "PSASTRO.OUT.MODEL"); 15 if (!status) psAbort ("Can't find output pmFPAfile PSASTRO.OUT.MODEL"); 16 17 char *outroot = psMetadataLookupStr (&status, config->arguments, "OUTPUT"); 18 if (!status || !outroot) psAbort ("Can't find outroot on config->arguments"); 19 20 // physical pixel scale in microns per pixel 15 // reference chip for boresite parameters 21 16 char *refChip = psMetadataLookupStr (&status, recipe, "PSASTRO.MODEL.REF.CHIP"); 22 17 if (!refChip) { … … 24 19 return false; 25 20 } 21 22 pmFPAfile *output = psMetadataLookupPtr (&status, config->files, "PSASTRO.OUT.MODEL"); 23 if (!status) psAbort ("Can't find output pmFPAfile PSASTRO.OUT.MODEL"); 24 25 // measure the boresite position from a rotation sequence? 26 bool fitBoresite = psMetadataLookupBool (&status, recipe, "PSASTRO.MODEL.FIT.BORESITE"); 27 if (!fitBoresite) { 28 psMetadataAddF32 (output->fpa->concepts, PS_LIST_TAIL, "FPA.BORE.X0", PS_META_REPLACE, "boresite parameter", 0.0); 29 psMetadataAddF32 (output->fpa->concepts, PS_LIST_TAIL, "FPA.BORE.Y0", PS_META_REPLACE, "boresite parameter", 0.0); 30 psMetadataAddF32 (output->fpa->concepts, PS_LIST_TAIL, "FPA.BORE.RX", PS_META_REPLACE, "boresite parameter", 0.0); 31 psMetadataAddF32 (output->fpa->concepts, PS_LIST_TAIL, "FPA.BORE.RY", PS_META_REPLACE, "boresite parameter", 0.0); 32 psMetadataAddF32 (output->fpa->concepts, PS_LIST_TAIL, "FPA.BORE.T0", PS_META_REPLACE, "boresite parameter", 0.0); 33 psMetadataAddF32 (output->fpa->concepts, PS_LIST_TAIL, "FPA.BORE.P0", PS_META_REPLACE, "boresite parameter", 0.0); 34 psMetadataAddStr (output->fpa->concepts, PS_LIST_TAIL, "FPA.REF.CHIP", PS_META_REPLACE, "boresite parameter", refChip); 35 return true; 36 } 37 38 char *outroot = psMetadataLookupStr (&status, config->arguments, "OUTPUT"); 39 if (!status || !outroot) psAbort ("Can't find outroot on config->arguments"); 26 40 27 41 /* model analysis: … … 38 52 * T_0 : reference angle for rotator 39 53 * P_0 : orientation of boresite ellipse 54 * 40 55 */ 41 56 … … 76 91 pmFPAfile *input = file->data.V; 77 92 78 // reported rotator position angle (this should perhaps be ROT, not POS)93 // reported rotator position angle 79 94 double POSANGLE = psMetadataLookupF64 (&status, input->fpa->concepts, "FPA.POSANGLE"); 80 95 if (!status) psAbort ("missing FPA.POSANGLE"); … … 84 99 if (!chip) psAbort ("invalid chip name for reference"); 85 100 86 // fprintf (stderr, "input %d : %zx : %zx : %zx\n", i, (size_t) input, (size_t) chip, (size_t) chip->toFPA);87 101 if (!chip->toFPA) continue; 88 102 … … 96 110 // all posZero values should be clustered in some region, but we need to flip over the 0,360 boundary correctly. 97 111 // push all to one side or the other 98 float posangle = PM_DEG_RAD * atan2 (chip->toFPA->y->coeff[1][0], chip->toFPA->x->coeff[1][0]); 99 posZero->data.F32[n] = POSANGLE - posangle; 112 float chipAngle = PM_DEG_RAD * atan2 (chip->toFPA->y->coeff[1][0], chip->toFPA->x->coeff[1][0]); 113 float fpaAngle = PM_DEG_RAD * atan2 (input->fpa->toTPA->y->coeff[1][0], input->fpa->toTPA->x->coeff[1][0]); 114 115 posZero->data.F32[n] = POSANGLE - chipAngle - fpaAngle; 100 116 if (n == 0) { 101 117 posBoundary = posZero->data.F32[n] + 180.0; … … 106 122 107 123 Po->data.F32[n] = POSANGLE * PM_RAD_DEG; // reported position angle 108 Xo->data.F32[n] = chip->fromFPA->x->coeff[0][0]; // reported boresite x position in ref chip coordinates 109 Yo->data.F32[n] = chip->fromFPA->y->coeff[0][0]; // reported boresite y position in ref chip coordinates 110 fprintf (outfile, "%d : %f %f : %f = %f - %f\n", i, Xo->data.F32[n], Yo->data.F32[n], posZero->data.F32[n], POSANGLE, posangle); 124 float xc = chip->fromFPA->x->coeff[0][0]; // reported boresite x position in ref chip coordinates 125 float yc = chip->fromFPA->y->coeff[0][0]; // reported boresite y position in ref chip coordinates 126 // XXX this can also be derived from toFPA via GetCenter.... 127 128 psPlane *PT = psPlaneTransformGetCenter (chip->toFPA, NONLIN_TOL); 129 Xo->data.F32[n] = PT->x; // reported boresite x position in ref chip coordinates 130 Yo->data.F32[n] = PT->y; // reported boresite y position in ref chip coordinates 131 psFree (PT); 132 133 fprintf (outfile, "%d : %f %f : %f = %f - %f - %f | %f %f\n", i, Xo->data.F32[n], Yo->data.F32[n], posZero->data.F32[n], POSANGLE, chipAngle, fpaAngle, xc, yc); 111 134 n ++; 112 135 }
Note:
See TracChangeset
for help on using the changeset viewer.
