Changeset 10880
- Timestamp:
- Jan 2, 2007, 3:26:52 PM (19 years ago)
- Location:
- trunk/psastro/src
- Files:
-
- 13 edited
-
psastro.h (modified) (2 diffs)
-
psastroChipAstrom.c (modified) (2 diffs)
-
psastroChooseRefstars.c (modified) (3 diffs)
-
psastroDemoDump.c (modified) (1 diff)
-
psastroLuminosityFunction.c (modified) (2 diffs)
-
psastroMosaicAstrom.c (modified) (3 diffs)
-
psastroMosaicChipAstrom.c (modified) (2 diffs)
-
psastroMosaicGradients.c (modified) (2 diffs)
-
psastroMosaicOneChip.c (modified) (5 diffs)
-
psastroMosaicSetAstrom.c (modified) (1 diff)
-
psastroMosaicSetMatch.c (modified) (2 diffs)
-
psastroOneChip.c (modified) (4 diffs)
-
psastroUtils.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastro.h
r10864 r10880 56 56 57 57 // mosaic fitting functions 58 psArray *psastroMosaicGradients (pmFPA *fpa, psMetadata *recipe);58 bool psastroMosaicGradients (pmFPA *fpa, psMetadata *recipe); 59 59 bool psastroMosaicCommonScale (pmFPA *fpa, psMetadata *recipe); 60 60 bool psastroMosaicAstrom (pmConfig *config, psArray *refs); 61 bool psastroMosaicChipAstrom (pmFPA *fpa, psMetadata *recipe, int iteration);61 bool psastroMosaicChipAstrom (pmFPA *fpa, psMetadata *recipe, bool nonlinear); 62 62 bool psastroMosaicSetMatch (pmFPA *fpa, psMetadata *recipe, int iteration); 63 63 bool psastroMosaicSetAstrom (pmFPA *fpa); 64 64 bool psastroMosaicHeaders (pmConfig *config); 65 65 bool psastroMosaicRescaleChips (pmFPA *fpa); 66 bool psastroMosaicOneChip (pmChip *chip, pmReadout *readout, psMetadata *recipe, psMetadata *updates, int iteration);66 bool psastroMosaicOneChip (pmChip *chip, pmReadout *readout, psMetadata *recipe, psMetadata *updates, bool nonlinear); 67 67 68 68 // Return version strings. … … 77 77 bool psastroDumpRawstars (psArray *rawstars, pmFPA *fpa, pmChip *chip); 78 78 bool psastroDumpRefstars (psArray *refstars); 79 bool psastroDumpMatches (pmFPA *fpa, char *filename); 79 80 80 81 bool psastroMosaicSetAstrom_tmp (pmFPA *fpa); -
trunk/psastro/src/psastroChipAstrom.c
r10855 r10880 4 4 bool psastroChipAstrom (pmConfig *config, psArray *refs) { 5 5 6 bool status;7 6 pmChip *chip = NULL; 8 7 pmCell *cell = NULL; … … 22 21 return false; 23 22 } 24 25 double plateScale = psMetadataLookupF32 (&status, recipe, "PSASTRO.PLATE.SCALE");26 if (!status) plateScale = 1.0;27 23 28 24 pmFPAview *view = pmFPAviewAlloc (0); -
trunk/psastro/src/psastroChooseRefstars.c
r10855 r10880 56 56 psArray *refstars = psArrayAllocEmpty (100); 57 57 58 FILE *f = fopen ("refstars.dat", "w");59 60 58 // select the reference objects within range of this readout 61 59 // project the reference objects to this chip … … 66 64 psPlaneTransformApply (ref->FP, fpa->fromTPA, ref->TP); 67 65 psPlaneTransformApply (ref->chip, chip->fromFPA, ref->FP); 68 69 fprintf (f, "%d %f %f %f %f %f %f %f %f\n", i,70 ref->sky->r, ref->sky->d,71 ref->TP->x, ref->TP->y,72 ref->FP->x, ref->FP->y,73 ref->chip->x, ref->chip->y);74 66 75 67 // limit the X,Y range of the refs to the selected chip … … 83 75 psFree (ref); 84 76 } 85 fclose (f);86 77 psTrace ("psastro", 4, "Added %ld refstars\n", refstars->n); 87 78 -
trunk/psastro/src/psastroDemoDump.c
r10864 r10880 58 58 return true; 59 59 } 60 61 bool psastroDumpMatches (pmFPA *fpa, char *filename) { 62 63 pmChip *chip = NULL; 64 pmCell *cell = NULL; 65 pmReadout *readout = NULL; 66 pmFPAview *view = pmFPAviewAlloc (0); 67 68 FILE *f = fopen (filename, "w"); 69 70 // this loop selects the matched stars for all chips 71 while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) { 72 psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 73 if (!chip->process || !chip->file_exists) continue; 74 75 while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) { 76 psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 77 if (!cell->process || !cell->file_exists) continue; 78 79 // process each of the readouts 80 // XXX there can only be one readout per chip, right? 81 while ((readout = pmFPAviewNextReadout (view, fpa, 1)) != NULL) { 82 if (! readout->data_exists) continue; 83 84 // select the raw objects for this readout 85 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS"); 86 if (rawstars == NULL) continue; 87 88 // select the raw objects for this readout 89 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS"); 90 if (refstars == NULL) continue; 91 psTrace ("psastro", 4, "Trying %ld refstars\n", refstars->n); 92 93 psArray *matches = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.MATCH"); 94 if (matches == NULL) continue; 95 96 for (int i = 0; i < matches->n; i++) { 97 pmAstromMatch *match = matches->data[i]; 98 99 pmAstromObj *raw = rawstars->data[match->raw]; 100 fprintf (f, "%f %f %f %f %f %f %f %f %f | ", 101 DEG_RAD*raw->sky->r, DEG_RAD*raw->sky->d, 102 raw->TP->x, raw->TP->y, 103 raw->FP->x, raw->FP->y, 104 raw->chip->x, raw->chip->y, raw->Mag); 105 106 pmAstromObj *ref = refstars->data[match->ref]; 107 fprintf (f, "%f %f %f %f %f %f %f %f %f\n", 108 DEG_RAD*ref->sky->r, DEG_RAD*ref->sky->d, 109 ref->TP->x, ref->TP->y, 110 ref->FP->x, ref->FP->y, 111 ref->chip->x, ref->chip->y, ref->Mag); 112 } 113 } 114 } 115 } 116 fclose (f); 117 psFree (view); 118 return true; 119 } -
trunk/psastro/src/psastroLuminosityFunction.c
r10855 r10880 68 68 // exclude bins with no stars 69 69 // exclude points after the peak with N < 0.8*peak 70 FILE *f = fopen ("psastro.dat", "w");71 70 int n = 0; 72 71 for (int i = 0; i < nMags->n; i++) { … … 75 74 lnMag->data.F32[n] = log10 (nMags->data.F32[i]); 76 75 Mag->data.F32[n] = mMin + (i + 0.5)*dMag; 77 fprintf (f, "%d %f %.0f %f\n", n, Mag->data.F32[n], nMags->data.F32[i], lnMag->data.F32[n]);78 76 n++; 79 77 } 80 fclose (f);81 78 lnMag->n = n; 82 79 Mag->n = n; -
trunk/psastro/src/psastroMosaicAstrom.c
r10864 r10880 4 4 // XXX require this fpa to have multiple chip extensions and a PHU? 5 5 bool psastroMosaicAstrom (pmConfig *config, psArray *refs) { 6 7 bool status;8 psArray *gradients = NULL;9 6 10 7 // select the current recipe … … 29 26 30 27 // given the existing per-chip astrometry, determine matches between raw and ref stars 28 // is this needed? yes, if we didn't do SingleChip astrometry first 31 29 psastroMosaicSetMatch (fpa, recipe, 0); 30 if (psTraceGetLevel("psastro.dump") > 0) { psastroDumpMatches (fpa, "match.0.dat"); } 32 31 33 32 // fitted chips will follow the local plate-scale, hiding the distortion … … 35 34 // then recalculate raw and ref positions 36 35 psastroMosaicCommonScale (fpa, recipe); 37 psastroMosaicSetAstrom (fpa);36 if (psTraceGetLevel("psastro.dump") > 0) { psastroDumpMatches (fpa, "match.1.dat"); } 38 37 39 gradients = psastroMosaicGradients (fpa, recipe); 38 // fit the distortion by fitting its gradient 39 // apply the new distortion terms up and down 40 // refit the per-chip terms with linear fits only 41 psastroMosaicGradients (fpa, recipe); 42 if (psTraceGetLevel("psastro.dump") > 0) { psastroDumpMatches (fpa, "match.2.dat"); } 40 43 41 // allocate mosaic-level polynomial transformation and set masks needed by DVO 42 int order = psMetadataLookupF32 (&status, recipe, "PSASTRO.MOSAIC.ORDER"); 43 if (!status) { 44 psError(PSASTRO_ERR_UNKNOWN, false, "failed to find single-chip fit order\n"); 45 return false; 46 } 47 psFree (fpa->toTPA); 48 fpa->toTPA = psPlaneTransformAlloc (order, order); 49 for (int i = 0; i <= fpa->toTPA->x->nX; i++) { 50 for (int j = 0; j <= fpa->toTPA->x->nY; j++) { 51 if (i + j > order) { 52 fpa->toTPA->x->mask[i][j] = 1; 53 fpa->toTPA->y->mask[i][j] = 1; 54 } 55 } 56 } 44 psastroMosaicChipAstrom (fpa, recipe, false); 45 if (psTraceGetLevel("psastro.dump") > 0) { psastroDumpMatches (fpa, "match.3.dat"); } 57 46 58 // fit the measured gradients with the telescope distortion model (polynomial order based on toTPA)59 pmAstromFitDistortion (fpa, gradients, recipe);60 psFree (gradients);61 62 // apply the new distortion terms up and down63 47 // re-perform the match with a slightly tighter circle 64 // XXX modify match radius65 // XXX set chip.order to 166 psastroMosaicSetAstrom_tmp (fpa);67 48 psastroMosaicSetMatch (fpa, recipe, 1); 68 psastroMosaicChipAstrom (fpa, recipe, 1);69 49 70 50 // do a second pass on the distortion with improved chip positions and rotations 71 // XXX do we need to iterate with this step until the distortions don't change?72 51 psastroMosaicCommonScale (fpa, recipe); 73 gradients =psastroMosaicGradients (fpa, recipe);74 p mAstromFitDistortion (fpa, gradients, recipe);75 ps Free (gradients);52 psastroMosaicGradients (fpa, recipe); 53 psastroMosaicChipAstrom (fpa, recipe, false); 54 psastroMosaicSetMatch (fpa, recipe, 1); 76 55 77 56 // now fit the chips under the common distortion with higher-order terms 78 // XXX modify match radius 79 // XXX set chip.order to NORDER 80 psastroMosaicSetAstrom (fpa); 81 psastroMosaicSetMatch (fpa, recipe, 2); 82 psastroMosaicChipAstrom (fpa, recipe, 2); 57 // first, re-perform the match with a slightly tighter circle 58 psastroMosaicChipAstrom (fpa, recipe, true); 83 59 84 60 // save WCS and analysis metadata in update header 85 // XXX need to add global summary statistics86 61 psMetadata *updates = psMetadataAlloc(); 87 62 pmAstromWriteBilevelMosaic (updates, fpa, NONLIN_TOL); 88 psMetadataAdd (fpa->analysis, PS_LIST_TAIL, "PSASTRO.HEADER", PS_DATA_METADATA, "psastro header stats", updates);63 psMetadataAddMetadata (fpa->analysis, PS_LIST_TAIL, "PSASTRO.HEADER", PS_META_REPLACE, "psastro header stats", updates); 89 64 psFree (updates); 90 65 91 66 // update the headers based on the results 67 // XXX need to add global summary statistics 92 68 // psastroMosaicHeaders (config); 93 69 -
trunk/psastro/src/psastroMosaicChipAstrom.c
r10830 r10880 2 2 # define NONLIN_TOL 0.001 /* tolerance in pixels */ 3 3 4 bool psastroMosaicChipAstrom (pmFPA *fpa, psMetadata *recipe, int iteration) {4 bool psastroMosaicChipAstrom (pmFPA *fpa, psMetadata *recipe, bool nonlinear) { 5 5 6 6 pmChip *chip = NULL; … … 26 26 psMetadata *updates = psMetadataAlloc(); 27 27 28 psastroMosaicOneChip (chip, readout, recipe, updates, iteration);28 psastroMosaicOneChip (chip, readout, recipe, updates, nonlinear); 29 29 30 // create the header keywords to descripe the results 30 31 pmAstromWriteBilevelChip (updates, chip, NONLIN_TOL); 31 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.HEADER", PS_DATA_METADATA, "psastro header stats", updates);32 psMetadataAddMetadata (readout->analysis, PS_LIST_TAIL, "PSASTRO.HEADER", PS_META_REPLACE, "psastro header stats", updates); 32 33 psFree (updates); 33 34 } 34 35 } 35 36 } 37 psFree (view); 36 38 return true; 37 39 } 38 39 /* the iteration value may be 1 or 2.40 */ -
trunk/psastro/src/psastroMosaicGradients.c
r10830 r10880 1 1 # include "psastro.h" 2 2 3 psArray *psastroMosaicGradients (pmFPA *fpa, psMetadata *recipe) {3 bool psastroMosaicGradients (pmFPA *fpa, psMetadata *recipe) { 4 4 5 bool status; 5 6 pmChip *chip = NULL; 6 7 pmCell *cell = NULL; … … 36 37 37 38 // measure the local gradients for this set of stars 38 // XXX update the function prototype to accept an incoming gradient structure to which the new elements are added39 39 gradients = pmAstromMeasureGradients (gradients, rawstars, refstars, match, recipe); 40 40 } 41 41 } 42 42 } 43 return (gradients); 43 44 // allocate mosaic-level polynomial transformation and set masks needed by DVO 45 int order = psMetadataLookupF32 (&status, recipe, "PSASTRO.MOSAIC.ORDER"); 46 if (!status) { 47 psError(PSASTRO_ERR_UNKNOWN, false, "failed to find single-chip fit order\n"); 48 return false; 49 } 50 psFree (fpa->toTPA); 51 fpa->toTPA = psPlaneTransformAlloc (order, order); 52 for (int i = 0; i <= fpa->toTPA->x->nX; i++) { 53 for (int j = 0; j <= fpa->toTPA->x->nY; j++) { 54 if (i + j > order) { 55 fpa->toTPA->x->mask[i][j] = 1; 56 fpa->toTPA->y->mask[i][j] = 1; 57 } 58 } 59 } 60 61 // fit the measured gradients with the telescope distortion model (polynomial order based on toTPA) 62 pmAstromFitDistortion (fpa, gradients, recipe); 63 psastroMosaicSetAstrom (fpa); 64 65 psFree (gradients); 66 psFree (view); 67 return true; 44 68 } -
trunk/psastro/src/psastroMosaicOneChip.c
r10830 r10880 1 1 # include "psastro.h" 2 2 3 bool psastroMosaicOneChip (pmChip *chip, pmReadout *readout, psMetadata *recipe, psMetadata *updates, int iteration) { 3 # define REQUIRED_RECIPE_VALUE(VALUE, NAME, TYPE, MESSAGE)\ 4 VALUE = psMetadataLookup##TYPE (&status, recipe, NAME); \ 5 if (!status) { \ 6 psError(PSASTRO_ERR_CONFIG, false, MESSAGE); \ 7 return false; } 8 9 bool psastroMosaicOneChip (pmChip *chip, pmReadout *readout, psMetadata *recipe, psMetadata *updates, bool nonlinear) { 4 10 5 11 bool status; … … 20 26 if (match == NULL) return false; 21 27 22 if ((iteration < 1) || (iteration > 2)) { 23 psError(PSASTRO_ERR_UNKNOWN, false, "invalid iteration number %d\n", iteration); 24 return false; 28 // correct radius to FP units (physical pixel scale in microns per pixel) 29 REQUIRED_RECIPE_VALUE (double pixelScale, "PSASTRO.PIXEL.SCALE", F32, "Failed to lookup pixel scale"); 30 31 // allowed limits for valid solutions 32 REQUIRED_RECIPE_VALUE (float maxError, "PSASTRO.MOSAIC.MAX.ERROR", F32, "failed to find single-chip max allowed error\n"); 33 REQUIRED_RECIPE_VALUE (int minNstar, "PSASTRO.MOSAIC.MIN.NSTAR", S32, "failed to find single-chip min allowed stars\n"); 34 35 // set the order of the per-chip fit (higher order only if nonlinear == true) 36 int order = 1; 37 if (nonlinear) { 38 // select the desired chip order 39 REQUIRED_RECIPE_VALUE (order, "PSASTRO.MOSAIC.CHIP.ORDER", S32, "failed to find mosaic chip-level fit order\n"); 40 41 // modify the order to correspond to the actual number of matched stars: 42 if ((match->n < 11) && (order >= 3)) order = 2; 43 if ((match->n < 7) && (order >= 2)) order = 1; 44 if ((match->n < 4) && (order >= 1)) order = 0; 45 if (order < 1) { 46 psLogMsg ("psastro", 3, "insufficient stars or invalid order: %ld stars", match->n); 47 return false; 48 } 25 49 } 26 50 27 // correct to FP units (physical pixel scale in microns per pixel) 28 double pixelScale = psMetadataLookupF32 (&status, recipe, "PSASTRO.PIXEL.SCALE"); 29 if (!status) { 30 psError(PS_ERR_IO, false, "Failed to lookup pixel scale"); 31 return false; 32 } 33 34 // set the order of the per-chip fit (iteration 1: 1, iteration 2: from recipe) 35 int order = 1; 36 if (iteration == 2) { 37 order = psMetadataLookupS32 (&status, recipe, "PSASTRO.MOSAIC.CHIP.ORDER"); 38 if (!status) { 39 psError(PSASTRO_ERR_UNKNOWN, false, "failed to find mosaic chip-level fit order\n"); 40 return false; 41 } 42 } 51 // create output toFPA; set masks appropriate to the Elixir DVO astrometry format 43 52 psFree (chip->toFPA); 44 53 chip->toFPA = psPlaneTransformAlloc (order, order); … … 64 73 } 65 74 66 // allowed limits for valid solutions 67 // XXX have these values depend on the iteration? 68 float maxError = psMetadataLookupF32 (&status, recipe, "PSASTRO.MOSAIC.MAX.ERROR"); 69 int minNstar = psMetadataLookupS32 (&status, recipe, "PSASTRO.MOSAIC.MIN.NSTAR"); 75 // toSky converts from FPA & TPA units (microns) to sky units (radians) 76 pmFPA *fpa = chip->parent; 77 float plateScale = 0.5*(fpa->toSky->Xs + fpa->toSky->Ys)*3600.0*PM_DEG_RAD; 70 78 71 // astError is the average 1D scatter in pixels ('results' are in FPA units = microns) 72 // XXX currently using supplied pixel scale: use toFPA->x->coeff[1][0], etc? 73 float astError = 0.5*(results->xStats->clippedStdev + results->yStats->clippedStdev) / pixelScale; 79 // pixError is the average 1D scatter in pixels ('results' are in FPA units = microns) 80 float pixError = 0.5*(results->xStats->clippedStdev + results->yStats->clippedStdev) / pixelScale; 81 82 // astError is the average 1D scatter in arcsec ('results' are in FPA units = microns) 83 float astError = 0.5*(results->xStats->clippedStdev + results->yStats->clippedStdev) * plateScale; 74 84 int astNstar = results->yStats->clippedNvalues; 75 85 … … 77 87 78 88 // XXX should these result in errors or be handled another way? 79 psLogMsg ("psastro", PS_LOG_INFO, "astrometry solution: error: %f , Nstars: %d", astError, astNstar);89 psLogMsg ("psastro", PS_LOG_INFO, "astrometry solution: error: %f arcsec, Nstars: %d", astError, astNstar); 80 90 if (astError > maxError) { 81 91 psLogMsg("psastro", PS_LOG_INFO, "residual error is too large, failed to find a solution: %f > %f", astError, maxError); … … 88 98 89 99 // DVO expects NASTRO = 0 if we fail to find a solution 100 psMetadataAddF32 (updates, PS_LIST_TAIL, "PERROR", PS_META_REPLACE, "astrometry error (pixels)", pixError); 101 psMetadataAddF32 (updates, PS_LIST_TAIL, "CERROR", PS_META_REPLACE, "astrometry error (arcsec)", astError); 90 102 if (validSolution) { 91 psMetadataAdd S32 (updates, PS_LIST_TAIL, "NASTRO", PS_META_REPLACE, "", astNstar);92 psMetadataAdd F32 (updates, PS_LIST_TAIL, "CPRECISE", PS_META_REPLACE, "", astError/sqrt(astNstar));103 psMetadataAddF32 (updates, PS_LIST_TAIL, "CPRECISE", PS_META_REPLACE, "astrometry precision (arcsec)", astError/sqrt(astNstar)); 104 psMetadataAddS32 (updates, PS_LIST_TAIL, "NASTRO", PS_META_REPLACE, "number of astrometry stars", astNstar); 93 105 } else { 94 psMetadataAdd S32 (updates, PS_LIST_TAIL, "NASTRO", PS_META_REPLACE, "",0);95 psMetadataAdd F32 (updates, PS_LIST_TAIL, "CPRECISE", PS_META_REPLACE, "", 0.0);106 psMetadataAddF32 (updates, PS_LIST_TAIL, "CPRECISE", PS_META_REPLACE, "astrometry precision (arcsec)", 0.0); 107 psMetadataAddS32 (updates, PS_LIST_TAIL, "NASTRO", PS_META_REPLACE, "number of astrometry stars", 0); 96 108 } 97 psMetadataAddF32 (updates, PS_LIST_TAIL, "CERROR", PS_META_REPLACE, "", astError);98 109 psMetadataAddF32 (updates, PS_LIST_TAIL, "EQUINOX", PS_META_REPLACE, "", 2000.0); // XXX this is bogus: should be defined based on equinox of refstars 110 111 // determine fromFPA transformation and apply new transformation to raw & ref stars 112 psastroUpdateChipToFPA (fpa, chip, rawstars, refstars); 99 113 100 114 psFree (fitStats); -
trunk/psastro/src/psastroMosaicSetAstrom.c
r10864 r10880 47 47 } 48 48 } 49 psFree (view); 49 50 return true; 50 51 } 51 52 bool psastroMosaicSetAstrom_tmp (pmFPA *fpa) {53 54 pmChip *chip = NULL;55 pmCell *cell = NULL;56 pmReadout *readout = NULL;57 pmFPAview *view = pmFPAviewAlloc (0);58 59 FILE *f1 = fopen ("raw.tmp.dat", "w");60 FILE *f2 = fopen ("ref.tmp.dat", "w");61 62 // this loop selects the matched stars for all chips63 while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {64 psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);65 if (!chip->process || !chip->file_exists) { continue; }66 67 while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {68 psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);69 if (!cell->process || !cell->file_exists) { continue; }70 71 // process each of the readouts72 // XXX there can only be one readout per chip, right?73 while ((readout = pmFPAviewNextReadout (view, fpa, 1)) != NULL) {74 if (! readout->data_exists) { continue; }75 76 // select the raw objects for this readout77 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS");78 if (rawstars == NULL) { continue; }79 80 for (int i = 0; i < rawstars->n; i++) {81 pmAstromObj *raw = rawstars->data[i];82 83 fprintf (f1, "%f %f %f %f %f %f ", raw->sky->r, raw->sky->d, raw->TP->x, raw->TP->y, raw->FP->x, raw->FP->y);84 85 psPlaneTransformApply (raw->FP, chip->toFPA, raw->chip);86 psPlaneTransformApply (raw->TP, fpa->toTPA, raw->FP);87 psDeproject (raw->sky, raw->TP, fpa->toSky);88 89 fprintf (f1, "| %f %f %f %f %f %f %f\n", raw->sky->r, raw->sky->d, raw->TP->x, raw->TP->y, raw->FP->x, raw->FP->y, raw->Mag);90 }91 92 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS");93 if (refstars == NULL) { continue; }94 95 for (int i = 0; i < refstars->n; i++) {96 pmAstromObj *ref = refstars->data[i];97 98 fprintf (f2, "%f %f %f %f %f %f ", ref->sky->r, ref->sky->d, ref->TP->x, ref->TP->y, ref->FP->x, ref->FP->y);99 100 psProject (ref->TP, ref->sky, fpa->toSky);101 psPlaneTransformApply (ref->FP, fpa->fromTPA, ref->TP);102 psPlaneTransformApply (ref->chip, chip->fromFPA, ref->FP);103 104 fprintf (f2, "| %f %f %f %f %f %f %f\n", ref->sky->r, ref->sky->d, ref->TP->x, ref->TP->y, ref->FP->x, ref->FP->y, ref->Mag);105 }106 }107 }108 }109 fclose (f1);110 fclose (f2);111 return true;112 } -
trunk/psastro/src/psastroMosaicSetMatch.c
r10830 r10880 8 8 pmFPAview *view = pmFPAviewAlloc (0); 9 9 char radiusWord[64]; 10 11 FILE *g1 = fopen ("raw.ps.dat", "w");12 FILE *g2 = fopen ("ref.ps.dat", "w");13 10 14 11 // use small radius to match stars (assume starting astrometry is good) … … 47 44 psTrace ("psastro", 4, "Matched %ld refstars\n", matches->n); 48 45 49 for (int i = 0; i < matches->n; i++) {50 pmAstromMatch *match = matches->data[i];51 52 pmAstromObj *raw = rawstars->data[match->raw];53 fprintf (g1, "%d %f %f %f %f %f %f %f %f\n", i,54 DEG_RAD*raw->sky->r, DEG_RAD*raw->sky->d,55 raw->TP->x, raw->TP->y,56 raw->FP->x, raw->FP->y,57 raw->chip->x, raw->chip->y);58 59 pmAstromObj *ref = refstars->data[match->ref];60 fprintf (g2, "%d %f %f %f %f %f %f %f %f\n", i,61 DEG_RAD*ref->sky->r, DEG_RAD*ref->sky->d,62 ref->TP->x, ref->TP->y,63 ref->FP->x, ref->FP->y,64 ref->chip->x, ref->chip->y);65 }66 67 46 // XXX drop the old one 68 47 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.MATCH", PS_DATA_ARRAY | PS_META_REPLACE, "astrometry matches", matches); 48 psFree (matches); 69 49 } 70 50 } 71 51 } 72 fclose (g1); 73 fclose (g2); 52 psFree (view); 74 53 return true; 75 54 } -
trunk/psastro/src/psastroOneChip.c
r10864 r10880 23 23 // allowed limits for valid solutions 24 24 REQUIRED_RECIPE_VALUE (float maxError, "PSASTRO.MAX.ERROR", F32, "failed to find single-chip max allowed error\n"); 25 26 25 REQUIRED_RECIPE_VALUE (int minNstar, "PSASTRO.MIN.NSTAR", S32, "failed to find single-chip min allowed stars\n"); 27 26 … … 53 52 } 54 53 55 // create the output fit model, modify the order to correspond to the actual number of 56 // matched stars: 54 // modify the order to correspond to the actual number of matched stars: 57 55 if ((match->n < 11) && (order >= 3)) order = 2; 58 56 if ((match->n < 7) && (order >= 2)) order = 1; … … 66 64 } 67 65 68 // set masks appropriate to the Elixir DVO astrometry format66 // create output toFPA; set masks appropriate to the Elixir DVO astrometry format 69 67 psFree (chip->toFPA); 70 68 chip->toFPA = psPlaneTransformAlloc (order, order); … … 125 123 psMetadataAddF32 (updates, PS_LIST_TAIL, "EQUINOX", PS_META_REPLACE, "equinox of ref catalog", 2000.0); // XXX this is bogus: should be defined based on equinox of refstars 126 124 127 // write results125 // determine fromFPA transformation and apply new transformation to raw & ref stars 128 126 psastroUpdateChipToFPA (fpa, chip, rawstars, refstars); 129 127 -
trunk/psastro/src/psastroUtils.c
r10855 r10880 73 73 74 74 } 75 psastroMosaicSetAstrom (fpa); 75 76 return true; 76 77 }
Note:
See TracChangeset
for help on using the changeset viewer.
