Changeset 12319
- Timestamp:
- Mar 8, 2007, 11:38:26 AM (19 years ago)
- Location:
- branches/dvo-mods-2007-02/Ohana/src/relastro
- Files:
-
- 1 added
- 7 edited
-
Makefile (modified) (1 diff)
-
include/relastro.h (modified) (3 diffs)
-
src/UpdateObjects.c (modified) (6 diffs)
-
src/args.c (modified) (5 diffs)
-
src/dvo_astrom_ops.c (modified) (1 diff)
-
src/load_catalogs.c (modified) (3 diffs)
-
src/relastro.c (modified) (3 diffs)
-
src/save_catalogs.c (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/dvo-mods-2007-02/Ohana/src/relastro/Makefile
r12276 r12319 51 51 $(SRC)/relastro.$(ARCH).o \ 52 52 $(SRC)/reload_catalogs.$(ARCH).o \ 53 $(SRC)/save_catalogs.$(ARCH).o \ 53 54 $(SRC)/setExclusions.$(ARCH).o \ 54 55 $(SRC)/write_coords.$(ARCH).o -
branches/dvo-mods-2007-02/Ohana/src/relastro/include/relastro.h
r12276 r12319 126 126 time_t TSTART, TSTOP; 127 127 128 int FITTING_MODE; 129 enum {FIT_AVERAGE, FIT_PM_ONLY, FIT_PM_AND_PAR}; 128 int FIT_MODE; 129 enum {FIT_NONE, FIT_AVERAGE, FIT_PM_ONLY, FIT_PM_AND_PAR}; 130 131 int FIT_TARGET; 132 enum {TARGET_NONE, TARGET_OBJECTS, TARGET_SIMPLE, TARGET_CHIPS, TARGET_MOSAICS}; 130 133 131 134 SkyRegion UserPatch; … … 188 191 void initstats PROTO((char *mode)); 189 192 int liststats PROTO((double *value, double *dvalue, int N, StatType *stats)); 190 Catalog *load_catalogs PROTO((SkyList *skylist, int *Ncatalog ));193 Catalog *load_catalogs PROTO((SkyList *skylist, int *Ncatalog, int subselect)); 191 194 SkyList *load_images PROTO((FITS_DB *db, SkyRegion *region)); 192 195 Image *select_images PROTO((SkyList *skylist, Image *timage, int Ntimage, int **LineNumber, int *Nimage)); … … 279 282 double getMeanR (Measure *measure, Average *average, SecFilt *secfilt); 280 283 double getMeanD (Measure *measure, Average *average, SecFilt *secfilt); 284 int setMeanR (double ra_fit, Measure *measure, Average *average, SecFilt *secfilt); 285 int setMeanD (double dec_fit, Measure *measure, Average *average, SecFilt *secfilt); -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/UpdateObjects.c
r12220 r12319 45 45 PMFit fit; 46 46 47 initObjectData (catalog, Ncatalog); 48 47 49 coords.crval1 = 0; 48 50 coords.crval2 = 0; … … 60 62 /* calculate the average value of R,D for a single star */ 61 63 if (catalog[i].average[j].code & STAR_BAD) continue; 62 m = catalog[i].average[j].offset;63 64 64 65 N = 0; 66 m = catalog[i].average[j].offset; 65 67 for (k = 0; k < catalog[i].average[j].Nm; k++, m++) { 66 68 if (catalog[i].measure[m].flags & MEAS_BAD) continue; … … 78 80 N++; 79 81 } 82 83 // XXX This criterion needs to be better considered: adjust to match Ndof 80 84 if (N < STAR_TOOFEW) { /* too few measurements */ 81 85 catalog[i].average[j].code |= ID_STAR_FEW; … … 95 99 96 100 /* fit the model components as needed */ 97 switch (FIT TING_MODE) {101 switch (FIT_MODE) { 98 102 case FIT_AVERAGE: 99 103 liststats (R, dR, N, &statsR); … … 121 125 break; 122 126 default: 123 fprintf (stderr, " invalid fitting mode %d\n", FITTING_MODE);127 fprintf (stderr, "programming error at %s, %s", __FILE__, __LINE__); 124 128 exit (2); 125 129 } 130 131 if (0 && (j < 100)) { 132 fprintf (stderr, "%f %f -> %f %f (%f,%f)\n", 133 catalog[i].average[j].R, 134 catalog[i].average[j].D, 135 fit.Ro, fit.Do, 136 3600*(catalog[i].average[j].R - fit.Ro), 137 3600*(catalog[i].average[j].D - fit.Do)); 138 } 139 140 // the measure fields must be updated before the average fields 141 m = catalog[i].average[j].offset; 142 for (k = 0; k < catalog[i].average[j].Nm; k++, m++) { 143 if (catalog[i].measure[m].flags & MEAS_BAD) continue; 144 setMeanR (fit.Ro, &catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); 145 setMeanD (fit.Do, &catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]); 146 } 126 147 127 148 catalog[i].average[j].R = fit.Ro; … … 139 160 140 161 catalog[i].average[j].Xp = (fit.Nfit > 1) ? 100.0*log10(fit.chisq) : NO_MAG; 162 141 163 } 142 164 } -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/args.c
r12276 r12319 6 6 int N; 7 7 double trange; 8 9 /* possible operations */ 10 FIT_TARGET = TARGET_NONE; 11 FIT_MODE = FIT_AVERAGE; 12 if ((N = get_argument (argc, argv, "-update-objects"))) { 13 remove_argument (N, &argc, argv); 14 FIT_TARGET = TARGET_OBJECTS; 15 16 // check for object fitting modes (not valid for images) 17 if ((N = get_argument (argc, argv, "-pm"))) { 18 remove_argument (N, &argc, argv); 19 FIT_MODE = FIT_PM_ONLY; 20 } 21 if ((N = get_argument (argc, argv, "-pmpar"))) { 22 remove_argument (N, &argc, argv); 23 FIT_MODE = FIT_PM_AND_PAR; 24 } 25 } 26 if ((N = get_argument (argc, argv, "-update-simple"))) { 27 remove_argument (N, &argc, argv); 28 FIT_TARGET = TARGET_SIMPLE; 29 } 30 if ((N = get_argument (argc, argv, "-update-chips"))) { 31 remove_argument (N, &argc, argv); 32 FIT_TARGET = TARGET_CHIPS; 33 } 34 if ((N = get_argument (argc, argv, "-update-mosaics"))) { 35 remove_argument (N, &argc, argv); 36 FIT_TARGET = TARGET_MOSAICS; 37 } 38 if (FIT_TARGET == TARGET_NONE) usage(); 39 40 /* specify portion of the sky : allow default of all sky? */ 41 UserPatch.Rmin = 0; 42 UserPatch.Rmax = 360; 43 UserPatch.Dmin = -90; 44 UserPatch.Dmax = +90; 45 if ((N = get_argument (argc, argv, "-region"))) { 46 remove_argument (N, &argc, argv); 47 UserPatch.Rmin = atof (argv[N]); 48 remove_argument (N, &argc, argv); 49 UserPatch.Rmax = atof (argv[N]); 50 remove_argument (N, &argc, argv); 51 UserPatch.Dmin = atof (argv[N]); 52 remove_argument (N, &argc, argv); 53 UserPatch.Dmax = atof (argv[N]); 54 remove_argument (N, &argc, argv); 55 } else { 56 usage (); 57 } 8 58 9 59 /* define time */ … … 34 84 } 35 85 36 /* specify portion of the sky : allow default of all sky? */37 UserPatch.Rmin = 0;38 UserPatch.Rmax = 360;39 UserPatch.Dmin = -90;40 UserPatch.Dmax = +90;41 if ((N = get_argument (argc, argv, "-region"))) {42 remove_argument (N, &argc, argv);43 UserPatch.Rmin = atof (argv[N]);44 remove_argument (N, &argc, argv);45 UserPatch.Rmax = atof (argv[N]);46 remove_argument (N, &argc, argv);47 UserPatch.Dmin = atof (argv[N]);48 remove_argument (N, &argc, argv);49 UserPatch.Dmax = atof (argv[N]);50 remove_argument (N, &argc, argv);51 } else {52 usage ();53 }54 55 86 PHOTCODE_LIST = NULL; 56 87 if ((N = get_argument (argc, argv, "-photcode"))) { … … 79 110 } 80 111 81 # if (0)82 /* XXX is this still relevant?? */83 112 strcpy (STATMODE, "CHI_INNER_WTMEAN"); 84 113 if ((N = get_argument (argc, argv, "-statmode"))) { … … 87 116 remove_argument (N, &argc, argv); 88 117 } 89 # endif90 118 91 119 RESET = FALSE; … … 153 181 ImagSelect = TRUE; 154 182 } 155 156 /* possible operations */ 157 DoUpdateObjects = FALSE; 158 if ((N = get_argument (argc, argv, "-update-objects"))) { 159 remove_argument (N, &argc, argv); 160 DoUpdateObjects = TRUE; 161 } 162 DoUpdateSimple = FALSE; 163 if ((N = get_argument (argc, argv, "-update-simple"))) { 164 remove_argument (N, &argc, argv); 165 DoUpdateSimple = TRUE; 166 } 167 DoUpdateChips = FALSE; 168 if ((N = get_argument (argc, argv, "-update-chips"))) { 169 remove_argument (N, &argc, argv); 170 DoUpdateChips = TRUE; 171 } 172 DoUpdateMosaics = FALSE; 173 if ((N = get_argument (argc, argv, "-update-mosaics"))) { 174 remove_argument (N, &argc, argv); 175 DoUpdateMosaics = TRUE; 176 } 177 183 178 184 /* XXX drop this? */ 179 185 DophotSelect = FALSE; -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/dvo_astrom_ops.c
r12047 r12319 3 3 double getMeanR (Measure *measure, Average *average, SecFilt *secfilt) { 4 4 5 double ra;5 double ra; 6 6 7 /* the measure carries the instantaneous mean position at the epoch t */8 ra = average[0].R - measure[0].dR / 3600.0;7 /* the measure carries the instantaneous mean position at the epoch t */ 8 ra = average[0].R - measure[0].dR / 3600.0; 9 9 10 /* possible corrections to mean ra:10 /* possible corrections to mean ra: 11 11 12 - proper-motion and parallax13 - abberation14 - precession and nutation, etc15 - refraction16 - DCR12 - proper-motion and parallax 13 - abberation 14 - precession and nutation, etc 15 - refraction 16 - DCR 17 17 18 */18 */ 19 19 20 return (ra);20 return (ra); 21 21 } 22 22 23 23 double getMeanD (Measure *measure, Average *average, SecFilt *secfilt) { 24 24 25 double dec;25 double dec; 26 26 27 /* the measure carries the instantaneous mean position at the epoch t */28 dec = average[0].D - measure[0].dD / 3600.0;27 /* the measure carries the instantaneous mean position at the epoch t */ 28 dec = average[0].D - measure[0].dD / 3600.0; 29 29 30 /* possible corrections to mean ra:30 /* possible corrections to mean ra: 31 31 32 - proper-motion and parallax33 - abberation34 - precession and nutation, etc35 - refraction36 - DCR32 - proper-motion and parallax 33 - abberation 34 - precession and nutation, etc 35 - refraction 36 - DCR 37 37 38 */38 */ 39 39 40 return (dec);40 return (dec); 41 41 } 42 43 int setMeanR (double ra_fit, Measure *measure, Average *average, SecFilt *secfilt) { 44 45 /* math to get from new fitted position to new measure offset 46 ra_obs = average[0].R - measure[0].dR / 3600.0; 47 measure[0].dR = (ra_fit - ra_obs) * 3600.0; 48 measure[0].dR = (ra_fit - average[0].R + measure[0].dR/3600) * 3600.0 49 measure[0].dR = (ra_fit - average[0].R) * 3600.0 + measure[0].dR; 50 */ 51 52 /* the measure carries the instantaneous mean position at the epoch t */ 53 measure[0].dR += (ra_fit - average[0].R) * 3600.0; 54 55 /* possible corrections to mean ra: 56 57 - proper-motion and parallax 58 - abberation 59 - precession and nutation, etc 60 - refraction 61 - DCR 62 63 */ 64 65 return (TRUE); 66 } 67 68 int setMeanD (double dec_fit, Measure *measure, Average *average, SecFilt *secfilt) { 69 70 /* math to get from new fitted position to new measure offset 71 dec_obs = average[0].D - measure[0].dD / 3600.0; 72 measure[0].dD = (dec_fit - dec_obs) * 3600.0; 73 measure[0].dD = (dec_fit - average[0].D + measure[0].dD/3600) * 3600.0 74 measure[0].dD = (dec_fit - average[0].D) * 3600.0 + measure[0].dD; 75 */ 76 77 /* the measure carries the instantaneous mean position at the epoch t */ 78 measure[0].dD += (dec_fit - average[0].D) * 3600.0; 79 80 /* possible corrections to mean ra: 81 82 - proper-motion and parallax 83 - abberation 84 - precession and nutation, etc 85 - refraction 86 - DCR 87 88 */ 89 90 return (TRUE); 91 } -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/load_catalogs.c
r12048 r12319 1 1 # include "relastro.h" 2 2 3 Catalog *load_catalogs (SkyList *skylist, int *Ncatalog ) {3 Catalog *load_catalogs (SkyList *skylist, int *Ncatalog, int subselect) { 4 4 5 5 int i, Nstar; 6 Catalog *catalog, tcatalog;6 Catalog *catalog, *pcatalog, tcatalog; 7 7 8 8 if (VERBOSE) fprintf (stderr, "loading catalog data\n"); … … 13 13 for (i = 0; i < skylist[0].Nregions; i++) { 14 14 15 pcatalog = subselect ? &tcatalog : &catalog[i]; 16 15 17 // set up the basic catalog info 16 tcatalog.filename= skylist[0].filename[i];17 tcatalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data18 tcatalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data19 tcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF; // don't need to load all data at this point18 pcatalog[0].filename = skylist[0].filename[i]; 19 pcatalog[0].catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 20 pcatalog[0].catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 21 pcatalog[0].catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF; // don't need to load all data at this point 20 22 21 if (!dvo_catalog_open ( &tcatalog, skylist[0].regions[i], VERBOSE, "r")) {22 fprintf (stderr, "ERROR: failure reading catalog %s\n", tcatalog.filename);23 if (!dvo_catalog_open (pcatalog, skylist[0].regions[i], VERBOSE, "w")) { 24 fprintf (stderr, "ERROR: failure reading catalog %s\n", pcatalog[0].filename); 23 25 exit (1); 24 26 } 25 if (VERBOSE && ! tcatalog.Nave_disk) fprintf (stderr, "no data in %s, skipping\n", tcatalog.filename);27 if (VERBOSE && !pcatalog[0].Nave_disk) fprintf (stderr, "no data in %s, skipping\n", pcatalog[0].filename); 26 28 27 29 // select only the brighter stars 28 bcatalog (&catalog[i], &tcatalog); 29 dvo_catalog_unlock (&tcatalog); 30 dvo_catalog_free (&tcatalog); 30 if (subselect) { 31 bcatalog (&catalog[i], &tcatalog); 32 dvo_catalog_unlock (&tcatalog); 33 dvo_catalog_free (&tcatalog); 34 } 31 35 } 32 36 … … 37 41 } 38 42 if (Nstar < 2) { 39 fprintf (stderr, "insufficient stars %d\n", Nstar); 40 exit (0); 43 fprintf (stderr, "warning: insufficient stars %d\n", Nstar); 41 44 } 42 45 -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/relastro.c
r12276 r12319 24 24 skylist = load_images (&db, &UserPatch); 25 25 26 /* load catalog data from region files */27 catalog = load_catalogs (skylist, &Ncatalog );26 /* load catalog data from region files : subselect only if we are not doing the objects */ 27 catalog = load_catalogs (skylist, &Ncatalog, (FIT_TARGET != TARGET_OBJECTS)); 28 28 29 29 /* match measurements with images, mosaics */ … … 40 40 41 41 /* major modes */ 42 if (DoUpdateObjects) { 43 UpdateObjects (catalog, Ncatalog); 44 } 45 if (DoUpdateSimple) { 46 UpdateSimple (catalog, Ncatalog); 47 } 48 if (DoUpdateChips) { 49 UpdateChips (catalog, Ncatalog); 50 } 51 if (DoUpdateMosaics) { 52 UpdateMosaic (catalog, Ncatalog); 42 switch (FIT_TARGET) { 43 case TARGET_OBJECTS: 44 UpdateObjects (catalog, Ncatalog); 45 break; 46 case TARGET_SIMPLE: 47 UpdateSimple (catalog, Ncatalog); 48 break; 49 50 case TARGET_CHIPS: 51 UpdateChips (catalog, Ncatalog); 52 break; 53 54 case TARGET_MOSAICS: 55 UpdateMosaic (catalog, Ncatalog); 56 break; 57 default: 58 fprintf (stderr, "programming error at %s:%s", __FILE__, __LINE__); 59 exit (2); 53 60 } 54 61 … … 64 71 if (!UPDATE) exit (0); 65 72 66 /* need to figure out how to update images, etc */ 67 dvo_image_update (&db, VERBOSE); 68 dvo_image_unlock (&db); 73 if (FIT_TARGET == TARGET_OBJECTS) { 74 save_catalogs (catalog, Ncatalog); 75 } else { 76 dvo_image_update (&db, VERBOSE); 77 dvo_image_unlock (&db); 78 } 69 79 70 80 exit (0);
Note:
See TracChangeset
for help on using the changeset viewer.
