IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38143


Ignore:
Timestamp:
Apr 17, 2015, 12:37:52 PM (11 years ago)
Author:
eugene
Message:

apply zero point calibration to R5,R6,R7 data and set mean in Jy

Location:
branches/eam_branches/ipp-20150405/Ohana/src/dvolens
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150405/Ohana/src/dvolens/Makefile

    r37358 r38143  
    2929$(SRC)/help.$(ARCH).o            \
    3030$(SRC)/initialize.$(ARCH).o      \
     31$(SRC)/myIndex.$(ARCH).o         \
    3132$(SRC)/update_objects.$(ARCH).o  \
    3233$(SRC)/update_objects_catalog.$(ARCH).o  \
     
    4445$(SRC)/help.$(ARCH).o            \
    4546$(SRC)/initialize.$(ARCH).o      \
     47$(SRC)/myIndex.$(ARCH).o         \
    4648$(SRC)/update_objects.$(ARCH).o  \
    4749$(SRC)/update_objects_catalog.$(ARCH).o  \
  • branches/eam_branches/ipp-20150405/Ohana/src/dvolens/include/dvolens.h

    r37358 r38143  
    44# include <signal.h>
    55# include <pthread.h>
     6
     7# ifndef MAX_INT
     8# define MAX_INT 2147483647
     9# endif
     10
     11typedef struct {
     12  int minID;
     13  int maxID;
     14  int *index;
     15  int Nindex;
     16  int NINDEX;
     17} myIndexType;
    618
    719typedef enum {
     
    6375int           client_logger_message   PROTO((char *format,...));
    6476
     77myIndexType *myIndexAlloc ();
     78int myIndexFree (myIndexType *myIndex);
     79void myIndexInit (myIndexType *myIndex);
     80int myIndexUpdateLimits (myIndexType *myIndex, int value);
     81int myIndexSetRange (myIndexType *myIndex);
     82int myIndexSetEntry (myIndexType *myIndex, int value, int entry);
     83int myIndexGetEntry (myIndexType *myIndex, int value);
  • branches/eam_branches/ipp-20150405/Ohana/src/dvolens/src/update_objects_catalog.c

    r38140 r38143  
    11# include "dvolens.h"
     2# define SCALE 0.001
     3float MagToFlux (float Mag); // in libdvo, but not exposed?
    24
    35int update_objects_catalog (Catalog *catalog) {
     
    2628  // will either have 0 or Nsecfilt lensobj entries
    2729  int Nlensobj = 0;
     30
     31  myIndexType *measureIndex = myIndexAlloc();
    2832
    2933  for (i = 0; i < catalog->Naverage; i++) {
     
    4448    off_t Moff = average->measureOffset;
    4549
     50    // I have Nmeasure entries for this object.  I need to match measure to lensing (by imageID)
     51    // I could generated a sorted list (imageID, measureSeq) and use bisection to find the desired imageID
     52    // I could make an index measureSeq[imageID-imageIDmin]
     53   
     54    myIndexInit (measureIndex);
     55
     56    // generate an index for these measure entries (based on Mj and imageID)
     57    for (Mj = 0; Mj < average->Nmeasure; Mj++) {
     58      myIndexUpdateLimits (measureIndex, catalog->measure[Moff + Mj].imageID);
     59    }
     60    myIndexSetRange (measureIndex);
     61    for (Mj = 0; Mj < average->Nmeasure; Mj++) {
     62      // if there are duplicates (multiple measures from the same image),
     63      // myIndexSetEntry will only select one
     64      myIndexSetEntry (measureIndex, catalog->measure[Moff + Mj].imageID, Mj);
     65    }
     66
    4667    // loop over the lensing measurements.  for each one, I need to find the corresponding measurement (make an index in lensing?)
    4768    for (Lj = 0; Lj < average->Nlensing; Lj++) {
     
    5273
    5374      // pointer from lensing entry to corresponding measure entry (keep updated?)
    54       int Mseq = lensing->measureSeq;
    55       myAssert (Mseq < average->Nmeasure, "oops");
    56 
    57       Measure *measure = &catalog->measure[Moff + Mseq];
     75      // XX ALT int Mseq = lensing->measureSeq;
     76      // XX ALT myAssert (Mseq < average->Nmeasure, "oops");
     77      // XX ALT Measure *measure = &catalog->measure[Moff + Mseq];
     78      // XX ALT myAssert (measure->imageID == lensing->imageID, "oops, deux");
     79
     80      Mj = myIndexGetEntry (measureIndex, lensing->imageID);
     81      myAssert (Mj > -1, "missing index");
     82
     83      Measure *measure = &catalog->measure[Moff + Mj];
    5884      myAssert (measure->imageID == lensing->imageID, "oops, deux");
    5985
     
    88114      // I should probably only use lensing entries which correspond to warps
    89115      // included in the mean warp flux (setMrelCatalog.c)
    90       if (measure->dbFlags & ID_MEAS_WARP_USED == 0) continue;
     116      if ((measure->dbFlags & ID_MEAS_WARP_USED) == 0) continue;
    91117
    92118      Mxx_obj[Nsec] += measure->Mxx;
     
    118144      lensobj[Nsec]. E2_sh_psf += lensing-> E2_sh_psf;
    119145
    120       myAbort ("NOTE: relphot needs to set measure->Mcal -- is this happening or not??");
    121 
    122       int Np = photcodes[0].hashcode[measure[0].photcode];
    123       if (Np == -1) return (NAN);
    124       PhotCode *code = &photcodes[0].code[Np];
    125      
    126       float Mdef = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;
    127       float Moff = Mdef + 8.9 - measure->Mcal;
    128       float Foff = 3630.8 * MagToFlux(Moff);
     146      // relphot sets measure->Mcal (setMcalOutput.c, called by setMrelFinal.c)
     147      float Mcal = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure->Mcal;
     148      float Fcal = 3630.8 * MagToFlux(Mcal);
    129149
    130150      // lensing->F_ApR5, etc need to be in units of DN/sec
    131       // Foff * lensing->F_ApR5 is in Jy
    132       // XXX this is unweighted -- apply a weighting?
    133 
    134       lensobj[Nsec]. F_ApR5 += Foff * lensing-> F_ApR5;
    135       lensobj[Nsec].dF_ApR5 += SQ(Foff * lensing->dF_ApR5);
    136       lensobj[Nsec].sF_ApR5 += SQ(Foff * lensing->sF_ApR5);
    137       lensobj[Nsec].fF_ApR5 += Foff * lensing->fF_ApR5;
    138 
    139       lensobj[Nsec]. F_ApR6 += Foff * lensing-> F_ApR6;
    140       lensobj[Nsec].dF_ApR6 += SQ(Foff * lensing->dF_ApR6);
    141       lensobj[Nsec].sF_ApR6 += SQ(Foff * lensing->sF_ApR6);
    142       lensobj[Nsec].fF_ApR6 += Foff * lensing->fF_ApR6;
    143 
    144       lensobj[Nsec]. F_ApR7 += Foff * lensing-> F_ApR7;
    145       lensobj[Nsec].dF_ApR7 += SQ(Foff * lensing->dF_ApR7);
    146       lensobj[Nsec].sF_ApR7 += SQ(Foff * lensing->sF_ApR7);
    147       lensobj[Nsec].fF_ApR7 += Foff * lensing->fF_ApR7;
     151      // Fcal * lensing->F_ApR5 is in Jy
     152
     153      lensobj[Nsec]. F_ApR5 +=    Fcal * lensing-> F_ApR5;
     154      lensobj[Nsec].dF_ApR5 += SQ(Fcal * lensing->dF_ApR5);
     155      lensobj[Nsec].sF_ApR5 += SQ(Fcal * lensing->sF_ApR5);
     156      lensobj[Nsec].fF_ApR5 +=           lensing->fF_ApR5;
     157
     158      lensobj[Nsec]. F_ApR6 +=    Fcal * lensing-> F_ApR6;
     159      lensobj[Nsec].dF_ApR6 += SQ(Fcal * lensing->dF_ApR6);
     160      lensobj[Nsec].sF_ApR6 += SQ(Fcal * lensing->sF_ApR6);
     161      lensobj[Nsec].fF_ApR6 +=           lensing->fF_ApR6;
     162
     163      lensobj[Nsec]. F_ApR7 +=    Fcal * lensing-> F_ApR7;
     164      lensobj[Nsec].dF_ApR7 += SQ(Fcal * lensing->dF_ApR7);
     165      lensobj[Nsec].sF_ApR7 += SQ(Fcal * lensing->sF_ApR7);
     166      lensobj[Nsec].fF_ApR7 +=           lensing->fF_ApR7;
    148167
    149168      lensobj[Nsec].Nmeas   ++;
     
    220239  free (Myy_obj);
    221240
     241  myIndexFree (measureIndex);
     242
    222243  catalog->Nlensobj = Nlensobj;
    223244  catalog->Nlensobj_disk = 0;
Note: See TracChangeset for help on using the changeset viewer.