Changeset 10864 for trunk/psastro/src
- Timestamp:
- Jan 1, 2007, 11:03:03 AM (20 years ago)
- Location:
- trunk/psastro/src
- Files:
-
- 2 added
- 1 deleted
- 7 edited
-
Makefile.am (modified) (2 diffs)
-
psastro.h (modified) (1 diff)
-
psastroAstromGuess.c (modified) (3 diffs)
-
psastroDemoDump.c (added)
-
psastroDemoPlot.c (added)
-
psastroDemoPlots.c (deleted)
-
psastroLoadRefstars.c (modified) (4 diffs)
-
psastroMosaicAstrom.c (modified) (2 diffs)
-
psastroMosaicSetAstrom.c (modified) (1 diff)
-
psastroOneChip.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/Makefile.am
r10830 r10864 5 5 bin_PROGRAMS = psastro 6 6 psastro_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PSASTRO_CFLAGS) 7 psastro_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) 7 psastro_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PSASTRO_LIBS) 8 8 psastro_LDADD = libpsastro.la 9 9 … … 34 34 psastroMosaicOneChip.c \ 35 35 psastroMosaicSetAstrom.c \ 36 psastroMosaicSetMatch.c 36 psastroMosaicSetMatch.c \ 37 psastroDemoDump.c \ 38 psastroDemoPlot.c 37 39 38 40 include_HEADERS = \ -
trunk/psastro/src/psastro.h
r10830 r10864 70 70 psString psastroVersionLong(void); 71 71 72 // demo plots 73 bool psastroPlotRawstars (psArray *rawstars, pmFPA *fpa, pmChip *chip); 74 bool psastroPlotRefstars (psArray *refstars); 75 bool psastroPlotOneChipFit (psArray *rawstars, psArray *refstars, psArray *match, pmAstromFitResults *results); 76 77 bool psastroDumpRawstars (psArray *rawstars, pmFPA *fpa, pmChip *chip); 78 bool psastroDumpRefstars (psArray *refstars); 79 80 bool psastroMosaicSetAstrom_tmp (pmFPA *fpa); -
trunk/psastro/src/psastroAstromGuess.c
r10861 r10864 75 75 if (rawstars == NULL) { continue; } 76 76 77 if (psTraceGetLevel("psastro.dump.rawstars") > 2) {78 dump_stars (rawstars, fpa, chip);79 }80 81 if (psTraceGetLevel("psastro.plot.rawstars") > 2) {82 plot_stars (rawstars, fpa, chip);83 }84 85 77 for (int i = 0; i < rawstars->n; i++) { 86 78 pmAstromObj *raw = rawstars->data[i]; … … 100 92 DECmax = PS_MAX (raw->sky->d, DECmax); 101 93 } 94 95 // dump or plot the resulting projected positions 96 if (psTraceGetLevel("psastro.dump") > 0) { 97 psastroDumpRawstars (rawstars, fpa, chip); 98 } 99 100 if (psTraceGetLevel("psastro.plot") > 0) { 101 psastroPlotRawstars (rawstars, fpa, chip); 102 } 102 103 } 103 104 } … … 125 126 sky (ra, dec) 126 127 */ 127 128 dump_stars (psArray *rawstars, pmFPA *fpa, pmChip *chip) {129 130 FILE *f1 = fopen ("rawstars.up.dat", "w");131 FILE *f2 = fopen ("rawstars.dn.dat", "w");132 for (int i = 0; i < rawstars->n; i++) {133 pmAstromObj *raw = rawstars->data[i];134 135 psPlaneTransformApply (raw->FP, chip->toFPA, raw->chip);136 psPlaneTransformApply (raw->TP, fpa->toTPA, raw->FP);137 psDeproject (raw->sky, raw->TP, fpa->toSky);138 139 fprintf (f1, "%d %f %f %f %f %f %f %f %f\n", i,140 raw->sky->r, raw->sky->d,141 raw->TP->x, raw->TP->y,142 raw->FP->x, raw->FP->y,143 raw->chip->x, raw->chip->y);144 145 psPlane *fp = psPlaneAlloc();146 psPlane *tp = psPlaneAlloc();147 psPlane *ch = psPlaneAlloc();148 149 psProject (tp, raw->sky, fpa->toSky);150 psPlaneTransformApply (fp, fpa->fromTPA, tp);151 psPlaneTransformApply (ch, chip->fromFPA, fp);152 153 fprintf (f2, "%d %f %f %f %f %f %f %f %f\n", i,154 raw->sky->r, raw->sky->d,155 tp->x, tp->y,156 fp->x, fp->y,157 ch->x, ch->y);158 159 psFree (fp);160 psFree (tp);161 psFree (ch);162 }163 164 fclose (f1);165 fclose (f2);166 } -
trunk/psastro/src/psastroLoadRefstars.c
r10438 r10864 1 1 # include "psastro.h" 2 // int mkstemp(char *template);3 2 # define ELIXIR_MODE 1 4 3 … … 84 83 // convert the Average table to the pmAstromObj entries 85 84 psTimerStart ("psastro"); 86 psArray *refs = psArrayAllocEmpty (table->n);85 psArray *refstars = psArrayAllocEmpty (table->n); 87 86 for (int i = 0; i < table->n; i++) { 88 87 pmAstromObj *ref = pmAstromObjAlloc (); … … 101 100 } 102 101 103 psArrayAdd (refs , 100, ref);102 psArrayAdd (refstars, 100, ref); 104 103 psFree (ref); 105 104 } … … 109 108 110 109 psTrace ("psastro", 3, "loaded %ld reference stars from (%10.6f,%10.6f) - (%10.6f,%10.6f)\n", 111 refs ->n, RAmin, DECmin, RAmax, DECmax);110 refstars->n, RAmin, DECmin, RAmax, DECmax); 112 111 113 return refs; 112 // dump or plot the available refstars 113 if (psTraceGetLevel("psastro.dump") > 0) { 114 psastroDumpRefstars (refstars); 115 } 116 117 if (psTraceGetLevel("psastro.plot") > 0) { 118 psastroPlotRefstars (refstars); 119 } 120 121 return refstars; 114 122 } -
trunk/psastro/src/psastroMosaicAstrom.c
r10830 r10864 32 32 33 33 // fitted chips will follow the local plate-scale, hiding the distortion 34 // modify the chip->toFPA scaling to match knowledge about pixel scale 34 // modify the chip->toFPA scaling to match knowledge about pixel scale, 35 // then recalculate raw and ref positions 35 36 psastroMosaicCommonScale (fpa, recipe); 37 psastroMosaicSetAstrom (fpa); 36 38 37 39 gradients = psastroMosaicGradients (fpa, recipe); … … 62 64 // XXX modify match radius 63 65 // XXX set chip.order to 1 64 psastroMosaicSetAstrom (fpa);66 psastroMosaicSetAstrom_tmp (fpa); 65 67 psastroMosaicSetMatch (fpa, recipe, 1); 66 68 psastroMosaicChipAstrom (fpa, recipe, 1); -
trunk/psastro/src/psastroMosaicSetAstrom.c
r10830 r10864 49 49 return true; 50 50 } 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 chips 63 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 readouts 72 // 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 readout 77 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/psastroOneChip.c
r10855 r10864 90 90 } 91 91 92 // toTPA converts from FPA units (microns) to TPA units (linear degrees) 93 float plateScale1 = hypot (fpa->toTPA->x->coeff[1][0], fpa->toTPA->x->coeff[0][1]); 94 float plateScale2 = hypot (fpa->toTPA->y->coeff[1][0], fpa->toTPA->y->coeff[0][1]); 95 float plateScale = 0.5*(plateScale1 + plateScale2)*3600.0; 92 // toSky converts from FPA & TPA units (microns) to sky units (radians) 93 float plateScale = 0.5*(fpa->toSky->Xs + fpa->toSky->Ys)*3600.0*PM_DEG_RAD; 96 94 97 95 // pixError is the average 1D scatter in pixels ('results' are in FPA units = microns) … … 105 103 106 104 // XXX should these result in errors or be handled another way? 107 psLogMsg ("psastro", PS_LOG_INFO, "astrometry solution: error: %f , Nstars: %d", astError, astNstar);105 psLogMsg ("psastro", PS_LOG_INFO, "astrometry solution: error: %f arcsec, Nstars: %d", astError, astNstar); 108 106 if (astError > maxError) { 109 107 psLogMsg("psastro", PS_LOG_INFO, "residual error is too large, failed to find a solution: %f > %f", astError, maxError); … … 127 125 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 128 126 129 // write results127 // write results 130 128 psastroUpdateChipToFPA (fpa, chip, rawstars, refstars); 129 130 if (psTraceGetLevel("psastro.plot") > 0) { 131 psastroPlotOneChipFit (rawstars, refstars, match, results); 132 } 131 133 132 134 psFree (match);
Note:
See TracChangeset
for help on using the changeset viewer.
