Changeset 10864
- Timestamp:
- Jan 1, 2007, 11:03:03 AM (19 years ago)
- Location:
- trunk/psastro
- Files:
-
- 2 added
- 1 deleted
- 8 edited
-
configure.ac (modified) (5 diffs)
-
src/Makefile.am (modified) (2 diffs)
-
src/psastro.h (modified) (1 diff)
-
src/psastroAstromGuess.c (modified) (3 diffs)
-
src/psastroDemoDump.c (added)
-
src/psastroDemoPlot.c (added)
-
src/psastroDemoPlots.c (deleted)
-
src/psastroLoadRefstars.c (modified) (4 diffs)
-
src/psastroMosaicAstrom.c (modified) (2 diffs)
-
src/psastroMosaicSetAstrom.c (modified) (1 diff)
-
src/psastroOneChip.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/configure.ac
r8780 r10864 8 8 AM_CONFIG_HEADER([src/config.h]) 9 9 AM_MAINTAINER_MODE 10 11 dnl otherwise AC_PROG_CC will default CFLAGS to "-g -02" 12 if test -z ${CFLAGS} ; then 13 CFLAGS="" 14 fi 15 AC_SUBST([CFLAGS]) 10 16 11 17 AC_LANG(C) … … 22 28 [AS_HELP_STRING(--enable-optimize,enable compiler optimization)], 23 29 [AC_MSG_RESULT(compile optimization enabled) 24 CFLAGS=" -O2"],30 CFLAGS="${CFLAGS=} -O2 -g"], 25 31 [AC_MSG_RESULT([compile optimization disabled]) 26 CFLAGS="-O0 -g"] 32 if test x"${CFLAGS}" == x; then 33 CFLAGS="-O0 -g" 34 fi 35 ] 27 36 ) 28 37 … … 31 40 [AS_HELP_STRING(--enable-profile,enable compiler profiler information inclusion)], 32 41 [AC_MSG_RESULT(compile optimization enabled) 33 CFLAGS="${CFLAGS=} -pg"] 42 CFLAGS="${CFLAGS=} -pg -g" 43 LDFLAGS="${LDFLAGS=} -pg"] 44 ) 45 46 dnl turn off trace messages 47 AC_ARG_ENABLE(trace, 48 [AS_HELP_STRING(--disable-trace,disable psTrace functionality)], 49 [AC_MSG_RESULT(psTrace disabled) 50 PSASTRO_CFLAGS="${PSASTRO_CFLAGS=} -DPS_NO_TRACE"] 34 51 ) 35 52 … … 41 58 fi 42 59 60 dnl ------------------ kapa,libkapa options ------------------------- 61 dnl -- libkapa implies the requirement for libpng, libjpeg as well -- 62 63 dnl save LIBS/CFLAGS/LDFLAGS 64 TMP_LIBS=${LIBS} 65 TMP_CFLAGS=${CFLAGS} 66 TMP_LDFLAGS=${LDFLAGS} 67 TMP_CPPFLAGS=${CPPFLAGS} 68 69 dnl test for command-line options: use ohana-config if not supplied 70 KAPA_CFLAGS_CONFIG="true" 71 KAPA_LIBS_CONFIG="true" 72 AC_ARG_WITH(kapa, 73 [AS_HELP_STRING(--with-kapa=DIR,Specify location of libkapa)], 74 [KAPA_CFLAGS="-I$withval/include" KAPA_LIBS="-L$withval/lib" 75 KAPA_CFLAGS_CONFIG="false" KAPA_LIBS_CONFIG="false"]) 76 AC_ARG_WITH(kapa-include, 77 [AS_HELP_STRING(--with-kapa-include=DIR,Specify libkapa include directory.)], 78 [KAPA_CFLAGS="-I$withval" KAPA_CFLAGS_CONFIG="false"]) 79 AC_ARG_WITH(kapa-lib, 80 [AS_HELP_STRING(--with-kapa-lib=DIR,Specify libkapa library directory.)], 81 [KAPA_LIBS="-L$withval" KAPA_LIBS_CONFIG="false"]) 82 83 echo "KAPA_CFLAGS_CONFIG: $KAPA_CFLAGS_CONFIG" 84 echo "KAPA_LIBS_CONFIG: $KAPA_LIBS_CONFIG" 85 echo "KAPA_CFLAGS: $KAPA_CFLAGS" 86 echo "KAPA_LIBS: $KAPA_LIBS" 87 88 dnl HAVE_KAPA is set to false if any of the tests fail 89 HAVE_KAPA="true" 90 AC_MSG_NOTICE([checking for libkapa]) 91 if test "$KAPA_CFLAGS_CONFIG" = "true" -o "$KAPA_LIBS_CONFIG" = "true"; then 92 AC_MSG_NOTICE([kapa info supplied by ohana-config]) 93 KAPA_CONFIG=`which ohana-config` 94 AC_CHECK_FILE($KAPA_CONFIG,[], 95 [HAVE_KAPA="false"; AC_MSG_WARN([libkapa is not found: output plots disabled. Obtain libkapa at http://kiawe.ifa.hawaii.edu/Elixir/Ohana or use --with-kapa to specify location])]) 96 97 echo "HAVE_KAPA: $HAVE_KAPA" 98 echo "KAPA_CFLAGS_CONFIG: $KAPA_CFLAGS_CONFIG" 99 100 if test "$HAVE_KAPA" = "true" -a "$KAPA_CFLAGS_CONFIG" = "true" ; then 101 AC_MSG_NOTICE([libkapa cflags info supplied by ohana-config]) 102 AC_MSG_CHECKING([libkapa cflags]) 103 KAPA_CFLAGS="`${KAPA_CONFIG} --cflags`" 104 AC_MSG_RESULT([${KAPA_CFLAGS}]) 105 fi 106 107 if test "$HAVE_KAPA" = "true" -a "$KAPA_LIBS_CONFIG" = "true" ; then 108 AC_MSG_NOTICE([libkapa ldflags info supplied by ohana-config]) 109 AC_MSG_CHECKING([libkapa ldflags]) 110 KAPA_LIBS="`${KAPA_CONFIG} --libs` -lX11" 111 AC_MSG_RESULT([${KAPA_LIBS}]) 112 fi 113 fi 114 115 if test "$HAVE_KAPA" = "true" ; then 116 AC_MSG_NOTICE([libkapa supplied]) 117 PSASTRO_CFLAGS="${PSASTRO_CFLAGS} ${KAPA_CFLAGS}" 118 PSASTRO_LIBS="${PSASTRO_LIBS} ${KAPA_LIBS}" 119 else 120 AC_MSG_NOTICE([libkapa ignored]) 121 fi 122 123 dnl restore the CFLAGS/LDFLAGS 124 LIBS=${TMP_LIBS} 125 CFLAGS=${TMP_CFLAGS} 126 LDFLAGS=${TMP_LDFLAGS} 127 CPPFLAGS=${TMP_CPPFLAGS} 128 129 dnl ------------------ libjpeg options --------------------- 130 131 dnl save LIBS/CFLAGS/LDFLAGS 132 TMP_LIBS=${LIBS} 133 TMP_CFLAGS=${CFLAGS} 134 TMP_LDFLAGS=${LDFLAGS} 135 TMP_CPPFLAGS=${CPPFLAGS} 136 137 AC_ARG_WITH(jpeg, 138 [AS_HELP_STRING(--with-jpeg=DIR,Specify location of libjpeg.)], 139 [JPEG_CFLAGS="-I$withval/include" 140 JPEG_LDFLAGS="-L$withval/lib"]) 141 AC_ARG_WITH(jpeg-include, 142 [AS_HELP_STRING(--with-jpeg-include=DIR,Specify libjpeg include directory.)], 143 [JPEG_CFLAGS="-I$withval"]) 144 AC_ARG_WITH(jpeg-lib, 145 [AS_HELP_STRING(--with-jpeg-lib=DIR,Specify libjpeg library directory.)], 146 [JPEG_LDFLAGS="-L$withval"]) 147 148 CFLAGS="${CFLAGS} ${JPEG_CFLAGS}" 149 CPPFLAGS=${CFLAGS} 150 LDFLAGS="${LDFLAGS} ${JPEG_LDFLAGS}" 151 152 AC_CHECK_HEADERS([jpeglib.h], 153 [PSASTRO_CFLAGS="$PSASTRO_CFLAGS $JPEG_CFLAGS" AC_SUBST(JPEG_CFLAGS)], 154 [HAVE_KAPA=false; AC_MSG_WARN([libjpeg headers not found: output plots disabled. Obtain libjpeg from http://www.ijg.org/ or use --with-jpeg to specify location.])] 155 ) 156 157 AC_CHECK_LIB(jpeg,jpeg_CreateCompress, 158 [PSASTRO_LIBS="$PSASTRO_LIBS $JPEG_LDFLAGS -ljpeg"], 159 [HAVE_KAPA=false; AC_MSG_WARN([libjpeg library not found: output plots disabled. Obtain libjpeg from http://www.ijg.org/ or use --with-jpeg to specify location.])] 160 ) 161 162 dnl restore the CFLAGS/LDFLAGS 163 LIBS=${TMP_LIBS} 164 CFLAGS=${TMP_CFLAGS} 165 LDFLAGS=${TMP_LDFLAGS} 166 CPPFLAGS=${TMP_CPPFLAGS} 167 168 dnl ------------------ libpng options --------------------- 169 170 dnl save LIBS/CFLAGS/LDFLAGS 171 TMP_LIBS=${LIBS} 172 TMP_CFLAGS=${CFLAGS} 173 TMP_LDFLAGS=${LDFLAGS} 174 TMP_CPPFLAGS=${CPPFLAGS} 175 176 AC_ARG_WITH(png, 177 [AS_HELP_STRING(--with-png=DIR,Specify location of libpng.)], 178 [PNG_CFLAGS="-I$withval/include" 179 PNG_LDFLAGS="-L$withval/lib"]) 180 AC_ARG_WITH(png-include, 181 [AS_HELP_STRING(--with-png-include=DIR,Specify libpng include directory.)], 182 [PNG_CFLAGS="-I$withval"]) 183 AC_ARG_WITH(png-lib, 184 [AS_HELP_STRING(--with-png-lib=DIR,Specify libpng library directory.)], 185 [PNG_LDFLAGS="-L$withval"]) 186 187 CFLAGS="${CFLAGS} ${PNG_CFLAGS}" 188 CPPFLAGS=${CFLAGS} 189 LDFLAGS="${LDFLAGS} ${PNG_LDFLAGS}" 190 191 AC_CHECK_HEADERS([png.h], 192 [PSASTRO_CFLAGS="$PSASTRO_CFLAGS $PNG_CFLAGS" AC_SUBST(PNG_CFLAGS)], 193 [HAVE_KAPA=false; AC_MSG_WARN([libpng headers not found: output plots disabled. Obtain libpng from http://www.ijg.org/ or use --with-png to specify location.])] 194 ) 195 196 AC_CHECK_LIB(png,png_init_io, 197 [PSASTRO_LIBS="$PSASTRO_LIBS $PNG_LDFLAGS -lpng"], 198 [HAVE_KAPA=false; AC_MSG_WARN([libpng library not found: output plots disabled. Obtain libpng from http://www.ijg.org/ or use --with-png to specify location.])] 199 ) 200 201 dnl restore the CFLAGS/LDFLAGS 202 LIBS=${TMP_LIBS} 203 CFLAGS=${TMP_CFLAGS} 204 LDFLAGS=${TMP_LDFLAGS} 205 CPPFLAGS=${TMP_CPPFLAGS} 206 207 dnl ------------------ use kapa or not? --------------------- 208 209 if test "$HAVE_KAPA" == "true" ; then 210 AC_MSG_RESULT([including plotting functions]) 211 AC_DEFINE([HAVE_KAPA],[1],[enable use of libkapa]) 212 else 213 AC_MSG_RESULT([skipping plotting functions]) 214 AC_DEFINE([HAVE_KAPA],[0],[disable use of libkapa]) 215 fi 216 217 dnl ------------- psLib, psModules --------------- 43 218 PKG_CHECK_MODULES(PSLIB, pslib >= 0.12.99) 44 219 PKG_CHECK_MODULES(PSMODULE, psmodules >= 0.12.99) … … 46 221 dnl Set CFLAGS for build 47 222 CFLAGS="${CFLAGS} -Wall -Werror -std=c99" 223 echo "PSASTRO_CFLAGS: $PSASTRO_CFLAGS" 224 echo "PSASTRO_LIBS: $PSASTRO_LIBS" 48 225 49 226 AC_SUBST([PSASTRO_CFLAGS]) -
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.
