Changeset 19386 for trunk/psastro/src/psastroModelAnalysis.c
- Timestamp:
- Sep 5, 2008, 7:46:30 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroModelAnalysis.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroModelAnalysis.c
r19309 r19386 14 14 pmFPAfile *output = psMetadataLookupPtr (&status, config->files, "PSASTRO.OUT.MODEL"); 15 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"); 16 19 17 20 // physical pixel scale in microns per pixel … … 58 61 output->fpa = NULL; 59 62 63 char filename[256]; 64 snprintf (filename, 256, "%s.bore", outroot); 65 FILE *outfile = fopen (filename, "w"); 66 if (!outfile) { 67 psError(PSASTRO_ERR_ARGUMENTS, true, "cannot open %s for output", filename); 68 return false; 69 } 70 71 float posBoundary = 0.0; 72 60 73 // extract the relevant measured and reported values from the reference chip 61 74 for (int i = 0; i < files->n; i++) { … … 80 93 81 94 // we have two measurements of the posangle (may be parity flipped to different quadrants) 95 // atan2 returns values in the range 0-2pi 96 // all posZero values should be clustered in some region, but we need to flip over the 0,360 boundary correctly. 97 // push all to one side or the other 82 98 float posangle = PM_DEG_RAD * atan2 (chip->toFPA->y->coeff[1][0], chip->toFPA->x->coeff[1][0]); 83 99 posZero->data.F32[n] = POSANGLE - posangle; 84 while (posZero->data.F32[n] > 360.0) posZero->data.F32[n] -= 360.0; 85 while (posZero->data.F32[n] < 0.0) posZero->data.F32[n] += 360.0; 100 if (n == 0) { 101 posBoundary = posZero->data.F32[n] + 180.0; 102 } else { 103 while (posZero->data.F32[n] > posBoundary) posZero->data.F32[n] -= 360.0; 104 while (posZero->data.F32[n] < posBoundary - 360.0) posZero->data.F32[n] += 360.0; 105 } 86 106 87 107 Po->data.F32[n] = POSANGLE * PM_RAD_DEG; // reported position angle 88 108 Xo->data.F32[n] = chip->fromFPA->x->coeff[0][0]; // reported boresite x position in ref chip coordinates 89 109 Yo->data.F32[n] = chip->fromFPA->y->coeff[0][0]; // reported boresite y position in ref chip coordinates 90 fprintf ( stderr, "%d : %f %f : %f = %f - %f\n", i, Xo->data.F32[n], Yo->data.F32[n], posZero->data.F32[n], POSANGLE, posangle);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); 91 111 n ++; 92 112 } … … 100 120 psVectorStats (stats, posZero, NULL, NULL, 0); 101 121 102 fprintf ( stderr, "pos zero %f +/- %f\n", stats->sampleMedian, stats->sampleStdev);122 fprintf (outfile, "# pos zero %f +/- %f\n", stats->sampleMedian, stats->sampleStdev); 103 123 psMetadataAddF32 (output->fpa->concepts, PS_LIST_TAIL, "FPA.POS_ZERO", PS_META_REPLACE, "offset between obs and meas posangle", stats->sampleMedian); 124 fclose (outfile); 104 125 105 psVector *params = psastroModelFitBoresite (Xo, Yo, Po );126 psVector *params = psastroModelFitBoresite (Xo, Yo, Po, outroot); 106 127 if (params->n != 6) psAbort ("error"); 128 107 129 108 130 psMetadataAddF32 (output->fpa->concepts, PS_LIST_TAIL, "FPA.BORE.X0", PS_META_REPLACE, "boresite parameter", params->data.F32[PAR_X0]);
Note:
See TracChangeset
for help on using the changeset viewer.
