IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4865


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
Files:
2 added
44 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);
  • trunk/Ohana/src/delstar/src/gcatalog.c

    r4832 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;
    31         outsec[out].Xm = insec[in].Xm;
     30        outsec[out].M_PS  = insec[in].M_PS;
     31        outsec[out].dM_PS = insec[in].dM_PS;
     32        outsec[out].Xm    = insec[in].Xm;
    3233      }
    3334      for (j = 0; j < Nextra; j++, out++) {
    34         outsec[out].M = NO_MAG;
    35         outsec[out].Xm = NO_MAG;
     35        outsec[out].M_PS  = NO_MAG;
     36        outsec[out].dM_PS = NO_ERR;
     37        outsec[out].Xm    = NO_MAG;
    3638      }
    3739    }
  • trunk/Ohana/src/gastro/src/gptolemy.c

    r4828 r4865  
    4545    stars[0][nstar].X = catalog.average[i].R_PS;
    4646    stars[0][nstar].Y = catalog.average[i].D_PS;
    47     stars[0][nstar].mag = 0.001*catalog.measure[catalog.average[i].offset].M;
     47    stars[0][nstar].mag = catalog.measure[catalog.average[i].offset].M_PS;
    4848  }
    4949
     
    5454    stars[0][nstar].Y = catalog.average[i].D_PS;
    5555    GotIt = FALSE;
    56     if (catalog.average[i].M != NO_MAG) {
    57       stars[0][nstar].mag = 0.001*catalog.average[i].M;
     56    if (catalog.average[i].M_PS != NO_MAG) {
     57      stars[0][nstar].mag = catalog.average[i].M_PS;
    5858      GotIt = TRUE;
    5959    }
    6060    for (j = 0; !GotIt && (j < Nsec); j++) {
    61       if (catalog.secfilt[i*Nsec + j].M != NO_MAG) {
    62         stars[0][nstar].mag = 0.001*catalog.secfilt[i*Nsec + j].M;
     61      if (catalog.secfilt[i*Nsec + j].M_PS != NO_MAG) {
     62        stars[0][nstar].mag = catalog.secfilt[i*Nsec + j].M_PS;
    6363        GotIt = TRUE;
    6464      }
  • trunk/Ohana/src/gastro2/src/gptolemy2.c

    r4829 r4865  
    4343    stars[nstar].R = catalog.average[i].R_PS;
    4444    stars[nstar].D = catalog.average[i].D_PS;
    45     stars[nstar].M = 0.001*catalog.measure[catalog.average[i].offset].M;
     45    stars[nstar].M = catalog.measure[catalog.average[i].offset].M_PS;
    4646  }
    4747
  • trunk/Ohana/src/libautocode/Makefile

    r4832 r4865  
    2929$(SRC)/average-panstarrs.$(ARCH).o \
    3030$(SRC)/secfilt.$(ARCH).o \
     31$(SRC)/secfilt-elixir.$(ARCH).o \
     32$(SRC)/secfilt-panstarrs.$(ARCH).o \
    3133$(SRC)/measure.$(ARCH).o \
    3234$(SRC)/measure-loneos.$(ARCH).o \
     
    5153$(INC)/average-panstarrs.h \
    5254$(INC)/secfilt.h \
     55$(INC)/secfilt-elixir.h \
     56$(INC)/secfilt-panstarrs.h \
    5357$(INC)/measure.h \
    5458$(INC)/measure-loneos.h \
  • trunk/Ohana/src/libautocode/def/average-elixir.d

    r4832 r4865  
    1212FIELD Nn,             NMISS,      unsigned short,   number of missings
    1313FIELD Xp,             SIGMA_POS,  short,            position scatter,             1/100 arcsec
    14 FIELD Xm,             CHISQ_MAG,  short,            chisq for primary mag,        [1000*value]  ?
     14FIELD Xm,             CHISQ_MAG,  short,            chisq for primary mag,        [100*log(value)]  ?
    1515FIELD code,           code,       unsigned short,   ID code (star, ghost, etc)
    1616FIELD offset,         offset,     int,              offset to first measurement
    1717FIELD missing,        missing,    int,              offset to first missing obs
    18 FIELD dM,             MAG_ERR,    short,            error on primary mag,         [1000*log(value)] ?
     18FIELD dM,             MAG_ERR,    short,            error on primary mag,         millimag
    1919FIELD Xg,             Xg,         short,            best chisq value
  • trunk/Ohana/src/libautocode/def/average-panstarrs.d

    r4501 r4865  
    22EXTNAME DVO_AVERAGE_PANSTARRS
    33TYPE    BINTABLE
    4 SIZE    40
     4SIZE    44
    55
    66# elements of data structure / FITS table
     
    88FIELD R,              RA,         double,           RA,                           decimal degrees
    99FIELD D,              DEC,        double,           DEC,                          decimal degrees
    10 FIELD M,              MAG,        short,            primary mag,                  millimag
     10FIELD M,              MAG,        float,            primary mag,                  mag
     11FIELD dM,             MAG_ERR,    float,            error on primary mag,         mag
     12FIELD Xp,             SIGMA_POS,  short,            position scatter,             1/100 arcsec
     13FIELD Xm,             CHISQ_MAG,  short,            chisq for primary mag,        [100*log(value)]
     14FIELD Xg,             CHISQ_GAL,  short,            chisq for galaxy mag          [100*log(value)]
    1115FIELD Nm,             NMEAS,      unsigned short,   number of measures
    1216FIELD Nn,             NMISS,      unsigned short,   number of missings
    13 FIELD Xp,             SIGMA_POS,  short,            position scatter,             1/100 arcsec
    14 FIELD Xm,             CHISQ_MAG,  short,            chisq for primary mag,        [1000*value]  ?
    1517FIELD code,           code,       unsigned short,   ID code (star, ghost, etc)
    1618FIELD offset,         offset,     int,              offset to first measurement
    1719FIELD missing,        missing,    int,              offset to first missing obs
    18 FIELD dM,             MAG_ERR,    short,            error on primary mag,         [1000*log(value)] ?
    19 FIELD Xg,             Xg,         short,            best chisq value
  • trunk/Ohana/src/libautocode/def/average.d

    r4832 r4865  
    22EXTNAME DVO_AVERAGE
    33TYPE    BINTABLE
    4 SIZE    40
     4SIZE    44
    55
    66# elements of data structure / FITS table
     
    88FIELD R_PS,           RA,         double,           RA,                           decimal degrees
    99FIELD D_PS,           DEC,        double,           DEC,                          decimal degrees
    10 FIELD M,              MAG,        short,            primary mag,                  millimag
     10FIELD M_PS,           MAG,        float,            primary mag,                  mag
     11FIELD dM_PS,          MAG_ERR,    float,            error on primary mag,         mag
     12FIELD Xp,             SIGMA_POS,  short,            position scatter,             1/100 arcsec
     13FIELD Xm,             CHISQ_MAG,  short,            chisq for primary mag,        [100*log(value)]
     14FIELD Xg,             CHISQ_GAL,  short,            chisq for galaxy mags,        [100*log(value)]
    1115FIELD Nm,             NMEAS,      unsigned short,   number of measures
    1216FIELD Nn,             NMISS,      unsigned short,   number of missings
    13 FIELD Xp,             SIGMA_POS,  short,            position scatter,             1/100 arcsec
    14 FIELD Xm,             CHISQ_MAG,  short,            chisq for primary mag,        [1000*value]  ?
    1517FIELD code,           code,       unsigned short,   ID code (star, ghost, etc)
    1618FIELD offset,         offset,     int,              offset to first measurement
    1719FIELD missing,        missing,    int,              offset to first missing obs
    18 FIELD dM,             MAG_ERR,    short,            error on primary mag,         [1000*log(value)] ?
    19 FIELD Xg,             Xg,         short,            best chisq value
  • trunk/Ohana/src/libautocode/def/measure-panstarrs.d

    r4832 r4865  
    22EXTNAME DVO_MEASURE_PANSTARRS
    33TYPE    BINTABLE
    4 SIZE    32
     4SIZE    50
    55
    66# elements of data structure / FITS table
    77
    8 FIELD dR,             D_RA,       short,          RA offset,                      1/100 arcsec
    9 FIELD dD,             D_DEC,      short,          DEC offset,                     1/100 arcsec
    10 FIELD M,              MAG,        short,          catalog mag,                    millimag
    11 FIELD Mcal,           Mcal,       short,          image cal mag,                  millimag
    12 FIELD Mgal,           Mgal,       short,          galaxy mag,                     millimag
    13 FIELD airmass,        airmass,    short,          (airmass - 1),                  milliairmass
     8FIELD dR,             D_RA,       float,          RA offset,                      arcsec
     9FIELD dD,             D_DEC,      float,          DEC offset,                     arcsec
     10FIELD M,              MAG,        float,          catalog mag,                    mag
     11FIELD dM,             dM,         float,          mag error,                      mag
     12FIELD Mcal,           Mcal,       float,          image cal mag,                  mag
     13FIELD Mgal,           Mgal,       float,          galaxy mag,                     mag
     14FIELD airmass,        airmass,    float,          (airmass - 1),                  airmass
     15FIELD dt,             dt,         float,          exposure time,                  2.5*log(exptime)
    1416FIELD FWx,            FWx,        short,          object fwhm major axis,         1/100 of arcsec
    15 FIELD dM,             dM,         unsigned char,  mag error,                      millimag
    16 FIELD fwy,            fwy,        unsigned char,  object fwhm minor/major ratio
     17FIELD FWy,            FWy,        short,          object fwhm minor axis,         1/100 of arcsec
    1718FIELD theta,          theta,      unsigned char,  angle wrt ccd X dir,            (0xff/360) deg
    1819FIELD dophot,         dophot,     char,           dophot type
    1920FIELD source,         source,     unsigned short, photcode
     21FIELD flags,          flags,      unsigned short, flags for various uses 
    2022FIELD t,              t,          unsigned int,   time in seconds (UNIX)
    2123FIELD averef,         averef,     unsigned int,   reference to average entry     
    22 FIELD dt,             dt,         short,          exposure time,                  2500*log(exptime)
    23 FIELD flags,          flags,      unsigned short, flags for various uses 
  • trunk/Ohana/src/libautocode/def/measure.d

    r4863 r4865  
    1616FIELD airmass_PS,     airmass,    float,          (airmass - 1),                  airmass
    1717FIELD dt_PS,          dt,         float,          exposure time,                  2.5*log(exptime)
    18 FIELD t,              t,          unsigned int,   time in seconds (UNIX)
    1918FIELD FWx,            FWx,        short,          object fwhm major axis,         1/100 of arcsec
    20 FIELD FWy_PS,         FWy,        short,          object fwhm minor axis,         1/100 of arcsec
     19FIELD FWy,            FWy,        short,          object fwhm minor axis,         1/100 of arcsec
    2120FIELD theta,          theta,      unsigned char,  angle wrt ccd X dir,            (0xff/360) deg
    2221FIELD dophot,         dophot,     char,           dophot type
    2322FIELD source,         source,     unsigned short, photcode
    2423FIELD flags,          flags,      unsigned short, flags for various uses 
     24FIELD t,              t,          unsigned int,   time in seconds (UNIX)
    2525FIELD averef,         averef,     unsigned int,   reference to average entry     
  • trunk/Ohana/src/libautocode/def/secfilt.d

    r4023 r4865  
    22EXTNAME DVO_SECFILT
    33TYPE    BINTABLE
    4 SIZE    6
     4SIZE    10
    55
    66# elements of data structure / FITS table
    7 FIELD  M,  MAG,      short,                other mags,       millimags
    8 FIELD  Xm, MAG_CHI,  short,                chisq on mag
    9 FIELD  dM, MAG_ERR,  short,                scatter on mag
     7FIELD  M_PS,  MAG,      float,                other mags,       mags
     8FIELD  dM_PS, MAG_ERR,  float,                scatter on mag    mags
     9FIELD  Xm,    MAG_CHI,  short,                chisq on mag      [100*log(value)]
  • trunk/Ohana/src/libohana/Makefile

    r4864 r4865  
    6363$(ASRC)/average-panstarrs.$(ARCH).o \
    6464$(ASRC)/secfilt.$(ARCH).o \
     65$(ASRC)/secfilt-elixir.$(ARCH).o \
     66$(ASRC)/secfilt-panstarrs.$(ARCH).o \
    6567$(ASRC)/measure.$(ARCH).o \
    6668$(ASRC)/measure-loneos.$(ARCH).o \
  • trunk/Ohana/src/libohana/include/dvo.h

    r4864 r4865  
    187187char     *GetPhotcodeNamebyCode (int code);
    188188
    189 double PhotInst (Measure *measure);
    190 double PhotCat (Measure *measure);
    191 double PhotSys (Measure *measure, Average *average, SecFilt *secfilt);
    192 double PhotRel (Measure *measure, Average *average, SecFilt *secfilt);
    193 double PhotCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code);
    194 double PhotAve (PhotCode *code, Average *average, SecFilt *secfilt);
    195 double PhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure);
    196 double PhotXm (PhotCode *code, Average *average, SecFilt *secfilt);
    197 double PhotdM (PhotCode *code, Average *average, SecFilt *secfilt);
    198 
     189float PhotInst (Measure *measure);
     190float PhotCat (Measure *measure);
     191float PhotSys (Measure *measure, Average *average, SecFilt *secfilt);
     192float PhotRel (Measure *measure, Average *average, SecFilt *secfilt);
     193float PhotCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code);
     194float PhotAve (PhotCode *code, Average *average, SecFilt *secfilt);
     195float PhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure);
     196float PhotXm (PhotCode *code, Average *average, SecFilt *secfilt);
     197float PhotdM (PhotCode *code, Average *average, SecFilt *secfilt);
     198
     199# if (0)
    199200short iPhotInst (Measure *measure);
    200201short iPhotAbs (Measure *measure);
     
    207208short iPhotXm (PhotCode *code, Average *average, SecFilt *secfilt);
    208209short iPhotdM (PhotCode *code, Average *average, SecFilt *secfilt);
    209 
    210 short iPhotColor (Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code);
     210# endif
     211
     212float iPhotColor (Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code);
    211213int PhotColor (Average *average, SecFilt *secfilt, Measure *measure, int c1, int c2, double *color);
    212214
  • trunk/Ohana/src/libohana/src/LoadPhotcodes.c

    r3466 r4865  
    33
    44# define NCTERMS 4
     5# define F_PS 0.001
     6# define NO_MAG_PS 100.0
    57
    68static PhotCodeData *photcodes = NULL;
    79static double ZERO_POINT;
    8 static short int iZERO_POINT;
    910static short int Nseclist[0x10000];
     11
     12/* static short int iZERO_POINT; */
    1013
    1114void SetZeroPoint (double ZP) {
    1215  ZERO_POINT = ZP;
    13   iZERO_POINT = 1000 * ZP;
     16  /* iZERO_POINT = 1000 * ZP; */
    1417}
    1518
     
    375378}
    376379
     380/**** conversion to INTERNAL vs TABLE types makes the iPhot versions irrelevant ****/
     381# if (0)
    377382/******** photometry conversions *********/
    378383double PhotInst (Measure *measure) {
     
    474479}
    475480
     481# endif
     482
    476483/******** internal photometry conversions (keeps values in short int millimags) *********/
    477 short iPhotInst (Measure *measure) {
     484float PhotInst (Measure *measure) {
    478485
    479486  int Np;
     
    481488
    482489  Np = photcodes[0].hashcode[measure[0].source];
    483   if (Np == -1) return (NO_MAG);
     490  if (Np == -1) return (NO_MAG_PS);
    484491
    485492  if (photcodes[0].code[Np].type == PHOT_REF) {
    486     M = measure[0].M;
     493    M = measure[0].M_PS;
    487494    return (M);
    488495  }
    489496
    490   M = measure[0].M - measure[0].dt - iZERO_POINT;
     497  M = measure[0].M_PS - measure[0].dt_PS - ZERO_POINT;
    491498         
    492499  return (M);
     
    494501}
    495502
    496 short iPhotCat (Measure *measure) {
     503float PhotCat (Measure *measure) {
    497504
    498505  int Np;
    499   short Mcat;
     506  float Mcat;
    500507  PhotCode *code;
    501508
    502509  Np = photcodes[0].hashcode[measure[0].source];
    503   if (Np == -1) return (NO_MAG);
     510  if (Np == -1) return (NO_MAG_PS);
    504511
    505512  if (photcodes[0].code[Np].type == PHOT_REF) {
    506     Mcat = measure[0].M;
     513    Mcat = measure[0].M_PS;
    507514    return (Mcat);
    508515  }
    509516  code = &photcodes[0].code[Np];
    510   Mcat = measure[0].M - iZERO_POINT + code[0].K*(measure[0].airmass - 1000) + code[0].C;
     517  Mcat = measure[0].M_PS - ZERO_POINT + code[0].K*(measure[0].airmass_PS - 1.000) + F_PS*code[0].C;
    511518 
    512519  return (Mcat);
    513520}
    514521
    515 short iPhotSys (Measure *measure, Average *average, SecFilt *secfilt) {
     522float PhotSys (Measure *measure, Average *average, SecFilt *secfilt) {
    516523
    517524  int i, Np;
    518   short Mcat, Mcol, Msys, mc;
    519   double Mc;
     525  float Mcat, Mcol, Msys, mc, Mc;
    520526  PhotCode *code;
    521527
    522528  Np = photcodes[0].hashcode[measure[0].source];
    523   if (Np == -1) return (NO_MAG);
     529  if (Np == -1) return (NO_MAG_PS);
    524530
    525531  if (photcodes[0].code[Np].type == PHOT_REF) {
    526     Msys = measure[0].M;
     532    Msys = measure[0].M_PS;
    527533    return (Msys);
    528534  }
    529535  code = &photcodes[0].code[Np];
    530   Mcat = measure[0].M - iZERO_POINT + code[0].K*(measure[0].airmass - 1000.0) + code[0].C;
     536  Mcat = measure[0].M_PS - ZERO_POINT + code[0].K*(measure[0].airmass_PS - 1.000) + F_PS*code[0].C;
    531537
    532538  /* for DEP, color must be made of PRI/SEC */
    533539  mc = iPhotColor (average, secfilt, NULL, code);
    534   if (mc == NO_MAG) return (Mcat);
    535   mc = mc - code[0].dX;
     540  if (mc == NO_MAG_PS) return (Mcat);
     541  mc = mc - F_PS*code[0].dX;
    536542
    537543  Mc = mc;
     
    539545  for (i = 0; i < code[0].Nc; i++) {
    540546    Mcol += code[0].X[i]*Mc;
    541     Mc *= mc * 0.001;    /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */
     547    Mc *= mc;
    542548  }
    543549  Msys = Mcat + Mcol;
     
    545551}
    546552
    547 short iPhotRel (Measure *measure, Average *average, SecFilt *secfilt) {
     553float PhotRel (Measure *measure, Average *average, SecFilt *secfilt) {
    548554
    549555  int i, Np;
    550   short Mcat, Mcol, Mrel, mc;
    551   double Mc;
     556  float Mcat, Mcol, Mrel, mc, Mc;
    552557  PhotCode *code;
    553558
    554559  Np = photcodes[0].hashcode[measure[0].source];
    555   if (Np == -1) return (NO_MAG);
     560  if (Np == -1) return (NO_MAG_PS);
    556561
    557562  if (photcodes[0].code[Np].type == PHOT_REF) {
    558     Mcat = measure[0].M;
     563    Mcat = measure[0].M_PS;
    559564    return (Mcat);
    560565  }
    561566  code = &photcodes[0].code[Np];
    562   Mrel = measure[0].M - iZERO_POINT + code[0].K*(measure[0].airmass - 1000.0) + code[0].C - measure[0].Mcal;
     567  Mrel = measure[0].M_PS - ZERO_POINT + code[0].K*(measure[0].airmass_PS - 1.000) + F_PS*code[0].C - measure[0].Mcal_PS;
    563568
    564569  /* for DEP, color must be made of PRI/SEC */
    565570  mc = iPhotColor (average, secfilt, NULL, code);
    566   if (mc == NO_MAG) return (Mrel);
    567   mc = mc - code[0].dX;
     571  if (mc == NO_MAG_PS) return (Mrel);
     572  mc = mc - F_PS*code[0].dX;
    568573
    569574  Mc = mc;
     
    571576  for (i = 0; i < code[0].Nc; i++) {
    572577    Mcol += code[0].X[i]*Mc;
    573     Mc *= mc * 0.001;    /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */
     578    Mc *= mc;    /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */
    574579  }
    575580  Mrel += Mcol;
     
    578583
    579584/* return calibrated magnitude from measure for given photcode */
    580 short iPhotCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code) {
     585float PhotCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code) {
    581586
    582587  int i, Np;
    583   short Mcal, Mrel, Mcol, mc;
    584   double Mc;
     588  float Mcal, Mrel, Mcol, mc, Mc;
    585589
    586590  /* code must be the matching PRI/SEC code for this measurement or an equivalent ALT */
    587591  Np = photcodes[0].hashcode[thisone[0].source];
    588592  if (Np == -1) {
    589     return (NO_MAG);
     593    return (NO_MAG_PS);
    590594  }
    591595
    592596  if (photcodes[0].code[Np].type == PHOT_REF) {
    593     Mrel = thisone[0].M;
     597    Mrel = thisone[0].M_PS;
    594598    return (Mrel);
    595599  }
    596600  if (code[0].code != photcodes[0].code[Np].equiv) {
    597     return (NO_MAG);
    598   }
    599 
    600   Mcal = iPhotRel (thisone, average, secfilt) + code[0].C;
     601    return (NO_MAG_PS);
     602  }
     603
     604  Mcal = PhotRel (thisone, average, secfilt) + F_PS*code[0].C;
    601605
    602606  mc = iPhotColor (average, secfilt, measure, code);
    603   if (mc == NO_MAG) return (Mcal);
    604   mc = mc - code[0].dX;
     607  if (mc == NO_MAG_PS) return (Mcal);
     608  mc = mc - F_PS*code[0].dX;
    605609
    606610  Mc = mc;
     
    608612  for (i = 0; i < code[0].Nc; i++) {
    609613    Mcol += code[0].X[i]*Mc;
    610     Mc *= mc * 0.001;    /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */
     614    Mc *= mc;
    611615  }
    612616  Mcal += Mcol;
     
    615619
    616620/* color term may not use DEP magnitude */
    617 short iPhotColor (Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code) {
     621float iPhotColor (Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code) {
    618622
    619623  int i, Ns1, Ns2, Ns;
    620   short m1, m2, mc;
     624  float m1, m2, mc;
    621625  PhotCode *color;
    622626
    623   m1 = m2 = NO_MAG;
     627  m1 = m2 = NO_MAG_PS;
    624628
    625629  if (measure == NULL) {
     
    627631    Ns2 = photcodes[0].hashNsec[code[0].c2];
    628632 
    629     m1 = (Ns1 == -1) ? average[0].M : secfilt[Ns1].M;
    630     m2 = (Ns2 == -1) ? average[0].M : secfilt[Ns2].M;
    631     mc = ((m1 == NO_MAG) || (m2 == NO_MAG)) ? NO_MAG : (m1 - m2);
     633    m1 = (Ns1 == -1) ? average[0].M_PS : secfilt[Ns1].M_PS;
     634    m2 = (Ns2 == -1) ? average[0].M_PS : secfilt[Ns2].M_PS;
     635    mc = ((m1 == NO_MAG_PS) || (m2 == NO_MAG_PS)) ? NO_MAG_PS : (m1 - m2);
    632636    return (mc);
    633637  }
     
    635639  /* find magnitude matching first color term */
    636640  color = GetPhotcodebyCode (code[0].c1);
    637   if (color == NULL) return (NO_MAG);
     641  if (color == NULL) return (NO_MAG_PS);
    638642  if (color[0].type == PHOT_REF) {
    639     for (i = 0; (i < average[0].Nm) && (m1 == NO_MAG); i++) {
     643    for (i = 0; (i < average[0].Nm) && (m1 == NO_MAG_PS); i++) {
    640644      if (measure[i].source == color[0].code) {
    641         m1 = measure[i].M;
     645        m1 = measure[i].M_PS;
    642646      }
    643647    }
    644648  } else {
    645649    Ns = photcodes[0].hashNsec[color[0].code];
    646     m1 = (Ns == -1) ? average[0].M : secfilt[Ns].M;
     650    m1 = (Ns == -1) ? average[0].M_PS : secfilt[Ns].M_PS;
    647651  }     
    648652
    649653  /* find magnitude matching second color term */
    650654  color = GetPhotcodebyCode (code[0].c2);
    651   if (color == NULL) return (NO_MAG);
     655  if (color == NULL) return (NO_MAG_PS);
    652656  if (color[0].type == PHOT_REF) {
    653     for (i = 0; (i < average[0].Nm) && (m2 == NO_MAG); i++) {
     657    for (i = 0; (i < average[0].Nm) && (m2 == NO_MAG_PS); i++) {
    654658      if (measure[i].source == color[0].code) {
    655         m2 = measure[i].M;
     659        m2 = measure[i].M_PS;
    656660      }
    657661    }
    658662  } else {
    659663    Ns = photcodes[0].hashNsec[color[0].code];
    660     m2 = (Ns == -1) ? average[0].M : secfilt[Ns].M;
     664    m2 = (Ns == -1) ? average[0].M_PS : secfilt[Ns].M_PS;
    661665  }     
    662   mc = ((m1 == NO_MAG) || (m2 == NO_MAG)) ? NO_MAG : (m1 - m2);
     666  mc = ((m1 == NO_MAG_PS) || (m2 == NO_MAG_PS)) ? NO_MAG_PS : (m1 - m2);
    663667  return (mc);
    664668}
    665669
    666670/* return calibrated magnitude from average/secfilt for given photcode */
    667 short iPhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure) {
     671float PhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure) {
    668672
    669673  int i, Ns;
     
    672676
    673677  Ns = photcodes[0].hashNsec[code[0].code];
    674   Mave = (Ns == -1) ? average[0].M : secfilt[Ns].M;
    675   Mref = Mave + code[0].C;
     678  Mave = (Ns == -1) ? average[0].M_PS : secfilt[Ns].M_PS;
     679  Mref = Mave + F_PS*code[0].C;
    676680
    677681  mc = iPhotColor (average, secfilt, measure, code);
    678   if (mc == NO_MAG) return (Mref);
    679   mc = mc - code[0].dX;
     682  if (mc == NO_MAG_PS) return (Mref);
     683  mc = mc - F_PS*code[0].dX;
    680684
    681685  Mc = mc;
     
    683687  for (i = 0; i < code[0].Nc; i++) {
    684688    Mcol += code[0].X[i]*Mc;
    685     Mc *= mc * 0.001;    /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */
     689    Mc *= mc;    /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */
    686690  }
    687691  Mref += Mcol;
     
    690694
    691695/***/
    692 short iPhotAve (PhotCode *code, Average *average, SecFilt *secfilt) {
     696float PhotAve (PhotCode *code, Average *average, SecFilt *secfilt) {
    693697
    694698  int Ns;
     
    696700
    697701  Ns = photcodes[0].hashNsec[code[0].code];
    698   Mave = (Ns == -1) ? average[0].M : secfilt[Ns].M;
     702  Mave = (Ns == -1) ? average[0].M_PS : secfilt[Ns].M_PS;
    699703  return (Mave);
    700704}
    701705
    702706/*** note that this is NOT a wrapper around iPhotdM ***/
    703 short iPhotdM (PhotCode *code, Average *average, SecFilt *secfilt) {
     707float PhotdM (PhotCode *code, Average *average, SecFilt *secfilt) {
    704708
    705709  int Ns;
     
    707711
    708712  Ns = photcodes[0].hashNsec[code[0].code];
    709   dM  = (Ns == -1) ? average[0].dM : secfilt[Ns].dM;
     713  dM  = (Ns == -1) ? average[0].dM_PS : secfilt[Ns].dM_PS;
    710714  return (dM);
    711715}
    712716
    713717/*** note that this is NOT a wrapper around iPhotXm ***/
    714 short iPhotXm (PhotCode *code, Average *average, SecFilt *secfilt) {
     718float PhotXm (PhotCode *code, Average *average, SecFilt *secfilt) {
    715719
    716720  int Ns;
    717   short Xm;
     721  short Mi;
     722  float Xm;
    718723
    719724  Ns = photcodes[0].hashNsec[code[0].code];
    720   Xm = (Ns == -1) ? average[0].Xm : secfilt[Ns].Xm;
     725  Mi = (Ns == -1) ? average[0].Xm : secfilt[Ns].Xm;
     726  Xm = (Mi == NO_MAG_PS) ? -1.0 : pow (10.0, 0.01*Mi);
    721727  return (Xm);
    722728}
     
    734740    for (i = 0; i < average[0].Nm; i++) {
    735741      if (measure[i].source == c1) {
    736         M1 = 0.001*measure[i].M;
     742        M1 = measure[i].M_PS;
    737743        goto filter1;
    738744      }
     
    741747  } else {
    742748    Ns = photcodes[0].hashNsec[code[0].code];
    743     M1 = (Ns == -1) ? 0.001*average[0].M : 0.001*secfilt[Ns].M;
     749    M1 = (Ns == -1) ? average[0].M_PS : secfilt[Ns].M_PS;
    744750  }     
    745751
     
    750756    for (i = 0; i < average[0].Nm; i++) {
    751757      if (measure[i].source == c2) {
    752         M2 = 0.001*measure[i].M;
     758        M2 = measure[i].M_PS;
    753759        goto filter2;
    754760      }
     
    757763  } else {
    758764    Ns = photcodes[0].hashNsec[code[0].code];
    759     M2 = (Ns == -1) ? 0.001*average[0].M : 0.001*secfilt[Ns].M;
     765    M2 = (Ns == -1) ? average[0].M_PS : secfilt[Ns].M_PS;
    760766  }     
    761767 
  • trunk/Ohana/src/libohana/src/dvo_convert_elixir.c

    r4830 r4865  
    1313    out[i].dR_PS   = in[i].dR * 0.01;
    1414    out[i].dD_PS   = in[i].dD * 0.01;
    15     out[i].M       = in[i].M;
    16     out[i].Mcal    = in[i].Mcal;
    17     out[i].Mgal    = in[i].Mgal;
    18     out[i].airmass = in[i].airmass;
     15    out[i].M_PS    = in[i].M  * 0.001;
     16    out[i].dM_PS   = in[i].dM * 0.001;
     17    out[i].dt_PS      = in[i].dt * 0.001;
     18    out[i].Mcal_PS    = in[i].Mcal * 0.001;
     19    out[i].Mgal_PS    = in[i].Mgal * 0.001;
     20    out[i].airmass_PS = in[i].airmass * 0.001;
    1921    out[i].FWx     = in[i].FWx;
    20     out[i].dM      = in[i].dM;
    21     out[i].fwy     = in[i].fwy;
     22    out[i].FWy     = in[i].fwy * in[i].FWx * 0.01;
    2223    out[i].theta   = in[i].theta;
    2324    out[i].dophot  = in[i].dophot;
     
    2526    out[i].t       = in[i].t;
    2627    out[i].averef  = in[i].averef;
    27     out[i].dt      = in[i].dt;
    2828    out[i].flags   = in[i].flags;
    2929  }
     
    4242    out[i].dR      = in[i].dR_PS * 100.0;
    4343    out[i].dD      = in[i].dD_PS * 100.0;
    44     out[i].M       = in[i].M;
    45     out[i].Mcal    = in[i].Mcal;
    46     out[i].Mgal    = in[i].Mgal;
    47     out[i].airmass = in[i].airmass;
     44    out[i].M       = in[i].M_PS  * 1000.0;
     45    out[i].dM      = in[i].dM_PS * 1000.0;
     46    out[i].dt      = in[i].dt_PS * 1000.0;
     47    out[i].Mcal    = in[i].Mcal_PS * 1000.0;
     48    out[i].Mgal    = in[i].Mgal_PS * 1000.0;
     49    out[i].airmass = in[i].airmass_PS * 1000.0;
    4850    out[i].FWx     = in[i].FWx;
    49     out[i].dM      = in[i].dM;
    50     out[i].fwy     = in[i].fwy;
     51    out[i].fwy     = 100.0 * in[i].FWy / in[i].FWx;
    5152    out[i].theta   = in[i].theta;
    5253    out[i].dophot  = in[i].dophot;
     
    5455    out[i].t       = in[i].t;
    5556    out[i].averef  = in[i].averef;
    56     out[i].dt      = in[i].dt;
    5757    out[i].flags   = in[i].flags;
    5858  }
     
    7070    out[i].R_PS    = in[i].R;     
    7171    out[i].D_PS    = in[i].D;     
    72     out[i].M       = in[i].M;     
     72    out[i].M_PS    = in[i].M  * 0.001;     
     73    out[i].dM_PS   = in[i].dM * 0.001;     
    7374    out[i].Xp      = in[i].Xp;     
    7475    out[i].Xm      = in[i].Xm;     
     
    7879    out[i].offset  = in[i].offset;
    7980    out[i].missing = in[i].missing;
    80     out[i].dM      = in[i].dM;
    8181    out[i].Xg      = in[i].Xg;
    8282  }
     
    9494    out[i].R       = in[i].R_PS;     
    9595    out[i].D       = in[i].D_PS;     
    96     out[i].M       = in[i].M;     
     96    out[i].M       = in[i].M_PS  * 1000.0;     
     97    out[i].dM      = in[i].dM_PS * 1000.0;
    9798    out[i].Xp      = in[i].Xp;     
    9899    out[i].Xm      = in[i].Xm;     
     
    102103    out[i].offset  = in[i].offset;
    103104    out[i].missing = in[i].missing;
    104     out[i].dM      = in[i].dM;
    105105    out[i].Xg      = in[i].Xg;
    106106  }
  • trunk/Ohana/src/libohana/src/dvo_convert_loneos.c

    r4830 r4865  
    1313    out[i].dR_PS   = in[i].dR * 0.01;
    1414    out[i].dD_PS   = in[i].dD * 0.01;
    15     out[i].M       = in[i].M;
    16     out[i].Mcal    = in[i].Mcal;
    17     out[i].dM      = in[i].dM;
     15    out[i].M_PS    = in[i].M  * 0.001;
     16    out[i].dM_PS   = in[i].dM * 0.001;
     17    out[i].Mcal_PS = in[i].Mcal * 0.001;
    1818    out[i].dophot  = in[i].dophot;
    1919    out[i].source  = in[i].source;
     
    2525
    2626    /* these values don't exist in the Loneos format */
    27     out[i].Mgal    = in[i].M;
    28     out[i].dt      = 0;
    29     out[i].airmass = 0;
    30     out[i].FWx     = 0;
    31     out[i].fwy     = 0;
    32     out[i].theta   = 0;
     27    out[i].Mgal_PS    = in[i].M;
     28    out[i].dt_PS      = 0;
     29    out[i].airmass_PS = 0;
     30    out[i].FWx        = 0;
     31    out[i].FWy        = 0;
     32    out[i].theta      = 0;
    3333  }
    3434  return (out);
     
    4646    out[i].dR     = in[i].dR_PS * 100.0;
    4747    out[i].dD     = in[i].dD_PS * 100.0;
    48     out[i].M      = in[i].M;
    49     out[i].dM     = in[i].dM;
    50     out[i].Mcal   = in[i].Mcal;
     48    out[i].M      = in[i].M_PS  * 1000.0;
     49    out[i].dM     = in[i].dM_PS * 1000.0;
     50    out[i].Mcal   = in[i].Mcal_PS * 1000.0;
    5151    out[i].dophot = in[i].dophot;
    5252    out[i].source = in[i].source;
     
    6767
    6868  for (i = 0; i < Nvalues; i++) {
    69     out[i].R_PS       = in[i].R;     
    70     out[i].D_PS       = in[i].D;     
    71     out[i].M       = in[i].M;     
     69    out[i].R_PS    = in[i].R;     
     70    out[i].D_PS    = in[i].D;     
     71    out[i].M_PS    = in[i].M * 0.001;     
    7272    out[i].Xp      = in[i].Xp;     
    7373    out[i].Xm      = in[i].Xm;     
     
    7979
    8080    /* these don't exist in Loneos */
    81     out[i].dM      = 0xffff;
     81    out[i].dM_PS   = 0xffff;
    8282    out[i].Xg      = 0xffff;
    8383  }
     
    9595    out[i].R       = in[i].R_PS;     
    9696    out[i].D       = in[i].D_PS;     
    97     out[i].M       = in[i].M;     
     97    out[i].M       = in[i].M_PS * 1000.0;     
    9898    out[i].Xp      = in[i].Xp;     
    9999    out[i].Xm      = in[i].Xm;     
  • trunk/Ohana/src/libohana/src/dvo_convert_panstarrs.c

    r4830 r4865  
    88  Measure *out;
    99
     10  /*** note that these structures are identical ***/
     11
    1012  ALLOCATE (out, Measure, Nvalues);
    1113
    1214  for (i = 0; i < Nvalues; i++) {
    13     out[i].dR_PS   = in[i].dR;
    14     out[i].dD_PS   = in[i].dD;
    15     out[i].M       = in[i].M;
    16     out[i].Mcal    = in[i].Mcal;
    17     out[i].Mgal    = in[i].Mgal;
    18     out[i].airmass = in[i].airmass;
    19     out[i].FWx     = in[i].FWx;
    20     out[i].dM      = in[i].dM;
    21     out[i].fwy     = in[i].fwy;
    22     out[i].theta   = in[i].theta;
    23     out[i].dophot  = in[i].dophot;
    24     out[i].source  = in[i].source;
    25     out[i].t       = in[i].t;
    26     out[i].averef  = in[i].averef;
    27     out[i].dt      = in[i].dt;
    28     out[i].flags   = in[i].flags;
     15    out[i].dR_PS      = in[i].dR;
     16    out[i].dD_PS      = in[i].dD;
     17    out[i].M_PS       = in[i].M;
     18    out[i].dM_PS      = in[i].dM;
     19    out[i].Mcal_PS    = in[i].Mcal;
     20    out[i].Mgal_PS    = in[i].Mgal;
     21    out[i].airmass_PS = in[i].airmass;
     22    out[i].dt_PS      = in[i].dt;
     23    out[i].FWx        = in[i].FWx;
     24    out[i].FWy        = in[i].FWy;
     25    out[i].theta      = in[i].theta;
     26    out[i].dophot     = in[i].dophot;
     27    out[i].source     = in[i].source;
     28    out[i].t          = in[i].t;
     29    out[i].averef     = in[i].averef;
     30    out[i].flags      = in[i].flags;
    2931  }
    3032  return (out);
     
    4244    out[i].dR      = in[i].dR_PS;
    4345    out[i].dD      = in[i].dD_PS;
    44     out[i].M       = in[i].M;
    45     out[i].Mcal    = in[i].Mcal;
    46     out[i].Mgal    = in[i].Mgal;
    47     out[i].airmass = in[i].airmass;
     46    out[i].M       = in[i].M_PS;
     47    out[i].dM      = in[i].dM_PS;
     48    out[i].Mcal    = in[i].Mcal_PS;
     49    out[i].Mgal    = in[i].Mgal_PS;
     50    out[i].airmass = in[i].airmass_PS;
     51    out[i].dt      = in[i].dt_PS;
    4852    out[i].FWx     = in[i].FWx;
    49     out[i].dM      = in[i].dM;
    50     out[i].fwy     = in[i].fwy;
     53    out[i].FWy     = in[i].FWy;
    5154    out[i].theta   = in[i].theta;
    5255    out[i].dophot  = in[i].dophot;
     
    5457    out[i].t       = in[i].t;
    5558    out[i].averef  = in[i].averef;
    56     out[i].dt      = in[i].dt;
    5759    out[i].flags   = in[i].flags;
    5860  }
     
    6870
    6971  for (i = 0; i < Nvalues; i++) {
    70     out[i].R_PS       = in[i].R;     
    71     out[i].D_PS       = in[i].D;     
    72     out[i].M       = in[i].M;     
     72    out[i].R_PS    = in[i].R;     
     73    out[i].D_PS    = in[i].D;     
     74    out[i].M_PS    = in[i].M;     
     75    out[i].dM_PS   = in[i].dM;
    7376    out[i].Xp      = in[i].Xp;     
    7477    out[i].Xm      = in[i].Xm;     
     78    out[i].Xg      = in[i].Xg;
    7579    out[i].Nm      = in[i].Nm;     
    7680    out[i].Nn      = in[i].Nn;     
     
    7882    out[i].offset  = in[i].offset;
    7983    out[i].missing = in[i].missing;
    80     out[i].dM      = in[i].dM;
    81     out[i].Xg      = in[i].Xg;
    8284  }
    8385  return (out);
     
    9496    out[i].R       = in[i].R_PS;     
    9597    out[i].D       = in[i].D_PS;     
    96     out[i].M       = in[i].M;     
     98    out[i].M       = in[i].M_PS;     
     99    out[i].dM      = in[i].dM_PS;
    97100    out[i].Xp      = in[i].Xp;     
    98101    out[i].Xm      = in[i].Xm;     
     102    out[i].Xg      = in[i].Xg;
    99103    out[i].Nm      = in[i].Nm;     
    100104    out[i].Nn      = in[i].Nn;     
     
    102106    out[i].offset  = in[i].offset;
    103107    out[i].missing = in[i].missing;
    104     out[i].dM      = in[i].dM;
    105     out[i].Xg      = in[i].Xg;
    106108  }
    107109  return (out);
  • trunk/Ohana/src/mosastro/src/gptolemy.c

    r4828 r4865  
    3434    stars[i].R   = catalog.average[i].R_PS;
    3535    stars[i].D   = catalog.average[i].D_PS;
    36     stars[i].Mag = 0.001*catalog.measure[catalog.average[i].offset].M;
     36    stars[i].Mag = catalog.measure[catalog.average[i].offset].M_PS;
    3737  }
    3838  free (catalog.average);
  • trunk/Ohana/src/opihi/dvo/calextract.c

    r4834 r4865  
    9494        if (catalog.measure[m+j].source != code[1][0].code) continue;
    9595        M2 = PhotCat  (&catalog.measure[m+j]);
    96         dM2 = 0.001*catalog.measure[m+j].dM;
     96        dM2 = catalog.measure[m+j].dM_PS;
    9797      }
    9898      if (M2 == NO_MAG) continue;
  • trunk/Ohana/src/opihi/dvo/calmextract.c

    r4834 r4865  
    107107        if (catalog.measure[m+j].source != code[1][0].code) continue;
    108108        M2 = PhotCat  (&catalog.measure[m+j]);
    109         dM2 = 0.001*catalog.measure[m+j].dM;
     109        dM2 = catalog.measure[m+j].dM_PS;
    110110      }
    111111      if (M2 == NO_MAG) continue;
  • trunk/Ohana/src/opihi/dvo/catalog.c

    r4834 r4865  
    101101  if ((Nm = get_argument (argc, argv, "-m"))) {
    102102    remove_argument (Nm, &argc, argv);
    103     Mr  = 1000*atof(argv[Nm]);
     103    Mr  = atof(argv[Nm]);
    104104    remove_argument (Nm, &argc, argv);
    105     Mz = 1000*atof(argv[Nm]);
     105    Mz = atof(argv[Nm]);
    106106    Mr = Mr - Mz;
    107107    remove_argument (Nm, &argc, argv);
     
    200200        catalog.average[nstar].R_PS = R;
    201201        catalog.average[nstar].D_PS = D;
    202         catalog.average[nstar].M = M * 1000.0;
     202        catalog.average[nstar].M_PS = M;
    203203        nstar++;
    204204        if (nstar == NSTARS - 1) {
     
    242242          catalog.average[nstar].R_PS = R;
    243243          catalog.average[nstar].D_PS = D;
    244           catalog.average[nstar].M = M * 1000.0;
     244          catalog.average[nstar].M_PS = M;
    245245          nstar++;
    246246          if (nstar == NSTARS - 1) {
     
    292292          catalog.average[nstar].R_PS = R;
    293293          catalog.average[nstar].D_PS = D;
    294           catalog.average[nstar].M = M * 1000.0;
     294          catalog.average[nstar].M_PS = M;
    295295          nstar++;
    296296          if (nstar == NSTARS - 1) {
     
    346346        if (IDclip && (catalog.average[i].code != IDchoice))
    347347          continue;
    348         Zvec.elements[N] = MIN (1.0, MAX (0.01, (catalog.average[i].M - Mz) / Mr));
     348        Zvec.elements[N] = MIN (1.0, MAX (0.01, (catalog.average[i].M_PS - Mz) / Mr));
    349349        if (LimExclude && (Zvec.elements[N] > 0.99)) continue;
    350350        if (Zvec.elements[N] < 0.011) continue;
     
    356356    case (NUMSCALE):
    357357      for (N = i = 0; i < catalog.Naverage; i++) {
    358         if (clip && ((catalog.average[i].M > Mz) || (catalog.average[i].M < Mr+Mz)))
     358        if (clip && ((catalog.average[i].M_PS > Mz) || (catalog.average[i].M_PS < Mr+Mz)))
    359359          continue;
    360360        if (IDclip && (catalog.average[i].code != IDchoice))
     
    371371    case (MISSCALE):
    372372      for (N = i = 0; i < catalog.Naverage; i++) {
    373         if (clip && ((catalog.average[i].M > Mz) || (catalog.average[i].M < Mr+Mz)))
     373        if (clip && ((catalog.average[i].M_PS > Mz) || (catalog.average[i].M_PS < Mr+Mz)))
    374374          continue;
    375375        if (IDclip && (catalog.average[i].code != IDchoice))
  • trunk/Ohana/src/opihi/dvo/compare.c

    r4800 r4865  
    3838           rvec[0].elements[Nmatch] = catlog1[0].average[i].R_PS;
    3939           dvec[0].elements[Nmatch] = catlog1[0].average[i].D_PS;
    40            mvec[0].elements[Nmatch] = catlog1[0].average[i].M;
     40           mvec[0].elements[Nmatch] = catlog1[0].average[i].M_PS;
    4141          drvec[0].elements[Nmatch] = dX;
    4242          ddvec[0].elements[Nmatch] = dY;
    43           dmvec[0].elements[Nmatch] = catlog1[0].average[i].M - catlog2[0].average[j].M;
     43          dmvec[0].elements[Nmatch] = catlog1[0].average[i].M_PS - catlog2[0].average[j].M_PS;
    4444          Nmatch ++;
    4545          if (Nmatch == NMATCH - 1) {
  • trunk/Ohana/src/opihi/dvo/dmt.c

    r4834 r4865  
    8888      if (catalog.average[i].Nm != 3) continue;
    8989      m = catalog.average[i].offset;
    90       M0 = (Ns == -1) ? 0.001*catalog.average[i].M : 0.001*catalog.secfilt[i*Nsec+Ns].M;
     90      M0 = (Ns == -1) ? catalog.average[i].M_PS : catalog.secfilt[i*Nsec+Ns].M_PS;
    9191      M1 = PhotCat (&catalog.measure[m+0]);
    9292      M2 = PhotCat (&catalog.measure[m+1]);
  • trunk/Ohana/src/opihi/dvo/gstar.c

    r4833 r4865  
    142142
    143143      /* average mags */
    144       print_value (GetOutfile(), 0.001*catalog.average[k].M, catalog.average[k].M);
    145       for (j = 0; j < Nsec; j++) print_value (GetOutfile(), 0.001*catalog.secfilt[j + Nsec*k].M, catalog.secfilt[j + Nsec*k].M);
     144      print_value (GetOutfile(), catalog.average[k].M_PS, catalog.average[k].M_PS);
     145      for (j = 0; j < Nsec; j++) print_value (GetOutfile(), catalog.secfilt[j + Nsec*k].M_PS, catalog.secfilt[j + Nsec*k].M_PS);
    146146      fprintf (GetOutfile(), "\n");
    147147
    148148      /* average mag errors */
    149       print_value (GetOutfile(), 0.001*catalog.average[k].dM, catalog.average[k].dM);
    150       for (j = 0; j < Nsec; j++) print_value (GetOutfile(), 0.001*catalog.secfilt[j + Nsec*k].dM, catalog.secfilt[j + Nsec*k].dM);
     149      print_value (GetOutfile(), catalog.average[k].dM_PS, catalog.average[k].dM_PS);
     150      for (j = 0; j < Nsec; j++) print_value (GetOutfile(), catalog.secfilt[j + Nsec*k].dM_PS, catalog.secfilt[j + Nsec*k].dM_PS);
    151151      fprintf (GetOutfile(), "\n");
    152152
     
    166166            date = sec_to_date (catalog.measure[m].t);
    167167            fprintf (GetOutfile(), "%6.3f %6.3f %5.3f  %20s  %5.2f %5.2f %2d %3x %3d %-20s\n",
    168                      Mcat, Mrel, 0.001*catalog.measure[m].dM,
     168                     Mcat, Mrel, catalog.measure[m].dM_PS,
    169169                     date, catalog.measure[m].dR_PS, catalog.measure[m].dD_PS,
    170170                     catalog.measure[m].dophot, catalog.measure[m].flags,
     
    176176            vec1[0].elements[N] = Mcat;
    177177            vec2[0].elements[N] = catalog.measure[m].t;
    178             vec3[0].elements[N] = 0.001*catalog.measure[m].airmass;
     178            vec3[0].elements[N] = catalog.measure[m].airmass_PS;
    179179            vec4[0].elements[N] = catalog.measure[m].source;
    180180            N ++;
  • trunk/Ohana/src/opihi/dvo/imdata.c

    r4834 r4865  
    154154      for (i = 0; i < catalog.Nmeasure; i++) {
    155155        if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue;
    156         vec[0].elements[N] = catalog.measure[i].M / 1000.0;
     156        vec[0].elements[N] = catalog.measure[i].M_PS;
    157157        N++;
    158158        CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000);
     
    162162      for (i = 0; i < catalog.Nmeasure; i++) {
    163163        if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue;
    164         vec[0].elements[N] = catalog.measure[i].dM / 1000.0;
     164        vec[0].elements[N] = catalog.measure[i].dM_PS;
    165165        N++;
    166166        CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000);
     
    170170      for (i = 0; i < catalog.Nmeasure; i++) {
    171171        if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue;
    172         vec[0].elements[N] = catalog.measure[i].Mcal / 1000.0;
     172        vec[0].elements[N] = catalog.measure[i].Mcal_PS;
    173173        N++;
    174174        CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 1000);
     
    179179        if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue;
    180180        n = catalog.measure[i].averef;
    181         vec[0].elements[N] = catalog.average[n].M / 1000.0;
     181        vec[0].elements[N] = catalog.average[n].M_PS;
    182182        N++;
    183183      }
  • trunk/Ohana/src/opihi/dvo/lcurve.c

    r4834 r4865  
    134134      m = catalog.average[N1[i]].offset;
    135135      for (j = 0; j < catalog.average[N1[i]].Nm; j++, m++) {
    136         if (ErrorBars) dYvec.elements[N] = 0.001*catalog.measure[m].dM;
     136        if (ErrorBars) dYvec.elements[N] = catalog.measure[m].dM_PS;
    137137        Xvec.elements[N] = TimeValue (catalog.measure[m].t, TimeReference, TimeFormat);
    138138        Yvec.elements[N] = PhotCat (&catalog.measure[m]);
  • trunk/Ohana/src/opihi/dvo/lightcurve.c

    r4834 r4865  
    123123
    124124        tvec[0].elements[N] = TimeValue (catalog.measure[m].t, TimeReference, TimeFormat);
    125         dmvec[0].elements[N] = 0.001*catalog.measure[m].dM;
     125        dmvec[0].elements[N] = catalog.measure[m].dM_PS;
    126126        if (RELPHOT) {
    127127          mvec[0].elements[N] = PhotCat (&catalog.measure[m]);
  • trunk/Ohana/src/opihi/dvo/photometry.c

    r4800 r4865  
    2222    if (TimeSelect && (M.t < tzero)) continue; \
    2323    if (TimeSelect && (M.t > tend)) continue; \
    24     if (ErrSelect  && (M.dM > ErrValue)) continue; \
     24    if (ErrSelect  && (M.dM_PS > ErrValue)) continue; \
    2525    if (TypeSelect && (TypeValue != GetMeasureTypeCode (&M))) continue; \
    2626    if (iMagSelect && (PhotInst (&M) < iMagMin)) continue; \
     
    432432  if ((N = get_argument (*argc, argv, "-errorlim"))) {
    433433    remove_argument (N, argc, argv);
    434     ErrValue = 1000*atof (argv[N]);
     434    ErrValue = atof (argv[N]);
    435435    remove_argument (N, argc, argv);
    436436    ErrSelect = TRUE;
     
    622622      for (i = 0; i < average[0].Nm; i++) {
    623623        if ((code != NULL) && (code[0].code != GetPhotcodeEquivCodebyCode (measure[i].source))) continue;
    624         if (ErrSelect && (measure[i].dM > ErrValue)) continue;
     624        if (ErrSelect && (measure[i].dM_PS > ErrValue)) continue;
    625625        if (FlagSelect && (measure[i].flags != FlagValue)) continue;
    626626        if (TypeSelect && (TypeValue != GetMeasureTypeCode (&measure[i]))) continue;
     
    789789  /* for ErrSelect, check average errors */
    790790  if (ErrSelect) {
    791     dM = iPhotdM (code, average, secfilt);
     791    dM = PhotdM (code, average, secfilt);
    792792    if (dM > ErrValue) return (NO_MAG);
    793793  }
     
    847847   average[].M is stored as 1000*mag where mag is PhotAbs
    848848   measure[].M for PHOT_REL is the same
     849   XXX EAM : note that we are transitioning away from millimag internal storage
    849850*/
    850851
     
    10631064      break;
    10641065    case MEAS_dMAG: /* OK */
    1065       value = 0.001*measure[0].dM;
     1066      value = measure[0].dM_PS;
    10661067      break;
    10671068    case MEAS_AIRMASS: /* OK */
    1068       value = 0.001*measure[0].airmass;
     1069      value = measure[0].airmass_PS;
    10691070      break;
    10701071    case MEAS_EXPTIME: /* OK */
    1071       value = pow (10.0, measure[0].dt * 0.0004);
     1072      value = pow (10.0, measure[0].dt_PS * 0.4);
    10721073      break;
    10731074    case MEAS_PHOTCODE: /* OK */
  • trunk/Ohana/src/relphot/include/relphot.h

    r4864 r4865  
    1515  unsigned int start;
    1616  unsigned int stop;
    17   short int Mcal;
    18   short int dMcal;
    19   short int Xm;
    20   short int secz;
     17  float Mcal;
     18  float dMcal;
     19  short Xm;
     20  float secz;
    2121  char code;
    2222  Coords coords;
     
    133133int           gcatalog            PROTO((Catalog *catalog, int FINAL));
    134134Coords       *getCoords           PROTO((int meas, int cat));
    135 short         getMcal             PROTO((int meas, int cat));
    136 short         getMgrid            PROTO((int meas, int cat));
    137 short         getMmos             PROTO((int meas, int cat));
    138 short         getMrel             PROTO((Catalog *catalog, int meas, int cat));
     135float         getMcal             PROTO((int meas, int cat));
     136float         getMgrid            PROTO((int meas, int cat));
     137float         getMmos             PROTO((int meas, int cat));
     138float         getMrel             PROTO((Catalog *catalog, int meas, int cat));
    139139GSCRegion    *get_regions         PROTO((double minRa, double maxRa, double minDec, double maxDec, int *Nregions));
    140140void          getfullregion       PROTO((Image *image, int Nimage, GSCRegion *fullregion));
  • trunk/Ohana/src/relphot/src/ConfigInit.c

    r4828 r4865  
    2222  GetConfig (config, "IMAGE_SCATTER",          "%lf", 0, &IMAGE_SCATTER);
    2323  GetConfig (config, "IMAGE_OFFSET",           "%lf", 0, &IMAGE_OFFSET);
    24   MAG_LIM *= 1000;
    25   SIGMA_LIM *= 1000;
    26   STAR_SCATTER *= 1000;
     24
    2725  IMAGE_SCATTER *= 1000;
    2826  IMAGE_OFFSET *= 1000;
  • trunk/Ohana/src/relphot/src/GridOps.v2.c

    r4796 r4865  
    22
    33static int     Ngrid;
    4 static short   *gridM;
    5 static short   *gridS;
     4static float   *gridM;
     5static float   *gridS;
    66static int     *gridN;
    77static int      gridX;
     
    3636  Ngrid = gridX * gridY;
    3737
    38   ALLOCATE (gridM, short, Ngrid);
    39   ALLOCATE (gridS, short, Ngrid);
     38  ALLOCATE (gridM, float, Ngrid);
     39  ALLOCATE (gridS, float, Ngrid);
    4040  ALLOCATE (gridN, int,   Ngrid);
    41   bzero (gridM, Ngrid*sizeof(short));
    42   bzero (gridS, Ngrid*sizeof(short));
     41  bzero (gridM, Ngrid*sizeof(float));
     42  bzero (gridS, Ngrid*sizeof(float));
    4343  bzero (gridN, Ngrid*sizeof(int));
    4444
     
    8787  Ngrid = gridX * gridY;
    8888
    89   ALLOCATE (gridM, short, Ngrid);
    90   ALLOCATE (gridS, short, Ngrid);
     89  ALLOCATE (gridM, float, Ngrid);
     90  ALLOCATE (gridS, float, Ngrid);
    9191  ALLOCATE (gridN, int,   Ngrid);
    92   bzero (gridM, Ngrid*sizeof(short));
    93   bzero (gridS, Ngrid*sizeof(short));
     92  bzero (gridM, Ngrid*sizeof(float));
     93  bzero (gridS, Ngrid*sizeof(float));
    9494  bzero (gridN, Ngrid*sizeof(int));
    9595
     
    232232# endif
    233233
    234 short getMgrid (int meas, int cat) {
     234float getMgrid (int meas, int cat) {
    235235
    236236  int i;
    237   short value;
     237  float value;
    238238
    239239  if (!USE_GRID) return (0);
     
    250250  int i, j, m, c, n, N, Nmax;
    251251  double *list, *dlist;
    252   short Msys, Mrel, Mcal, Mmos;
     252  float Msys, Mrel, Mcal, Mmos;
    253253  StatType stats;
    254254 
     
    276276     
    277277      n = catalog[c].measure[m].averef;
    278       Msys = iPhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
     278      Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
    279279      list[N] = Msys - Mrel - Mcal - Mmos;
    280       dlist[N] = MAX (catalog[c].measure[m].dM, MIN_ERROR);
     280      dlist[N] = MAX (catalog[c].measure[m].dM_PS, MIN_ERROR);
    281281      N++;
    282282    }
     
    294294
    295295  int i, j, m, c, n, N;
    296   short Msys, Mrel, Mcal, Mmos;
     296  float Msys, Mrel, Mcal, Mmos;
    297297  double *xlist, *Mlist, *dlist, *ylist;
    298298  Graphdata graphdata;
     
    322322
    323323      n = catalog[c].measure[m].averef;
    324       Msys = iPhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
     324      Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
    325325
    326326      xlist[N] = Xmeas[c][m];
     
    328328      Mlist[N] = Msys - Mrel - Mcal - Mmos;
    329329      dlist[N] = Msys - Mrel - Mcal - Mmos - gridM[i];
    330       Mlist[N] *= 0.001;
    331       dlist[N] *= 0.001;
    332330      N++;
    333331    }
  • trunk/Ohana/src/relphot/src/ImageOps.c

    r4796 r4865  
    136136}
    137137
    138 short getMcal (int meas, int cat) {
     138float getMcal (int meas, int cat) {
    139139
    140140  int i;
    141   short value;
     141  float value;
    142142
    143143  i = bin[cat][meas];
     
    145145
    146146  if (image[i].code & IMAGE_BAD)  return (NO_MAG); 
    147   value = image[i].Mcal;
     147  value = 0.001*image[i].Mcal;
    148148  return (value);
    149149}
     
    162162
    163163  int i, j, m, c, n, N, Nmax, mark, bad;
    164   short Msys, Mrel, Mmos, Mgrid;
     164  float Msys, Mrel, Mmos, Mgrid;
    165165  double *list, *dlist;
    166166  StatType stats;
     
    199199     
    200200      n = catalog[c].measure[m].averef;
    201       Msys = iPhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
     201      Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
    202202      list[N] = Msys - Mrel - Mmos - Mgrid;
    203       dlist[N] = MAX (catalog[c].measure[m].dM, MIN_ERROR);
     203      dlist[N] = MAX (catalog[c].measure[m].dM_PS, MIN_ERROR);
    204204      N++;
    205205    }
     
    217217   
    218218    liststats (list, dlist, N, &stats);
    219     image[i].Mcal  = stats.mean;
    220     image[i].dMcal = stats.sigma;
     219    image[i].Mcal  = 1000.0*stats.mean;
     220    image[i].dMcal = 1000.0*stats.sigma;
    221221    image[i].Xm    = 100.0*log10(stats.chisq);
    222222  }
  • trunk/Ohana/src/relphot/src/MosaicOps.c

    r4864 r4865  
    134134      Dmin = MIN (Dmin, D);
    135135      Dmax = MAX (Dmax, D);
    136       Mcal += image[m].Mcal;
    137       dMcal += image[m].dMcal;
     136      Mcal += 0.001*image[m].Mcal;
     137      dMcal += 0.001*image[m].dMcal;
    138138      Xm += image[m].Xm;
    139139      /* we are using mosaic.Mcal, not image.Mcal. reset image.Mcal */
     
    179179    for (j = 0; j < Nimlist[i]; j++) {
    180180      im = imlist[i][j];
    181       image[im].Mcal = mosaic[i].Mcal;
    182       image[im].dMcal = mosaic[i].dMcal;
     181      image[im].Mcal = 1000.0*mosaic[i].Mcal;
     182      image[im].dMcal = 1000.0*mosaic[i].dMcal;
    183183      image[im].Xm = mosaic[i].Xm;
    184184      image[im].code |= (mosaic[i].code & ID_IMAGE_FEW);
     
    292292}
    293293
    294 short getMmos (int meas, int cat) {
     294float getMmos (int meas, int cat) {
    295295
    296296  int i;
    297   short value;
     297  float value;
    298298
    299299  if (!MOSAICNAME[0]) return (0);
     
    309309
    310310  int i, j, m, c, n, N, Nmax, mark, bad;
    311   short Msys, Mrel, Mcal, Mgrid;
     311  float Msys, Mrel, Mcal, Mgrid;
    312312  double *list, *dlist, *Mlist, *dMlist;
    313313  StatType stats;
     
    351351     
    352352      n = catalog[c].measure[m].averef;
    353       Msys = iPhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
     353      Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);
    354354      list[N]  = Msys - Mrel - Mcal - Mgrid;
    355       dlist[N] = MAX (catalog[c].measure[m].dM, MIN_ERROR);
    356       Mlist[N] = 0.001*Msys;
    357       dMlist[N] = 0.001*list[N];
     355      dlist[N] = MAX (catalog[c].measure[m].dM_PS, MIN_ERROR);
     356      Mlist[N] = Msys;
     357      dMlist[N] = list[N];
    358358      N++;
    359359    }
  • trunk/Ohana/src/relphot/src/StarOps.c

    r4796 r4865  
    2020
    2121
    22 short getMrel (Catalog *catalog, int meas, int cat) {
     22float getMrel (Catalog *catalog, int meas, int cat) {
    2323
    2424  int ave;
    25   short value;
     25  float value;
    2626
    2727  ave = catalog[cat].measure[meas].averef;
    2828  if (catalog[cat].average[ave].code & STAR_BAD) return (NO_MAG); 
    2929 
    30   value = PhotPrimary ? catalog[cat].average[ave].M : catalog[cat].secfilt[PhotNsec*ave+PhotSec].M;
     30  value = PhotPrimary ? catalog[cat].average[ave].M_PS : catalog[cat].secfilt[PhotNsec*ave+PhotSec].M_PS;
    3131  return (value);
    3232}
     
    3535
    3636  int i, j, k, m, N;
    37   short Msys, Mcal, Mmos, Mgrid;
     37  float Msys, Mcal, Mmos, Mgrid;
    3838  StatType stats;
    3939
     
    5252        if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;
    5353
    54         Msys = iPhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
     54        Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
    5555        list[N] = Msys - Mcal - Mmos - Mgrid;
    56         dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
     56        dlist[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
    5757        N++;
    5858      }
     
    6666
    6767      if (PhotPrimary) {
    68         catalog[i].average[j].M = stats.mean;
    69         catalog[i].average[j].dM = stats.sigma;
     68        catalog[i].average[j].M_PS = stats.mean;
     69        catalog[i].average[j].dM_PS = stats.sigma;
    7070        catalog[i].average[j].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG;
    7171      } else {
    72         catalog[i].secfilt[PhotNsec*j+PhotSec].M  = stats.mean;
    73         catalog[i].secfilt[PhotNsec*j+PhotSec].dM = stats.sigma;
     72        catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS  = stats.mean;
     73        catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS = stats.sigma;
    7474        catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG;
    7575      }     
     
    8282
    8383  int i, j, k, m, N, Nmax;
    84   short Msys, Mcal, Mmos, Mgrid;
     84  float Msys, Mcal, Mmos, Mgrid;
    8585  double *list, *dlist;
    8686  StatType stats;
     
    110110        if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;
    111111
    112         Msys = iPhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
     112        Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
    113113        list[N] = Msys - Mcal - Mmos - Mgrid;
    114         dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
     114        dlist[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
    115115        N++;
    116116      }
     
    122122      /* use sigma or error in dM for output? */
    123123      if (PhotPrimary) {
    124         catalog[i].average[j].M = stats.mean;
    125         catalog[i].average[j].dM = MAX (stats.sigma, stats.error);
     124        catalog[i].average[j].M_PS = stats.mean;
     125        catalog[i].average[j].dM_PS = MAX (stats.sigma, stats.error);
    126126        catalog[i].average[j].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG;
    127127      } else {
    128         catalog[i].secfilt[PhotNsec*j+PhotSec].M  = stats.mean;
    129         catalog[i].secfilt[PhotNsec*j+PhotSec].dM = MAX (stats.error, stats.sigma);
     128        catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS  = stats.mean;
     129        catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS = MAX (stats.error, stats.sigma);
    130130        catalog[i].secfilt[PhotNsec*j+PhotSec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NO_MAG;
    131131      }     
     
    142142
    143143  int i, j, k, m;
    144   short Mcal, Mmos, Mgrid;
     144  float Mcal, Mmos, Mgrid;
    145145
    146146  MEAS_BAD = ID_MEAS_NOCAL;
     
    156156        if ((Mmos  = getMmos  (m, i)) == NO_MAG) continue;
    157157        if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;
    158         catalog[i].measure[m].Mcal = Mcal + Mmos + Mgrid;
     158        catalog[i].measure[m].Mcal_PS = Mcal + Mmos + Mgrid;
    159159      }
    160160    }
     
    166166
    167167  int i, j, Ndel, Nave, Ntot, mark;
    168   short dM, Xm;
     168  float dM, Xm;
    169169  double Chisq, MaxScatter, MaxChisq;
    170170  double *xlist, *slist, *dlist;
     
    187187      Chisq = pow (10.0, 0.01*Xm);
    188188      xlist[Ntot] = Chisq;
    189       slist[Ntot] = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM;
     189      slist[Ntot] = PhotPrimary ? catalog[i].average[j].dM_PS : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;
    190190      dlist[Ntot] = 1;
    191191      Ntot ++;
     
    198198  liststats (slist, dlist, Ntot, &stats);
    199199  MaxScatter = MAX (STAR_SCATTER, 2*stats.median);
    200   fprintf (stderr, "Max Scatter: %f, Max Chisq: %f\n", 0.001*MaxScatter, MaxChisq);
     200  fprintf (stderr, "Max Scatter: %f, Max Chisq: %f\n", MaxScatter, MaxChisq);
    201201
    202202  Ndel = Nave = 0;
    203203  for (i = 0; i < Ncatalog; i++) {
    204204    for (j = 0; j < catalog[i].Naverage; j++) {
    205       dM = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM;
    206       Xm = PhotPrimary ? catalog[i].average[j].Xm : catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;
     205      dM = PhotPrimary ? catalog[i].average[j].dM_PS : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;
     206      Xm = PhotPrimary ? catalog[i].average[j].Xm    : catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;
    207207      Chisq = pow (10.0, 0.01*Xm);
    208208      mark = (dM > MaxScatter) || (Xm == NO_MAG) || (Chisq > MaxChisq);
     
    228228  int *ilist;
    229229  double *tlist, *list, *dlist, Ns;
    230   short Msys, Mcal, Mmos, Mgrid;
     230  float Msys, Mcal, Mmos, Mgrid;
    231231  StatType stats;
    232232
     
    267267        if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;
    268268
    269         Msys = iPhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
     269        Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
    270270        list[N] = Msys - Mcal - Mmos - Mgrid;
    271         dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
     271        dlist[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
    272272        N++;
    273273      }
     
    299299        if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;
    300300
    301         Msys = iPhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
     301        Msys = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
    302302        list[N] = Msys - Mcal - Mmos - Mgrid;
    303         dlist[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
     303        dlist[N] = MAX (catalog[i].measure[m].dM_PS, MIN_ERROR);
    304304        ilist[N] = m;
    305305        N++;
     
    422422      if (catalog[i].average[j].code & STAR_BAD) continue; 
    423423
    424       dM = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM;
    425       list[n] = 0.001*dM;
     424      dM = PhotPrimary ? catalog[i].average[j].dM_PS : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;
     425      list[n] = dM;
    426426      dlist[n] = 1;
    427427      n++;
     
    438438
    439439  int i, j, bin;
    440   short dMrel;
     440  float dMrel;
    441441  double *xlist, *Mlist;
    442442  Graphdata graphdata;
     
    451451    for (j = 0; j < catalog[i].Naverage; j++) {
    452452      if (catalog[i].average[j].code & STAR_BAD) continue; 
    453       dMrel = PhotPrimary ? catalog[i].average[j].dM : catalog[i].secfilt[PhotNsec*j+PhotSec].dM;
    454       bin = 0.001*dMrel / 0.0025;
     453      dMrel = PhotPrimary ? catalog[i].average[j].dM_PS : catalog[i].secfilt[PhotNsec*j+PhotSec].dM_PS;
     454      bin = dMrel / 0.0025;
    455455      bin = MAX (0, MIN (NBIN-1, bin));
    456456      Mlist[bin] += 1.0;
     
    482482    for (j = 0; j < catalog[i].Naverage; j++) {
    483483      if (catalog[i].average[j].code & STAR_BAD) continue;
    484       xlist[N] = PhotPrimary ? 0.001*catalog[i].average[j].M : 0.001*catalog[i].secfilt[PhotNsec*j+PhotSec].M;
    485       value    = PhotPrimary ? catalog[i].average[j].Xm : catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;
     484      xlist[N] = PhotPrimary ? catalog[i].average[j].M_PS : catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS;
     485      value    = PhotPrimary ? catalog[i].average[j].Xm   : catalog[i].secfilt[PhotNsec*j+PhotSec].Xm;
    486486      if (value == NO_MAG) continue;
    487487      ylist[N] = 0.01*value;
  • trunk/Ohana/src/relphot/src/args.c

    r4796 r4865  
    113113  if ((N = get_argument (argc, argv, "-minerror"))) {
    114114    remove_argument (N, &argc, argv);
    115     MIN_ERROR = 1000.0*atof (argv[N]);
     115    MIN_ERROR = atof (argv[N]);
    116116    remove_argument (N, &argc, argv);
    117117    /* require MIN_ERROR > 0 */
     
    135135  if ((N = get_argument (argc, argv, "-instmag"))) {
    136136    remove_argument (N, &argc, argv);
    137     ImagMin = 1000*atof (argv[N]);
     137    ImagMin = atof (argv[N]);
    138138    remove_argument (N, &argc, argv);
    139     ImagMax = 1000*atof (argv[N]);
     139    ImagMax = atof (argv[N]);
    140140    remove_argument (N, &argc, argv);
    141141    ImagSelect = TRUE;
  • trunk/Ohana/src/relphot/src/bcatalog.c

    r4796 r4865  
    55  int i, j, offset, ecode;
    66  int NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm;
    7   int mag;
     7  float mag;
    88
    99  /* we are moving only the subset of measurements from catalog[0] to subcatalog[0] */
     
    3131
    3232    if (RESET) {
    33       short *p;
    34       p = (PhotPrimary) ? &subcatalog[0].average[Naverage].M : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].M;
     33      float *p;
     34      p = (PhotPrimary) ? &subcatalog[0].average[Naverage].M_PS : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].M_PS;
    3535      *p = NO_MAG;
    36       p = (PhotPrimary) ? &subcatalog[0].average[Naverage].dM : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].dM;
     36      p = (PhotPrimary) ? &subcatalog[0].average[Naverage].dM_PS : &subcatalog[0].secfilt[PhotNsec*Naverage+PhotSec].dM_PS;
    3737      *p = NO_MAG;
    3838      subcatalog[0].average[Naverage].code &= ~ID_STAR_FEW;
     
    5959
    6060      /* select measurements by mag limit */
    61       mag = iPhotCat (&catalog[0].measure[offset]);
     61      mag = PhotCat (&catalog[0].measure[offset]);
    6262      if (mag > MAG_LIM) continue;
    6363
    6464      /* select measurements by measurement error */
    65       if (catalog[0].measure[offset].dM > SIGMA_LIM) continue;
     65      if (catalog[0].measure[offset].dM_PS > SIGMA_LIM) continue;
    6666
    6767      /* select measurements by mag limit */
    6868      if (ImagSelect) {
    69         mag = iPhotInst (&catalog[0].measure[offset]);
     69        mag = PhotInst (&catalog[0].measure[offset]);
    7070        if (mag < ImagMin) continue;
    7171        if (mag > ImagMax) continue;
     
    7676      subcatalog[0].measure[Nmeasure].averef = Naverage;
    7777      if (RESET) {
    78         subcatalog[0].measure[Nmeasure].Mcal = 0;
     78        subcatalog[0].measure[Nmeasure].Mcal_PS = 0;
    7979        subcatalog[0].measure[Nmeasure].flags &= 0xff00;
    8080        subcatalog[0].measure[Nmeasure].flags &= ~ID_MEAS_POOR;
  • trunk/Ohana/src/relphot/src/plot_scatter.c

    r4796 r4865  
    44
    55  int i, j, k, m, N, Ntot;
    6   short Mrel, Mcal, Mmos, Mgrid;
     6  float Mrel, Mcal, Mmos, Mgrid;
    77  double *xlist, *ylist, *ilist;
    88  Graphdata graphdata;
     
    3232        if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;
    3333
    34         Mrel = PhotPrimary ? catalog[i].average[j].M : catalog[i].secfilt[PhotNsec*j+PhotSec].M;
     34        Mrel = PhotPrimary ? catalog[i].average[j].M_PS : catalog[i].secfilt[PhotNsec*j+PhotSec].M_PS;
    3535        xlist[N] = Mrel;
    36         ylist[N] = iPhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]) - Mcal - Mmos - Mgrid - Mrel;
     36        ylist[N] = PhotSys (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]) - Mcal - Mmos - Mgrid - Mrel;
    3737        ilist[N] = PhotInst (&catalog[i].measure[m]);
    38         xlist[N] *= 0.001;
    39         ylist[N] *= 0.001;
    4038        N++;
    4139      }
  • trunk/Ohana/src/relphot/src/setMrelFinal.c

    r4796 r4865  
    44
    55  int i, j, m, ecode;
    6   short *p;
     6  float *p;
     7  short *q;
    78
    89  /* if we reset the catalog, reset all the current measurements */
     
    1011
    1112    for (i = 0; i < catalog[0].Naverage; i++) {
    12       p = (PhotPrimary) ? &catalog[0].average[i].M : &catalog[0].secfilt[PhotNsec*i+PhotSec].M;
     13      p = (PhotPrimary) ? &catalog[0].average[i].M_PS  : &catalog[0].secfilt[PhotNsec*i+PhotSec].M_PS;
    1314      *p = NO_MAG;
    14       p = (PhotPrimary) ? &catalog[0].average[i].dM : &catalog[0].secfilt[PhotNsec*i+PhotSec].dM;
     15      p = (PhotPrimary) ? &catalog[0].average[i].dM_PS : &catalog[0].secfilt[PhotNsec*i+PhotSec].dM_PS;
    1516      *p = NO_MAG;
    16       p = (PhotPrimary) ? &catalog[0].average[i].Xm : &catalog[0].secfilt[PhotNsec*i+PhotSec].Xm;
    17       *p = NO_MAG;
     17      q = (PhotPrimary) ? &catalog[0].average[i].Xm : &catalog[0].secfilt[PhotNsec*i+PhotSec].Xm;
     18      *q = NO_MAG;
    1819
    1920      m = catalog[0].average[i].offset;
     
    3031        }
    3132       
    32         catalog[0].measure[m].Mcal = 0;
     33        catalog[0].measure[m].Mcal_PS = 0;
    3334        catalog[0].measure[m].flags &= 0xff00;
    3435        catalog[0].measure[m].flags &= ~ID_MEAS_POOR;
     
    7273  int i, k, m, ecode, d1, d2;
    7374  int Ntot, Ntry, Nkeep, Nskip;
    74   short mag;
     75  float mag;
    7576
    7677  Ntot = Ntry = Nskip = Nkeep = 0;
     
    114115      /* skip measurements by inst mag limit */
    115116      if ((pass < 4) && ImagSelect) {
    116         mag = iPhotInst (&catalog[0].measure[m]);
     117        mag = PhotInst (&catalog[0].measure[m]);
    117118        if (mag < ImagMin) goto skip;
    118119        if (mag > ImagMax) goto skip;
  • trunk/Ohana/src/uniphot/include/uniphot.h

    r4864 r4865  
    3030typedef struct {
    3131  char label[64];
    32   short int M;
    33   short int dM;
    34   short int dMsub;
     32  float M;
     33  float dM;
     34  float dMsub;
    3535  double v1, v2;
    3636  Image **image;
  • trunk/Ohana/src/uniphot/src/update_catalog.c

    r4797 r4865  
    55  int i, j, m, found;
    66  int Primary, Nsec, Nsecfilt;
    7   short *Mp;
     7  float *Mp;
    88  PhotCode *code;
    99
     
    1515  for (i = 0; i < catalog[0].Naverage; i++) {
    1616   
    17     Mp = Primary ? &catalog[0].average[i].M : &catalog[0].secfilt[i*Nsecfilt+Nsec].M;
     17    Mp = Primary ? &catalog[0].average[i].M_PS : &catalog[0].secfilt[i*Nsecfilt+Nsec].M_PS;
    1818    if (*Mp != NO_MAG) *Mp += sgroup[0].M;
    1919
     
    2424      if (code[0].type != PHOT_DEP) continue;
    2525      if (code[0].equiv != photcode[0].code) continue;
    26       catalog[0].measure[m].Mcal -= sgroup[0].M;
     26      catalog[0].measure[m].Mcal_PS -= sgroup[0].M;
    2727      found ++;
    2828    }
Note: See TracChangeset for help on using the changeset viewer.