Changeset 37655
- Timestamp:
- Nov 20, 2014, 8:34:19 PM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140904/Ohana/src/relastro
- Files:
-
- 9 edited
-
include/relastro.h (modified) (3 diffs)
-
src/BrightCatalog.c (modified) (8 diffs)
-
src/ConfigInit.c (modified) (1 diff)
-
src/FrameCorrection.c (modified) (4 diffs)
-
src/ICRF.c (modified) (1 diff)
-
src/bcatalog.c (modified) (6 diffs)
-
src/load_catalogs.c (modified) (2 diffs)
-
src/relastro_images.c (modified) (2 diffs)
-
src/relastro_parallel_images.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140904/Ohana/src/relastro/include/relastro.h
r37622 r37655 200 200 int USE_GALAXY_MODEL; 201 201 int USE_ICRF_CORRECT; 202 203 int USE_ICRF_LOCAL; 204 int USE_ICRF_SHFIT; 202 205 203 206 int RESET; … … 285 288 int args PROTO((int argc, char **argv)); 286 289 int args_client PROTO((int argc, char **argv)); 287 int bcatalog PROTO((Catalog *subcatalog, Catalog *catalog , int Nsubcatalog));290 int bcatalog PROTO((Catalog *subcatalog, Catalog *catalog)); 288 291 void clean_images PROTO((void)); 289 292 void clean_measures PROTO((Catalog *catalog, int Ncatalog, int final)); … … 573 576 int ICRFdata (int n, int *cat, int *ave, int *meas); 574 577 int ICRFmax (); 578 int select_catalog_ICRF (Catalog *catalog, int Ncatalog); 575 579 576 580 FrameCorrectionType *FrameCorrectionInit (double scale); -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/BrightCatalog.c
r37038 r37655 70 70 GET_COLUMN(R, "RA", double); 71 71 GET_COLUMN(D, "DEC", double); 72 GET_COLUMN(RoffGAL, "ROFF_GAL", float); 73 GET_COLUMN(DoffGAL, "DOFF_GAL", float); 72 74 GET_COLUMN(M, "MAG_SYS", float); 73 75 GET_COLUMN(Mcal, "MAG_CAL", float); … … 94 96 measure[i].R = R[i]; 95 97 measure[i].D = D[i]; 98 measure[i].RoffGAL = RoffGAL[i]; 99 measure[i].DoffGAL = DoffGAL[i]; 96 100 measure[i].M = M[i]; 97 101 measure[i].Mcal = Mcal[i]; … … 115 119 free (R ); 116 120 free (D ); 121 free (RoffGAL ); 122 free (DoffGAL ); 117 123 free (M ); 118 124 free (Mcal ); … … 343 349 gfits_create_table_header (&theader, "BINTABLE", "MEASURE_TINY"); 344 350 345 gfits_define_bintable_column (&theader, "E", "RA_OFF", "ra offset", "arcsec", 1.0, 0.0); 346 gfits_define_bintable_column (&theader, "E", "DEC_OFF", "dec offset", "arcsec", 1.0, 0.0); 351 gfits_define_bintable_column (&theader, "D", "RA", "ra", "degrees", 1.0, 0.0); 352 gfits_define_bintable_column (&theader, "D", "DEC", "dec", "degrees", 1.0, 0.0); 353 gfits_define_bintable_column (&theader, "E", "ROFF_GAL", "ra offset", "arcsec", 1.0, 0.0); 354 gfits_define_bintable_column (&theader, "E", "DOFF_GAL", "dec offset", "arcsec", 1.0, 0.0); 347 355 gfits_define_bintable_column (&theader, "E", "MAG_SYS", "magnitude (sys)", NULL, 1.0, 0.0); 348 356 gfits_define_bintable_column (&theader, "E", "MAG_CAL", "magnitude (cal)", NULL, 1.0, 0.0); … … 368 376 double *R ; ALLOCATE (R , double, catalog->Nmeasure); 369 377 double *D ; ALLOCATE (D , double, catalog->Nmeasure); 378 float *RoffGAL ; ALLOCATE (RoffGAL , float, catalog->Nmeasure); 379 float *DoffGAL ; ALLOCATE (DoffGAL , float, catalog->Nmeasure); 370 380 float *M ; ALLOCATE (M , float, catalog->Nmeasure); 371 381 float *Mcal ; ALLOCATE (Mcal , float, catalog->Nmeasure); … … 390 400 R[i] = measure[i].R ; 391 401 D[i] = measure[i].D ; 402 RoffGAL[i] = measure[i].RoffGAL ; 403 DoffGAL[i] = measure[i].DoffGAL ; 392 404 M[i] = measure[i].M ; 393 405 Mcal[i] = measure[i].Mcal ; … … 411 423 gfits_set_bintable_column (&theader, &ftable, "RA", R, catalog->Nmeasure); 412 424 gfits_set_bintable_column (&theader, &ftable, "DEC", D, catalog->Nmeasure); 425 gfits_set_bintable_column (&theader, &ftable, "ROFF_GAL", RoffGAL, catalog->Nmeasure); 426 gfits_set_bintable_column (&theader, &ftable, "DOFF_GAL", DoffGAL, catalog->Nmeasure); 413 427 gfits_set_bintable_column (&theader, &ftable, "MAG_SYS", M, catalog->Nmeasure); 414 428 gfits_set_bintable_column (&theader, &ftable, "MAG_CAL", Mcal, catalog->Nmeasure); … … 430 444 free (R ); 431 445 free (D ); 446 free (RoffGAL ); 447 free (DoffGAL ); 432 448 free (M ); 433 449 free (Mcal ); -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/ConfigInit.c
r37606 r37655 39 39 if (!ScanConfig (config, "USE_GALAXY_MODEL", "%d", 0, &USE_GALAXY_MODEL)) USE_GALAXY_MODEL = FALSE; 40 40 if (!ScanConfig (config, "USE_ICRF_CORRECT", "%d", 0, &USE_ICRF_CORRECT)) USE_ICRF_CORRECT = FALSE; 41 if (!ScanConfig (config, "USE_ICRF_LOCAL", "%d", 0, &USE_ICRF_LOCAL)) USE_ICRF_LOCAL = FALSE; 42 if (!ScanConfig (config, "USE_ICRF_SHFIT", "%d", 0, &USE_ICRF_SHFIT)) USE_ICRF_SHFIT = FALSE; 41 43 42 44 // force CATDIR to be absolute (so parallel mode will work) -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/FrameCorrection.c
r37649 r37655 98 98 FrameCorrectionType *frame = NULL; 99 99 100 # define LOCAL_FRAME 0101 # define SH_FRAME 1102 103 100 int POLE = FALSE; 104 101 105 if ( LOCAL_FRAME) {102 if (USE_ICRF_LOCAL) { 106 103 // for the local frame correction, we are going to convert R,D into 107 104 // X,Y linear coordinates in an 'image' centered on the field center. … … 140 137 } 141 138 142 if ( SH_FRAME) {139 if (USE_ICRF_SHFIT) { 143 140 // Lmax in recipe 144 141 int Lmax = 20; … … 611 608 if (dP > dPmax) mask[i] = 1; 612 609 if (isnan(dP)) mask[i] = 1; 613 if ( mask[i]) Nkeep++;610 if (!mask[i]) Nkeep++; 614 611 } 615 612 fprintf (stderr, "keeping %d of %d points\n", Nkeep, Npts); … … 703 700 double dX = AstromOffsetMapValue (map, Xave, Yave, TRUE); 704 701 double dY = AstromOffsetMapValue (map, Xave, Yave, FALSE); 705 double Xmeas = Xave - dX; 706 double Ymeas = Yave - dY; 707 XY_to_RD (&average->R, &average->D, Xmeas, Ymeas, coords); 702 if (!isnan(dX) && !isnan(dY)) { 703 double Xmeas = Xave - dX; 704 double Ymeas = Yave - dY; 705 XY_to_RD (&average->R, &average->D, Xmeas, Ymeas, coords); 706 } 708 707 } else { 709 708 myAssert (frame, "no frame correction defined"); -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/ICRF.c
r37622 r37655 48 48 return TRUE; 49 49 } 50 51 int select_catalog_ICRF (Catalog *catalog, int Ncatalog) { 52 53 if (!USE_ICRF_CORRECT) return TRUE; 54 55 int N = 0; 56 57 char filename[1024]; 58 snprintf (filename, 1024, "%s/test.icrf.dat", CATDIR); 59 FILE *f = fopen (filename, "w"); 60 61 int c, i, j; 62 for (c = 0; c < Ncatalog; c++) { 63 64 for (i = 0; i < catalog[c].Naverage; i++) { 65 if (!(catalog[c].average[i].flags & ID_ICRF_QSO)) continue; 66 67 // only save a single value 68 int savedICRF = FALSE; 69 for (j = 0; j < catalog[c].average[i].Nmeasure; j++) { 70 71 int offset = catalog[c].average[i].measureOffset + j; 72 73 if (!(catalog[c].measureT[offset].dbFlags & ID_MEAS_ICRF_QSO)) continue; 74 75 fprintf (f, "%d %d %d : %f %f : %f %f\n", c, i, offset, 76 catalog[c].average[i].R, catalog[c].average[i].D, 77 catalog[c].measureT[offset].R, catalog[c].measureT[offset].D); 78 79 if (savedICRF) continue; 80 81 ICRFsave (c, i, offset); 82 N ++; 83 savedICRF = TRUE; 84 } 85 } 86 } 87 fclose (f); 88 89 fprintf (stderr, "added %d ICRF QSO\n", N); 90 91 return TRUE; 92 } -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/bcatalog.c
r37649 r37655 19 19 int LimitDensityCatalog_ByNmeasureGrid (Catalog *subcatalog, Catalog *oldcatalog); 20 20 21 int bcatalog (Catalog *subcatalog, Catalog *catalog , int Nsubcatalog) {21 int bcatalog (Catalog *subcatalog, Catalog *catalog) { 22 22 23 23 off_t i, j, offset; … … 61 61 } 62 62 63 int Nicrf = 0;64 65 char filename[1024];66 snprintf (filename, 1024, "%s/test.icrf.dat", CATDIR);67 FILE *f = fopen (filename, "a");68 69 63 /* exclude stars not in range or with too few measurements */ 70 64 for (i = 0; i < catalog[0].Naverage; i++) { … … 84 78 } 85 79 86 // if we want to do static correction to ICRF, keep the ICRF QSOs 80 // if we want to do static correction to ICRF, keep the ICRF QSOs (regardless of other data quality) 87 81 if (USE_ICRF_CORRECT && (subcatalog[0].average[Naverage].flags & ID_ICRF_QSO)) { 88 82 Nm = 0; 89 int savedICRF = FALSE;90 83 for (j = 0; j < catalog[0].average[i].Nmeasure; j++) { 91 84 … … 101 94 } 102 95 103 // we need to save the location of the ICRF QSOs in the database104 if (subcatalog[0].measureT[Nmeasure].dbFlags & ID_MEAS_ICRF_QSO) {105 if (!savedICRF) {106 ICRFsave (Nsubcatalog, Naverage, Nmeasure);107 fprintf (f, "%d %d %d : %f %f : %f %f\n", (int) Nsubcatalog, (int) Naverage, (int) Nmeasure,108 catalog[0].average[i].R, catalog[0].average[i].D,109 catalog[0].measure[offset].R, catalog[0].measure[offset].D);110 Nicrf ++;111 savedICRF = TRUE;112 }113 }114 115 96 Nmeasure ++; 116 97 Nm ++; … … 236 217 assert (Nsecfilt == catalog[0].Nsecfilt); 237 218 238 fclose (f);239 240 219 // limit the total number of stars in the catalog 241 220 if (MaxDensityUse) { … … 253 232 } 254 233 255 // fprintf (stderr, "added %d ICRF QSO\n", Nicrf);256 257 234 return (TRUE); 258 235 } -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/load_catalogs.c
r37649 r37655 19 19 20 20 ALLOCATE (catalog, Catalog, skylist[0].Nregions); 21 22 if (subselect && USE_GALAXY_MODEL) {23 char filename[1024];24 snprintf (filename, 1024, "%s/test.icrf.dat", CATDIR);25 unlink (filename);26 }27 21 28 22 // load data from each region file, only use bright stars … … 74 68 // results are in Average, Secfilt, and MeasureTiny 75 69 // Ncat tracks the actually used catalogs 76 bcatalog (&catalog[Ncat], &tcatalog , Ncat);70 bcatalog (&catalog[Ncat], &tcatalog); 77 71 dvo_catalog_unlock (&tcatalog); 78 72 dvo_catalog_free (&tcatalog); -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/relastro_images.c
r37649 r37655 33 33 catalog = load_catalogs (skylist, &Ncatalog, TRUE, 0, NULL, NULL); 34 34 MARKTIME("load catalog data: %f sec\n", dtime); 35 36 // find ICRF QSOs for reference downstream (only if USE_ICRF_CORRECT) 37 select_catalog_ICRF (catalog, Ncatalog); 35 38 36 39 if (photcodesReset) { … … 72 75 case TARGET_CHIPS: 73 76 for (i = 0; i < NLOOP; i++) { 74 // XXX is is really possible that I do not update the measure.R,D on each loop??75 77 UpdateObjects (catalog, Ncatalog, (i > 0)); // calculate <R>,<D>; if (i > 0), apply Galaxy Motion Model (if desired) 76 78 if ((i > 1) || !USE_GALAXY_MODEL) { -
branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/relastro_parallel_images.c
r37606 r37655 87 87 case TARGET_CHIPS: 88 88 for (i = 0; i < NLOOP; i++) { 89 UpdateObjects (catalog, Ncatalog, i);89 UpdateObjects (catalog, Ncatalog, (i > 0)); 90 90 share_mean_pos (catalog, Ncatalog, regionHosts, i); 91 // XXX FrameCorrection (catalog, Ncatalog); -- this needs to happen on the master machine? 91 92 slurp_mean_pos (catalog, Ncatalog, regionHosts, i); 92 93 UpdateChips (catalog, Ncatalog);
Note:
See TracChangeset
for help on using the changeset viewer.
