Changeset 38143
- Timestamp:
- Apr 17, 2015, 12:37:52 PM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150405/Ohana/src/dvolens
- Files:
-
- 1 added
- 3 edited
-
Makefile (modified) (2 diffs)
-
include/dvolens.h (modified) (2 diffs)
-
src/myIndex.c (added)
-
src/update_objects_catalog.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150405/Ohana/src/dvolens/Makefile
r37358 r38143 29 29 $(SRC)/help.$(ARCH).o \ 30 30 $(SRC)/initialize.$(ARCH).o \ 31 $(SRC)/myIndex.$(ARCH).o \ 31 32 $(SRC)/update_objects.$(ARCH).o \ 32 33 $(SRC)/update_objects_catalog.$(ARCH).o \ … … 44 45 $(SRC)/help.$(ARCH).o \ 45 46 $(SRC)/initialize.$(ARCH).o \ 47 $(SRC)/myIndex.$(ARCH).o \ 46 48 $(SRC)/update_objects.$(ARCH).o \ 47 49 $(SRC)/update_objects_catalog.$(ARCH).o \ -
branches/eam_branches/ipp-20150405/Ohana/src/dvolens/include/dvolens.h
r37358 r38143 4 4 # include <signal.h> 5 5 # include <pthread.h> 6 7 # ifndef MAX_INT 8 # define MAX_INT 2147483647 9 # endif 10 11 typedef struct { 12 int minID; 13 int maxID; 14 int *index; 15 int Nindex; 16 int NINDEX; 17 } myIndexType; 6 18 7 19 typedef enum { … … 63 75 int client_logger_message PROTO((char *format,...)); 64 76 77 myIndexType *myIndexAlloc (); 78 int myIndexFree (myIndexType *myIndex); 79 void myIndexInit (myIndexType *myIndex); 80 int myIndexUpdateLimits (myIndexType *myIndex, int value); 81 int myIndexSetRange (myIndexType *myIndex); 82 int myIndexSetEntry (myIndexType *myIndex, int value, int entry); 83 int myIndexGetEntry (myIndexType *myIndex, int value); -
branches/eam_branches/ipp-20150405/Ohana/src/dvolens/src/update_objects_catalog.c
r38140 r38143 1 1 # include "dvolens.h" 2 # define SCALE 0.001 3 float MagToFlux (float Mag); // in libdvo, but not exposed? 2 4 3 5 int update_objects_catalog (Catalog *catalog) { … … 26 28 // will either have 0 or Nsecfilt lensobj entries 27 29 int Nlensobj = 0; 30 31 myIndexType *measureIndex = myIndexAlloc(); 28 32 29 33 for (i = 0; i < catalog->Naverage; i++) { … … 44 48 off_t Moff = average->measureOffset; 45 49 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 46 67 // loop over the lensing measurements. for each one, I need to find the corresponding measurement (make an index in lensing?) 47 68 for (Lj = 0; Lj < average->Nlensing; Lj++) { … … 52 73 53 74 // 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]; 58 84 myAssert (measure->imageID == lensing->imageID, "oops, deux"); 59 85 … … 88 114 // I should probably only use lensing entries which correspond to warps 89 115 // 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; 91 117 92 118 Mxx_obj[Nsec] += measure->Mxx; … … 118 144 lensobj[Nsec]. E2_sh_psf += lensing-> E2_sh_psf; 119 145 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); 129 149 130 150 // 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; 148 167 149 168 lensobj[Nsec].Nmeas ++; … … 220 239 free (Myy_obj); 221 240 241 myIndexFree (measureIndex); 242 222 243 catalog->Nlensobj = Nlensobj; 223 244 catalog->Nlensobj_disk = 0;
Note:
See TracChangeset
for help on using the changeset viewer.
