IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37655


Ignore:
Timestamp:
Nov 20, 2014, 8:34:19 PM (12 years ago)
Author:
eugene
Message:

fix parallel relastro load catalog, move load icrf out of bcatalog

Location:
branches/eam_branches/ipp-20140904/Ohana/src/relastro
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/include/relastro.h

    r37622 r37655  
    200200int    USE_GALAXY_MODEL;
    201201int    USE_ICRF_CORRECT;
     202
     203int    USE_ICRF_LOCAL;
     204int    USE_ICRF_SHFIT;
    202205
    203206int    RESET;
     
    285288int           args                PROTO((int argc, char **argv));
    286289int           args_client         PROTO((int argc, char **argv));
    287 int           bcatalog            PROTO((Catalog *subcatalog, Catalog *catalog, int Nsubcatalog));
     290int           bcatalog            PROTO((Catalog *subcatalog, Catalog *catalog));
    288291void          clean_images        PROTO((void));
    289292void          clean_measures      PROTO((Catalog *catalog, int Ncatalog, int final));
     
    573576int ICRFdata (int n, int *cat, int *ave, int *meas);
    574577int ICRFmax ();
     578int select_catalog_ICRF (Catalog *catalog, int Ncatalog);
    575579
    576580FrameCorrectionType *FrameCorrectionInit (double scale);
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/BrightCatalog.c

    r37038 r37655  
    7070    GET_COLUMN(R,         "RA",         double);
    7171    GET_COLUMN(D,         "DEC",        double);
     72    GET_COLUMN(RoffGAL,   "ROFF_GAL",   float);
     73    GET_COLUMN(DoffGAL,   "DOFF_GAL",   float);
    7274    GET_COLUMN(M,         "MAG_SYS",    float);
    7375    GET_COLUMN(Mcal,      "MAG_CAL",    float);
     
    9496      measure[i].R         = R[i];
    9597      measure[i].D         = D[i];
     98      measure[i].RoffGAL   = RoffGAL[i];
     99      measure[i].DoffGAL   = DoffGAL[i];
    96100      measure[i].M         = M[i];
    97101      measure[i].Mcal      = Mcal[i];
     
    115119    free (R       );
    116120    free (D       );
     121    free (RoffGAL );
     122    free (DoffGAL );
    117123    free (M       );
    118124    free (Mcal    );
     
    343349    gfits_create_table_header (&theader, "BINTABLE", "MEASURE_TINY");
    344350
    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);
    347355    gfits_define_bintable_column (&theader, "E", "MAG_SYS",  "magnitude (sys)",             NULL,    1.0, 0.0);
    348356    gfits_define_bintable_column (&theader, "E", "MAG_CAL",  "magnitude (cal)",             NULL,    1.0, 0.0);
     
    368376    double *R         ; ALLOCATE (R        ,  double, catalog->Nmeasure);
    369377    double *D         ; ALLOCATE (D        ,  double, catalog->Nmeasure);
     378    float  *RoffGAL   ; ALLOCATE (RoffGAL  ,  float,  catalog->Nmeasure);
     379    float  *DoffGAL   ; ALLOCATE (DoffGAL  ,  float,  catalog->Nmeasure);
    370380    float  *M         ; ALLOCATE (M        ,  float,  catalog->Nmeasure);
    371381    float  *Mcal      ; ALLOCATE (Mcal     ,  float,  catalog->Nmeasure);
     
    390400      R[i]        = measure[i].R        ;
    391401      D[i]        = measure[i].D        ;
     402      RoffGAL[i]  = measure[i].RoffGAL  ;
     403      DoffGAL[i]  = measure[i].DoffGAL  ;
    392404      M[i]        = measure[i].M        ;
    393405      Mcal[i]     = measure[i].Mcal     ;
     
    411423    gfits_set_bintable_column (&theader, &ftable, "RA",         R,         catalog->Nmeasure);
    412424    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);
    413427    gfits_set_bintable_column (&theader, &ftable, "MAG_SYS",    M,         catalog->Nmeasure);
    414428    gfits_set_bintable_column (&theader, &ftable, "MAG_CAL",    Mcal,      catalog->Nmeasure);
     
    430444    free (R       );
    431445    free (D       );
     446    free (RoffGAL );
     447    free (DoffGAL );
    432448    free (M       );
    433449    free (Mcal    );
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/ConfigInit.c

    r37606 r37655  
    3939  if (!ScanConfig (config, "USE_GALAXY_MODEL",    "%d", 0, &USE_GALAXY_MODEL))     USE_GALAXY_MODEL = FALSE;
    4040  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;
    4143
    4244  // force CATDIR to be absolute (so parallel mode will work)
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/FrameCorrection.c

    r37649 r37655  
    9898  FrameCorrectionType *frame = NULL;
    9999
    100 # define LOCAL_FRAME 0
    101 # define SH_FRAME 1
    102 
    103100  int POLE = FALSE;
    104101
    105   if (LOCAL_FRAME) {
     102  if (USE_ICRF_LOCAL) {
    106103    // for the local frame correction, we are going to convert R,D into
    107104    // X,Y linear coordinates in an 'image' centered on the field center.
     
    140137  }
    141138
    142   if (SH_FRAME) {
     139  if (USE_ICRF_SHFIT) {
    143140    // Lmax in recipe
    144141    int Lmax = 20;
     
    611608      if (dP > dPmax) mask[i] = 1;
    612609      if (isnan(dP)) mask[i] = 1;
    613       if (mask[i]) Nkeep++;
     610      if (!mask[i]) Nkeep++;
    614611    }
    615612    fprintf (stderr, "keeping %d of %d points\n", Nkeep, Npts);
     
    703700        double dX = AstromOffsetMapValue (map, Xave, Yave, TRUE);
    704701        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        }
    708707      } else {
    709708        myAssert (frame, "no frame correction defined");
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/ICRF.c

    r37622 r37655  
    4848  return TRUE;
    4949}
     50
     51int 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  
    1919int LimitDensityCatalog_ByNmeasureGrid (Catalog *subcatalog, Catalog *oldcatalog);
    2020
    21 int bcatalog (Catalog *subcatalog, Catalog *catalog, int Nsubcatalog) {
     21int bcatalog (Catalog *subcatalog, Catalog *catalog) {
    2222
    2323  off_t i, j, offset;
     
    6161  }
    6262
    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 
    6963  /* exclude stars not in range or with too few measurements */
    7064  for (i = 0; i < catalog[0].Naverage; i++) {
     
    8478    }
    8579
    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)
    8781    if (USE_ICRF_CORRECT && (subcatalog[0].average[Naverage].flags & ID_ICRF_QSO)) {
    8882      Nm = 0;
    89       int savedICRF = FALSE;
    9083      for (j = 0; j < catalog[0].average[i].Nmeasure; j++) {
    9184         
     
    10194        }
    10295         
    103         // we need to save the location of the ICRF QSOs in the database
    104         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 
    11596        Nmeasure ++;
    11697        Nm ++;
     
    236217  assert (Nsecfilt == catalog[0].Nsecfilt);
    237218
    238   fclose (f);
    239 
    240219// limit the total number of stars in the catalog
    241220  if (MaxDensityUse) {
     
    253232  }
    254233
    255   // fprintf (stderr, "added %d ICRF QSO\n", Nicrf);
    256  
    257234  return (TRUE);
    258235}
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/load_catalogs.c

    r37649 r37655  
    1919
    2020  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   }
    2721
    2822  // load data from each region file, only use bright stars
     
    7468      // results are in Average, Secfilt, and MeasureTiny
    7569      // Ncat tracks the actually used catalogs
    76       bcatalog (&catalog[Ncat], &tcatalog, Ncat);
     70      bcatalog (&catalog[Ncat], &tcatalog);
    7771      dvo_catalog_unlock (&tcatalog);
    7872      dvo_catalog_free (&tcatalog);
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/relastro_images.c

    r37649 r37655  
    3333  catalog = load_catalogs (skylist, &Ncatalog, TRUE, 0, NULL, NULL);
    3434  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);
    3538
    3639  if (photcodesReset) {
     
    7275    case TARGET_CHIPS:
    7376      for (i = 0; i < NLOOP; i++) {
    74         // XXX is is really possible that I do not update the measure.R,D on each loop??
    7577        UpdateObjects (catalog, Ncatalog, (i > 0)); // calculate <R>,<D>; if (i > 0), apply Galaxy Motion Model (if desired)
    7678        if ((i > 1) || !USE_GALAXY_MODEL) {
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/relastro_parallel_images.c

    r37606 r37655  
    8787    case TARGET_CHIPS:
    8888      for (i = 0; i < NLOOP; i++) {
    89         UpdateObjects (catalog, Ncatalog, i);
     89        UpdateObjects (catalog, Ncatalog, (i > 0));
    9090        share_mean_pos (catalog, Ncatalog, regionHosts, i);
     91        // XXX FrameCorrection (catalog, Ncatalog); -- this needs to happen on the master machine?
    9192        slurp_mean_pos (catalog, Ncatalog, regionHosts, i);
    9293        UpdateChips (catalog, Ncatalog);
Note: See TracChangeset for help on using the changeset viewer.