IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 24, 2005, 8:51:56 AM (21 years ago)
Author:
eugene
Message:

adding internal vs external formats for average, measure, secfilt

Location:
trunk/Ohana/src/addstar/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/src/calibrate.c

    r3361 r4865  
    6060    if (measure[0].source == CalC0) {
    6161      found0 = TRUE;
    62       CalM0  = measure[i].M;
    63       dCalM  = measure[i].dM;
     62      CalM0  = measure[i].M_PS;
     63      dCalM  = measure[i].dM_PS;
    6464    }
    6565    if (measure[i].source == CalC1) {
    6666      found1 = TRUE;
    67       CalM1  = measure[i].M;
     67      CalM1  = measure[i].M_PS;
    6868    }
    6969    if (measure[i].source == CalC2) {
    7070      found2 = TRUE;
    71       CalM2  = measure[i].M;
     71      CalM2  = measure[i].M_PS;
    7272    }
    7373    if (found0 && found1 && found2) {
    74       SaveCalibration (new[0].M, new[0].dM, CalM0, dCalM, CalM1-CalM2, new[0].airmass, Nstar);
     74      SaveCalibration (new[0].M_PS, new[0].dM_PS, CalM0, dCalM, CalM1-CalM2, new[0].airmass_PS, Nstar);
    7575      return;
    7676    }
    … …  
    8383
    8484  int i, MaxN, *Nlist, Nkeep;
    85   short int Mint;
     85  float Mint;
    8686  float N, M1, M2, Klam, Clam, Xlam, Mabs, *Dmag, *dDmag;
    8787  float dMo, dMr, Mw, Dmed, W1, W2, NSigma;
    … …  
    110110  ALLOCATE (dDmag, float, Ncal);
    111111  Nkeep = 0;
     112  Clam = thiscode[0].C*0.001;
    112113  Klam = thiscode[0].K;
    113   Clam = thiscode[0].C;
    114114  Xlam = thiscode[0].X[0];
    115115  for (i = 0; i < Ncal; i++) {
    116116    /* if this entry has too many (or two few?) matches, skip it */
    117117    if (Nlist[Nstar[i]] != 1) continue;
    118     Mint = Clam + Mobs[i] + Xlam*Cref[i] + Klam*(Airm[i] - 1000);
    119     Mabs = 0.001*Mint - ZeroPt;
     118    Mint = Clam + Mobs[i] + Xlam*Cref[i] + Klam*(Airm[i] - 1.000);
     119    Mabs = Mint - ZeroPt;
    120120    /* note: subpix correction is applied in gstars */
    121121
    … …  
    126126    }
    127127   
    128     dMr = MAX (0.005, 0.001*dMref[i]);
    129     dMo = MAX (0.005, 0.001*dMobs[i]);
     128    /* XXX EAM: note the artificial 0.005 dmag here */
     129    dMr = MAX (0.005, dMref[i]);
     130    dMo = MAX (0.005, dMobs[i]);
    130131
    131     Dmag[Nkeep] = (Mabs - 0.001*Mref[i]);
     132    Dmag[Nkeep] = (Mabs - Mref[i]);
    132133    dDmag[Nkeep] = (dMr*dMr + dMo*dMo);
    133134    Nkeep ++;
    … …  
    178179  }
    179180}
     181
     182/*** image.Mcal is still in millimags ***/
  • trunk/Ohana/src/addstar/src/find_matches.c

    r4825 r4865  
    1313  Coords tcoords;
    1414  int Nsecfilt, Nsec, MTIME;
    15   short int Mcat, *Mval;
     15  float Mcat, *Mval;
    1616
    1717  /* photcode data - must by of type DEP, (PRI, SEC) - probably should restrict to DEP */
    … …  
    103103  /* correct instrumental mags for exposure time */
    104104  if (image[0].exptime > 0) {
    105     MTIME = 2500*log10(image[0].exptime);
     105    MTIME = 2.500*log10(image[0].exptime);
    106106  } else {
    107107    MTIME = 0;
    … …  
    149149      catalog[0].measure[Nmeas].dR_PS       = 3600.0*(catalog[0].average[n].R_PS - stars[N].R);
    150150      catalog[0].measure[Nmeas].dD_PS       = 3600.0*(catalog[0].average[n].D_PS - stars[N].D);
    151       catalog[0].measure[Nmeas].M        = MIN (1000*stars[N].M + MTIME, NO_MAG);
    152       catalog[0].measure[Nmeas].dM       = MIN (1000*stars[N].dM, NO_ERR);  /* error in input files stored in thousandths of mag */
    153       catalog[0].measure[Nmeas].Mcal     = image[0].Mcal;
    154       catalog[0].measure[Nmeas].t        = image[0].tzero + 1e-4*stars[N].Y*image[0].trate;  /* trate is in 0.1 msec / row */
    155       catalog[0].measure[Nmeas].averef   = n;
    156       catalog[0].measure[Nmeas].source   = stars[N].code;  /* photcode */
    157       catalog[0].measure[Nmeas].dophot   = stars[N].dophot; 
    158       catalog[0].measure[Nmeas].flags    = 0;
    159       catalog[0].measure[Nmeas].dt       = MTIME;
    160       catalog[0].measure[Nmeas].airmass  = secz;
    161 
    162       catalog[0].measure[Nmeas].Mgal     = MIN (1000*stars[N].Mgal + MTIME, NO_MAG);
    163       catalog[0].measure[Nmeas].FWx      = MIN (100*stars[N].fx, NO_MAG);
    164       catalog[0].measure[Nmeas].fwy      = MIN (100*(stars[N].fy / stars[N].fx), NO_ERR);
    165       catalog[0].measure[Nmeas].theta    = MIN ((255/360)*stars[N].df, NO_ERR);
     151      catalog[0].measure[Nmeas].M_PS        = MIN (stars[N].M + MTIME, NO_MAG);
     152      catalog[0].measure[Nmeas].dM_PS       = MIN (stars[N].dM, NO_ERR);  /* error in input files stored in thousandths of mag */
     153      catalog[0].measure[Nmeas].Mcal_PS     = 0.001*image[0].Mcal; /* XXX image.Mcal still millimags */
     154      catalog[0].measure[Nmeas].t           = image[0].tzero + 1e-4*stars[N].Y*image[0].trate;  /* trate is in 0.1 msec / row */
     155      catalog[0].measure[Nmeas].averef      = n;
     156      catalog[0].measure[Nmeas].source      = stars[N].code;  /* photcode */
     157      catalog[0].measure[Nmeas].dophot      = stars[N].dophot; 
     158      catalog[0].measure[Nmeas].flags       = 0;
     159      catalog[0].measure[Nmeas].dt_PS       = MTIME;
     160      catalog[0].measure[Nmeas].airmass_PS  = secz;
     161
     162      catalog[0].measure[Nmeas].Mgal_PS     = MIN (stars[N].Mgal + MTIME, NO_MAG);
     163      catalog[0].measure[Nmeas].FWx         = MIN (100*stars[N].fx, NO_MAG);
     164      catalog[0].measure[Nmeas].FWy         = MIN (100*stars[N].fy, NO_MAG);
     165      catalog[0].measure[Nmeas].theta       = MIN ((255/360)*stars[N].df, NO_ERR);
    166166       
    167167      /* it is not valid to pass PRI/SEC/REF photcodes to this routine */
    168168      /* check for entries in the secfilt lists */
    169       Mcat = iPhotCat (&catalog[0].measure[Nmeas]);
    170       Mval = (Nsec == -1) ? &catalog[0].average[n].M : &catalog[0].secfilt[n*Nsecfilt+Nsec].M;
     169      Mcat = PhotCat (&catalog[0].measure[Nmeas]);
     170      Mval = (Nsec == -1) ? &catalog[0].average[n].M_PS : &catalog[0].secfilt[n*Nsecfilt+Nsec].M_PS;
    171171      if (*Mval == NO_MAG) *Mval = Mcat;
    172172
    … …  
    254254    secz = airmass (image[0].secz, stars[N].R, stars[N].D, SiderealTime, Latitude);
    255255
    256     catalog[0].average[Nave].R_PS              = stars[N].R;
    257     catalog[0].average[Nave].D_PS              = stars[N].D;
    258     catalog[0].average[Nave].M         = NO_MAG;
    259     catalog[0].average[Nave].dM        = NO_MAG;
     256    catalog[0].average[Nave].R_PS      = stars[N].R;
     257    catalog[0].average[Nave].D_PS      = stars[N].D;
     258    catalog[0].average[Nave].M_PS      = NO_MAG;
     259    catalog[0].average[Nave].dM_PS     = NO_MAG;
    260260    catalog[0].average[Nave].Nm        = 1;
    261261    catalog[0].average[Nave].Nn        = 0;
    … …  
    268268
    269269    for (j = 0; j < Nsecfilt; j++) {
    270       catalog[0].secfilt[Nave*Nsecfilt+j].M  = NO_MAG;
    271       catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NO_MAG;
    272       catalog[0].secfilt[Nave*Nsecfilt+j].dM = NO_MAG;
     270      catalog[0].secfilt[Nave*Nsecfilt+j].M_PS  = NO_MAG;
     271      catalog[0].secfilt[Nave*Nsecfilt+j].dM_PS = NO_MAG;
     272      catalog[0].secfilt[Nave*Nsecfilt+j].Xm    = NO_MAG;
    273273    }
    274274
    275275    catalog[0].measure[Nmeas].dR_PS       = 0.0;
    276276    catalog[0].measure[Nmeas].dD_PS       = 0.0;
    277     catalog[0].measure[Nmeas].M        = MIN (1000*stars[N].M + MTIME, NO_MAG);
    278     catalog[0].measure[Nmeas].dM       = MIN (1000*stars[N].dM, NO_ERR);
    279     catalog[0].measure[Nmeas].Mcal     = image[0].Mcal;
    280     catalog[0].measure[Nmeas].t        = image[0].tzero + 1e-4*stars[N].Y*image[0].trate; /* trate is in 0.1 msec / row */
    281     catalog[0].measure[Nmeas].averef   = Nave;
    282     catalog[0].measure[Nmeas].source   = stars[N].code;  /* photcode */
    283     catalog[0].measure[Nmeas].dophot   = stars[N].dophot; 
    284     catalog[0].measure[Nmeas].flags    = 0;
    285     catalog[0].measure[Nmeas].dt       = MTIME;
    286     catalog[0].measure[Nmeas].airmass  = secz;
    287 
    288     catalog[0].measure[Nmeas].Mgal     = MIN (1000*stars[N].Mgal + MTIME, NO_MAG);
    289     catalog[0].measure[Nmeas].FWx      = MIN (100*stars[N].fx, NO_MAG);
    290     catalog[0].measure[Nmeas].fwy      = MIN (100*(stars[N].fy / stars[N].fx), NO_ERR);
    291     catalog[0].measure[Nmeas].theta    = MIN ((255/360)*stars[N].df, NO_ERR);
    292 
    293     Mcat = iPhotCat (&catalog[0].measure[Nmeas]);
    294     Mval = (Nsec == -1) ? &catalog[0].average[Nave].M : &catalog[0].secfilt[Nave*Nsecfilt+Nsec].M;
     277    catalog[0].measure[Nmeas].M_PS        = MIN (stars[N].M + MTIME, NO_MAG);
     278    catalog[0].measure[Nmeas].dM_PS       = MIN (stars[N].dM, NO_ERR);
     279    catalog[0].measure[Nmeas].Mcal_PS     = 0.001*image[0].Mcal;
     280    catalog[0].measure[Nmeas].t           = image[0].tzero + 1e-4*stars[N].Y*image[0].trate; /* trate is in 0.1 msec / row */
     281    catalog[0].measure[Nmeas].averef      = Nave;
     282    catalog[0].measure[Nmeas].source      = stars[N].code;  /* photcode */
     283    catalog[0].measure[Nmeas].dophot      = stars[N].dophot; 
     284    catalog[0].measure[Nmeas].flags       = 0;
     285    catalog[0].measure[Nmeas].dt_PS       = MTIME;
     286    catalog[0].measure[Nmeas].airmass_PS  = secz;
     287
     288    catalog[0].measure[Nmeas].Mgal_PS     = MIN (stars[N].Mgal + MTIME, NO_MAG);
     289    catalog[0].measure[Nmeas].FWx         = MIN (100*stars[N].fx, NO_MAG);
     290    catalog[0].measure[Nmeas].FWy         = MIN (100*stars[N].fy, NO_MAG);
     291    catalog[0].measure[Nmeas].theta       = MIN ((255/360)*stars[N].df, NO_ERR);
     292
     293    Mcat = PhotCat (&catalog[0].measure[Nmeas]);
     294    Mval = (Nsec == -1) ? &catalog[0].average[Nave].M_PS : &catalog[0].secfilt[Nave*Nsecfilt+Nsec].M_PS;
    295295    if (*Mval == NO_MAG) *Mval = Mcat;
    296296
  • trunk/Ohana/src/addstar/src/find_matches_refstars.c

    r4800 r4865  
    130130      catalog[0].measure[Nmeas].dR_PS       = 3600.0*(catalog[0].average[n].R_PS - stars[N][0].R);
    131131      catalog[0].measure[Nmeas].dD_PS       = 3600.0*(catalog[0].average[n].D_PS - stars[N][0].D);
    132       catalog[0].measure[Nmeas].M        = MIN (1000*stars[N][0].M,  NO_MAG);
    133       catalog[0].measure[Nmeas].dM       = MIN (1000*stars[N][0].dM, NO_ERR);
    134       catalog[0].measure[Nmeas].Mcal     = 0;
     132      catalog[0].measure[Nmeas].M_PS        = MIN (stars[N][0].M,  NO_MAG);
     133      catalog[0].measure[Nmeas].dM_PS       = MIN (stars[N][0].dM, NO_ERR);
     134      catalog[0].measure[Nmeas].Mcal_PS     = 0;
    135135      catalog[0].measure[Nmeas].t        = (TIMEREF == 0) ? stars[N][0].t : TIMEREF; /** careful : time_t vs e_time **/
    136136      catalog[0].measure[Nmeas].averef   = n;
    … …  
    138138      catalog[0].measure[Nmeas].dophot   = 0;
    139139      catalog[0].measure[Nmeas].flags    = 0;
    140       catalog[0].measure[Nmeas].dt       = 0xffff;
    141 
    142       catalog[0].measure[Nmeas].Mgal     = NO_MAG;
    143       catalog[0].measure[Nmeas].airmass  = 0;
    144       catalog[0].measure[Nmeas].FWx      = NO_MAG;
    145       catalog[0].measure[Nmeas].fwy      = 0xff;
    146       catalog[0].measure[Nmeas].theta    = 0xff;
     140      catalog[0].measure[Nmeas].dt_PS    = 0xffff;
     141
     142      catalog[0].measure[Nmeas].Mgal_PS     = NO_MAG;
     143      catalog[0].measure[Nmeas].airmass_PS  = 0;
     144      catalog[0].measure[Nmeas].FWx         = NO_MAG;
     145      catalog[0].measure[Nmeas].FWy         = NO_MAG;
     146      catalog[0].measure[Nmeas].theta       = NO_ERR;
    147147       
    148148      /** don't update average / secfilt values for REF photcodes **/
    … …  
    195195    catalog[0].average[Nave].R_PS         = stars[N][0].R;
    196196    catalog[0].average[Nave].D_PS         = stars[N][0].D;
    197     catalog[0].average[Nave].M         = NO_MAG;
    198     catalog[0].average[Nave].dM        = NO_MAG;
     197    catalog[0].average[Nave].M_PS         = NO_MAG;
     198    catalog[0].average[Nave].dM_PS        = NO_MAG;
    199199    catalog[0].average[Nave].Nm        = 1;
    200200    catalog[0].average[Nave].Nn        = 0;
    … …  
    207207
    208208    for (j = 0; j < Nsecfilt; j++) {
    209       catalog[0].secfilt[Nave*Nsecfilt+j].M  = NO_MAG;
    210       catalog[0].secfilt[Nave*Nsecfilt+j].Xm = NO_MAG;
    211       catalog[0].secfilt[Nave*Nsecfilt+j].dM = NO_MAG;
     209      catalog[0].secfilt[Nave*Nsecfilt+j].M_PS  = NO_MAG;
     210      catalog[0].secfilt[Nave*Nsecfilt+j].dM_PS = NO_MAG;
     211      catalog[0].secfilt[Nave*Nsecfilt+j].Xm    = NO_MAG;
    212212    }
    213213
    214214    catalog[0].measure[Nmeas].dR_PS       = 0.0;
    215215    catalog[0].measure[Nmeas].dD_PS       = 0.0;
    216     catalog[0].measure[Nmeas].M        = MIN (1000*stars[N][0].M,  NO_MAG);
    217     catalog[0].measure[Nmeas].dM       = MIN (1000*stars[N][0].dM, NO_ERR);
    218     catalog[0].measure[Nmeas].Mcal     = 0;
     216    catalog[0].measure[Nmeas].M_PS        = MIN (stars[N][0].M,  NO_MAG);
     217    catalog[0].measure[Nmeas].dM_PS       = MIN (stars[N][0].dM, NO_ERR);
     218    catalog[0].measure[Nmeas].Mcal_PS     = 0;
    219219    catalog[0].measure[Nmeas].t        = (stars[N][0].t == 0) ? TIMEREF : stars[N][0].t; /** careful : time_t vs e_time **/
    220220    catalog[0].measure[Nmeas].averef   = Nave;
    … …  
    222222    catalog[0].measure[Nmeas].dophot   = 0;
    223223    catalog[0].measure[Nmeas].flags    = 0;
    224     catalog[0].measure[Nmeas].dt       = 0xffff;
    225 
    226     catalog[0].measure[Nmeas].Mgal     = NO_MAG;
    227     catalog[0].measure[Nmeas].airmass  = 0;
    228     catalog[0].measure[Nmeas].FWx      = NO_MAG;
    229     catalog[0].measure[Nmeas].fwy      = 0xff;
    230     catalog[0].measure[Nmeas].theta    = 0xff;
     224    catalog[0].measure[Nmeas].dt_PS       = 0xffff;
     225
     226    catalog[0].measure[Nmeas].Mgal_PS     = NO_MAG;
     227    catalog[0].measure[Nmeas].airmass_PS  = 0;
     228    catalog[0].measure[Nmeas].FWx         = NO_MAG;
     229    catalog[0].measure[Nmeas].FWy         = NO_ERR;
     230    catalog[0].measure[Nmeas].theta       = NO_ERR;
    231231
    232232    stars[N][0].found = Nmeas;
  • trunk/Ohana/src/addstar/src/gcatalog.c

    r4826 r4865  
    2828    for (in = out = i = 0; i < catalog[0].Naverage; i++) {
    2929      for (j = 0; j < catalog[0].Nsecfilt; j++, in++, out++) {
    30         outsec[out].M  = insec[in].M;
     30        outsec[out].M_PS  = insec[in].M_PS;
     31        outsec[out].dM_PS = insec[in].dM_PS;
    3132        outsec[out].Xm = insec[in].Xm;
    32         outsec[out].dM = insec[in].dM;
    3333      }
    3434      for (j = 0; j < Nextra; j++, out++) {
    35         outsec[out].M  = NO_MAG;
    36         outsec[out].Xm = NO_MAG;
    37         outsec[out].dM = NO_MAG;
     35        outsec[out].M_PS  = NO_MAG;
     36        outsec[out].dM_PS = NO_MAG;
     37        outsec[out].Xm    = NO_MAG;
    3838      }
    3939    }
  • trunk/Ohana/src/addstar/src/replace_match.c

    r4800 r4865  
    1212    measure[i].dR_PS       = 3600.0*(average[0].R_PS - star[0].R);
    1313    measure[i].dD_PS       = 3600.0*(average[0].D_PS - star[0].D);
    14     measure[i].M        = MIN (1000*star[0].M,  NO_MAG);
    15     measure[i].dM       = MIN (1000*star[0].dM, NO_ERR);
     14    measure[i].M_PS        = MIN (star[0].M,  NO_MAG);
     15    measure[i].dM_PS       = MIN (star[0].dM, NO_ERR);
    1616    star[0].found      = average[0].offset + i;
    1717    return (TRUE);
Note: See TracChangeset for help on using the changeset viewer.