IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38136


Ignore:
Timestamp:
Apr 16, 2015, 4:19:35 PM (11 years ago)
Author:
eugene
Message:

add code to calculate Mxx,Mxy,Myy -> E1,E2 for each object; calculate mean R7 values

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150405/Ohana/src/dvolens/src/update_objects_catalog.c

    r37358 r38136  
    1111  int Nsecfilt = GetPhotcodeNsecfilt ();
    1212 
     13  float *Mxx_obj = NULL;
     14  float *Mxy_obj = NULL;
     15  float *Myy_obj = NULL;
     16
     17  ALLOCATE (Mxx_obj, float, Nsecfilt);
     18  ALLOCATE (Mxy_obj, float, Nsecfilt);
     19  ALLOCATE (Myy_obj, float, Nsecfilt);
     20
    1321  // I think we have already allocated lensobj
    1422  REALLOCATE (catalog->lensobj, Lensobj, catalog->Naverage * Nsecfilt);
     
    2735    for (j = 0; j < Nsecfilt; j++) {
    2836      dvo_lensobj_init (&lensobj[j], TRUE); // init accumulated values to 0
     37      Mxx_obj[j] = 0.0;
     38      Mxy_obj[j] = 0.0;
     39      Myy_obj[j] = 0.0;
    2940    }
    3041
    3142    // reset the average values
    32 
    3343    off_t Loff = average->lensingOffset;
    3444    off_t Moff = average->measureOffset;
     
    6777      if (measure->psfQFperf < 0.85) continue;
    6878     
    69 
     79      Mxx_obj[Nsec] += measure->Mxx;
     80      Mxy_obj[Nsec] += measure->Mxy;
     81      Myy_obj[Nsec] += measure->Myy;
     82     
    7083      lensobj[Nsec].X11_sm_obj += lensing->X11_sm_obj;
    7184      lensobj[Nsec].X12_sm_obj += lensing->X12_sm_obj;
     
    101114      lensobj[Nsec].sF_ApR6 += SQ(lensing->sF_ApR6);
    102115      lensobj[Nsec].fF_ApR6 += lensing->fF_ApR6;
     116
     117      lensobj[Nsec]. F_ApR7 += lensing-> F_ApR7;
     118      lensobj[Nsec].dF_ApR7 += SQ(lensing->dF_ApR7);
     119      lensobj[Nsec].sF_ApR7 += SQ(lensing->sF_ApR7);
     120      lensobj[Nsec].fF_ApR7 += lensing->fF_ApR7;
    103121
    104122      lensobj[Nsec].Nmeas   ++;
     
    139157      lensobj[j].sF_ApR5 /= Nmeas;
    140158      lensobj[j].fF_ApR5 /= Nmeas;
     159
    141160      lensobj[j]. F_ApR6 /= Nmeas;
    142161      lensobj[j].dF_ApR6 /= Nmeas;
     
    144163      lensobj[j].fF_ApR6 /= Nmeas;
    145164
     165      lensobj[j]. F_ApR7 /= Nmeas;
     166      lensobj[j].dF_ApR7 /= Nmeas;
     167      lensobj[j].sF_ApR7 /= Nmeas;
     168      lensobj[j].fF_ApR7 /= Nmeas;
     169
    146170      lensobj[j].dF_ApR5 = sqrt(lensobj[j].dF_ApR5);
    147171      lensobj[j].sF_ApR5 = sqrt(lensobj[j].sF_ApR5);
    148172      lensobj[j].dF_ApR6 = sqrt(lensobj[j].dF_ApR6);
    149173      lensobj[j].sF_ApR6 = sqrt(lensobj[j].sF_ApR6);
     174      lensobj[j].dF_ApR7 = sqrt(lensobj[j].dF_ApR7);
     175      lensobj[j].sF_ApR7 = sqrt(lensobj[j].sF_ApR7);
    150176
    151177      // somewhere in here I should calculate the values of E1, E2, and gamma
     178
     179      float e0 = Mxx_obj[j] + Myy_obj[j];
     180      lensobj[j].E1 = (Mxx_obj[j] - Myy_obj[j]) / e0;
     181      lensobj[j].E2 = 2.0 * Mxy_obj[j] / e0;
    152182    }
    153183
     
    159189  }
    160190
     191  free (Mxx_obj);
     192  free (Mxy_obj);
     193  free (Myy_obj);
     194
    161195  catalog->Nlensobj = Nlensobj;
    162196  catalog->Nlensobj_disk = 0;
Note: See TracChangeset for help on using the changeset viewer.