Changeset 38153 for trunk/Ohana/src/dvolens
- Timestamp:
- Apr 18, 2015, 6:33:51 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
- 1 copied
-
. (modified) (1 prop)
-
Ohana/src/dvolens/Makefile (modified) (2 diffs)
-
Ohana/src/dvolens/include/dvolens.h (modified) (2 diffs)
-
Ohana/src/dvolens/src/myIndex.c (copied) (copied from branches/eam_branches/ipp-20150405/Ohana/src/dvolens/src/myIndex.c )
-
Ohana/src/dvolens/src/update_objects_catalog.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20150405 (added) merged: 38084-38085,38098-38101,38135-38136,38139-38143,38146-38152
- Property svn:mergeinfo changed
-
trunk/Ohana/src/dvolens/Makefile
r37358 r38153 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 \ -
trunk/Ohana/src/dvolens/include/dvolens.h
r37358 r38153 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); -
trunk/Ohana/src/dvolens/src/update_objects_catalog.c
r37358 r38153 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) { … … 11 13 int Nsecfilt = GetPhotcodeNsecfilt (); 12 14 15 float *Mxx_obj = NULL; 16 float *Mxy_obj = NULL; 17 float *Myy_obj = NULL; 18 19 ALLOCATE (Mxx_obj, float, Nsecfilt); 20 ALLOCATE (Mxy_obj, float, Nsecfilt); 21 ALLOCATE (Myy_obj, float, Nsecfilt); 22 13 23 // I think we have already allocated lensobj 14 24 REALLOCATE (catalog->lensobj, Lensobj, catalog->Naverage * Nsecfilt); … … 19 29 int Nlensobj = 0; 20 30 31 myIndexType *measureIndex = myIndexAlloc(); 32 21 33 for (i = 0; i < catalog->Naverage; i++) { 22 34 Average *average = &catalog->average[i]; … … 27 39 for (j = 0; j < Nsecfilt; j++) { 28 40 dvo_lensobj_init (&lensobj[j], TRUE); // init accumulated values to 0 41 Mxx_obj[j] = 0.0; 42 Mxy_obj[j] = 0.0; 43 Myy_obj[j] = 0.0; 29 44 } 30 45 31 46 // reset the average values 32 33 47 off_t Loff = average->lensingOffset; 34 48 off_t Moff = average->measureOffset; 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 } 35 66 36 67 // loop over the lensing measurements. for each one, I need to find the corresponding measurement (make an index in lensing?) … … 41 72 if (!isfinite(lensing->X11_sm_obj)) continue; 42 73 74 // pointer from lensing entry to corresponding measure entry (keep updated?) 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]; 84 myAssert (measure->imageID == lensing->imageID, "oops, deux"); 85 86 # if (0) 43 87 Measure *measure = NULL; 44 88 int found = FALSE; … … 54 98 abort(); 55 99 } 100 # endif 56 101 57 102 // skip measurements that do not match the current photcode … … 67 112 if (measure->psfQFperf < 0.85) continue; 68 113 69 114 // I should probably only use lensing entries which correspond to warps 115 // included in the mean warp flux (setMrelCatalog.c) 116 if ((measure->dbFlags & ID_MEAS_WARP_USED) == 0) continue; 117 118 Mxx_obj[Nsec] += measure->Mxx; 119 Mxy_obj[Nsec] += measure->Mxy; 120 Myy_obj[Nsec] += measure->Myy; 121 70 122 lensobj[Nsec].X11_sm_obj += lensing->X11_sm_obj; 71 123 lensobj[Nsec].X12_sm_obj += lensing->X12_sm_obj; … … 92 144 lensobj[Nsec]. E2_sh_psf += lensing-> E2_sh_psf; 93 145 94 lensobj[Nsec]. F_ApR5 += lensing-> F_ApR5; 95 lensobj[Nsec].dF_ApR5 += SQ(lensing->dF_ApR5); 96 lensobj[Nsec].sF_ApR5 += SQ(lensing->sF_ApR5); 97 lensobj[Nsec].fF_ApR5 += lensing->fF_ApR5; 98 99 lensobj[Nsec]. F_ApR6 += lensing-> F_ApR6; 100 lensobj[Nsec].dF_ApR6 += SQ(lensing->dF_ApR6); 101 lensobj[Nsec].sF_ApR6 += SQ(lensing->sF_ApR6); 102 lensobj[Nsec].fF_ApR6 += lensing->fF_ApR6; 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); 149 150 // lensing->F_ApR5, etc need to be in units of DN/sec 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; 103 167 104 168 lensobj[Nsec].Nmeas ++; … … 139 203 lensobj[j].sF_ApR5 /= Nmeas; 140 204 lensobj[j].fF_ApR5 /= Nmeas; 205 141 206 lensobj[j]. F_ApR6 /= Nmeas; 142 207 lensobj[j].dF_ApR6 /= Nmeas; … … 144 209 lensobj[j].fF_ApR6 /= Nmeas; 145 210 211 lensobj[j]. F_ApR7 /= Nmeas; 212 lensobj[j].dF_ApR7 /= Nmeas; 213 lensobj[j].sF_ApR7 /= Nmeas; 214 lensobj[j].fF_ApR7 /= Nmeas; 215 146 216 lensobj[j].dF_ApR5 = sqrt(lensobj[j].dF_ApR5); 147 217 lensobj[j].sF_ApR5 = sqrt(lensobj[j].sF_ApR5); 148 218 lensobj[j].dF_ApR6 = sqrt(lensobj[j].dF_ApR6); 149 219 lensobj[j].sF_ApR6 = sqrt(lensobj[j].sF_ApR6); 220 lensobj[j].dF_ApR7 = sqrt(lensobj[j].dF_ApR7); 221 lensobj[j].sF_ApR7 = sqrt(lensobj[j].sF_ApR7); 150 222 151 223 // somewhere in here I should calculate the values of E1, E2, and gamma 224 225 float e0 = Mxx_obj[j] + Myy_obj[j]; 226 lensobj[j].E1 = (Mxx_obj[j] - Myy_obj[j]) / e0; 227 lensobj[j].E2 = 2.0 * Mxy_obj[j] / e0; 152 228 } 153 229 … … 159 235 } 160 236 237 free (Mxx_obj); 238 free (Mxy_obj); 239 free (Myy_obj); 240 241 myIndexFree (measureIndex); 242 161 243 catalog->Nlensobj = Nlensobj; 162 244 catalog->Nlensobj_disk = 0;
Note:
See TracChangeset
for help on using the changeset viewer.
