IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 22, 2014, 5:21:17 PM (12 years ago)
Author:
eugene
Message:

handle PS1_SV3 format in addstar

Location:
branches/eam_branches/ipp-20140610/Ohana/src/addstar
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/ReadStarsFITS.c

    r36921 r36934  
    12101210  ZeroPt = GetZeroPoint();
    12111211
    1212   fprintf (stderr, "WARNING: Convert_PS1_SV3 not yet updated to match real format\n");
    1213 
    12141212  ALLOCATE (stars, Stars, Nstars);
    12151213  for (i = 0; i < Nstars; i++) {
     
    12311229    stars[i].measure.dMcal      = ps1data[i].dMcal;
    12321230    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     1231    stars[i].measure.dMap       = (ps1data[i].apFlux > 0.0) ? fabs(ps1data[i].apFluxErr / ps1data[i].apFlux) : NAN;
    12331232                       
    12341233    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
     
    12401239    stars[i].measure.FluxKron   = ps1data[i].kronFlux;
    12411240    stars[i].measure.dFluxKron  = ps1data[i].kronFluxErr;
     1241    stars[i].measure.FluxAp     = ps1data[i].apFlux;
     1242    stars[i].measure.dFluxAp    = ps1data[i].apFluxErr;
    12421243
    12431244    stars[i].measure.Sky        = ps1data[i].sky;
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/src/mkcmf.c

    r36921 r36934  
    2121void writeStars_PS1_V2 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars);
    2222void writeStars_PS1_V1 (FTable *ftable, double *X, double *Y, double *M, int Nstars);
     23void writeStars_PS1_SV3 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars);
    2324void writeStars_PS1_DEV_1 (FTable *ftable, double *X, double *Y, double *M, int Nstars);
    2425void writeStars_PS1_DEV_0 (FTable *ftable, double *X, double *Y, double *M, int Nstars);
     
    339340  if (!strcmp(type, "PS1_V5_Lensing")) {
    340341    writeStars_PS1_V5_Lensing (&ftable, X, Y, M, Flag, Nstars);
     342    found = TRUE;
     343  }
     344  if (!strcmp(type, "PS1_SV3")) {
     345    writeStars_PS1_SV3 (&ftable, X, Y, M, Flag, Nstars);
    341346    found = TRUE;
    342347  }
     
    885890}
    886891
    887 void writeStars_PS1_V5_Lensing (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars) {
     892void writeStars_PS1_SV3 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars) {
    888893
    889894  int i;
    890   CMF_PS1_V5_Lensing *stars;
     895  CMF_PS1_SV3 *stars;
    891896  float flux, fSN;
    892897
    893898  // XXX add gaussian-distributed noise based on counts
    894899  // this needs to make different output 'stars' entries depending on the desired type
    895   ALLOCATE (stars, CMF_PS1_V5_Lensing, Nstars);
     900  ALLOCATE (stars, CMF_PS1_SV3, Nstars);
    896901  for (i = 0; i < Nstars; i++) {
    897902
     
    964969    stars[i].Mrh       = FX;
    965970
    966     stars[i].X11_sm_obj = FX;
    967     stars[i].X12_sm_obj = FX;
    968     stars[i].X22_sm_obj = FY;
    969     stars[i].E1_sm_obj  = FX;
    970     stars[i].E2_sm_obj  = FX;
    971 
    972     stars[i].X11_sh_obj = FX;
    973     stars[i].X12_sh_obj = 0.2;
    974     stars[i].X22_sh_obj = FY;
    975     stars[i].E1_sh_obj  = FX*0.9;
    976     stars[i].E2_sh_obj  = FX*0.8;
    977 
    978     stars[i].X11_sm_psf = FX;
    979     stars[i].X12_sm_psf = FX;
    980     stars[i].X22_sm_psf = FX;
    981     stars[i].E1_sm_psf  = FX;
    982     stars[i].E2_sm_psf  = FX;
    983 
    984     stars[i].X11_sh_psf = FX;
    985     stars[i].X12_sh_psf = FX;
    986     stars[i].X22_sh_psf = FX;
    987     stars[i].E1_sh_psf  = FX;
    988     stars[i].E2_sh_psf  = FX;
    989 
    990971    stars[i].kronFlux  = flux * 1.25;
    991972    stars[i].kronFluxErr = fSN * flux * 1.25;
     
    994975    stars[i].kronOuter = fSN * flux * 1.5;
    995976
    996     stars[i].skyLimitRad = 1;
    997     stars[i].skyLimitFlux = 2;
    998     stars[i].skyLimitSlope = 0.2;
     977    // stars[i].skyLimitRad = 1;
     978    // stars[i].skyLimitFlux = 2;
     979    // stars[i].skyLimitSlope = 0.2;
    999980
    1000981    stars[i].flags     = Flag[i];
     
    1014995  }
    1015996
     997  gfits_table_set_CMF_PS1_SV3 (ftable, stars, Nstars);
     998  gfits_modify (ftable->header, "EXTTYPE",   "%s", 1, "PS1_SV3");
     999}
     1000
     1001void writeStars_PS1_V5_Lensing (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars) {
     1002
     1003  int i;
     1004  CMF_PS1_V5_Lensing *stars;
     1005  float flux, fSN;
     1006
     1007  // XXX add gaussian-distributed noise based on counts
     1008  // this needs to make different output 'stars' entries depending on the desired type
     1009  ALLOCATE (stars, CMF_PS1_V5_Lensing, Nstars);
     1010  for (i = 0; i < Nstars; i++) {
     1011
     1012    flux = pow (10.0, -0.4*M[i]);
     1013    fSN = 1.0 / sqrt(flux);
     1014
     1015    stars[i].detID = i;
     1016    stars[i].X = X[i];
     1017    stars[i].Y = Y[i];
     1018    stars[i].dX = FX * fSN;
     1019    stars[i].dY = FY * fSN;
     1020
     1021    stars[i].posangle = 10.0;
     1022    stars[i].pltscale = 0.25;
     1023
     1024    stars[i].M = M[i];
     1025    stars[i].dM = fSN;
     1026
     1027    stars[i].Flux = flux;
     1028    stars[i].dFlux = flux * fSN;
     1029
     1030    stars[i].Map = M[i] - 0.05;
     1031    stars[i].MapRaw = M[i] - 0.10;
     1032
     1033    stars[i].apRadius = 8.0;
     1034
     1035    stars[i].apFlux = pow(10.0, -0.4*stars[i].Map);
     1036    stars[i].apFluxErr = stars[i].apFlux * fSN;
     1037
     1038    stars[i].Mcalib = M[i] + ZERO_POINT + 2.5*log10(exptime);
     1039    stars[i].dMcal = 0.05;
     1040
     1041    XY_to_RD (&stars[i].RA, &stars[i].DEC, X[i], Y[i], &coords);
     1042    stars[i].apNpix = 3.14*8.0*8.0;
     1043
     1044    stars[i].Mpeak     = M[i] + 1.0;
     1045    stars[i].sky       = SKY;
     1046    stars[i].dSky      = DSKY;
     1047    stars[i].psfChisq  = PSFCHI;
     1048    stars[i].crNsigma  = CRN;
     1049    stars[i].extNsigma = EXTN;
     1050    stars[i].fx        = FX;
     1051    stars[i].fy        = FY;
     1052    stars[i].df        = DF;
     1053
     1054    stars[i].k         = 1.0;
     1055    stars[i].fwhmMaj   = FX*2.8;
     1056    stars[i].fwhmMin   = FY*2.8;
     1057
     1058    // randomly give poor PSFQF values
     1059    if ((BAD_PSFQF_FRAC > 0.0) && (drand48() < BAD_PSFQF_FRAC)) {
     1060      stars[i].psfQF     = 0.25;
     1061      stars[i].psfQFperf = 0.24;
     1062    } else {
     1063      stars[i].psfQF     = PSFQUAL;
     1064      stars[i].psfQFperf = MAX(PSFQUAL - 0.01, 0.0);
     1065    }
     1066
     1067    stars[i].psfNdof   = 1;
     1068    stars[i].psfNpix   = 2;
     1069
     1070    stars[i].Mxx       = FX;
     1071    stars[i].Mxy       = 0.01;
     1072    stars[i].Myy       = FX;
     1073    stars[i].M3c       = FX;
     1074    stars[i].M3s       = FX;
     1075    stars[i].M4c       = FX;
     1076    stars[i].M4s       = FX;
     1077    stars[i].Mr1       = FX;
     1078    stars[i].Mrh       = FX;
     1079
     1080    stars[i].X11_sm_obj = FX;
     1081    stars[i].X12_sm_obj = FX;
     1082    stars[i].X22_sm_obj = FY;
     1083    stars[i].E1_sm_obj  = FX;
     1084    stars[i].E2_sm_obj  = FX;
     1085
     1086    stars[i].X11_sh_obj = FX;
     1087    stars[i].X12_sh_obj = 0.2;
     1088    stars[i].X22_sh_obj = FY;
     1089    stars[i].E1_sh_obj  = FX*0.9;
     1090    stars[i].E2_sh_obj  = FX*0.8;
     1091
     1092    stars[i].X11_sm_psf = FX;
     1093    stars[i].X12_sm_psf = FX;
     1094    stars[i].X22_sm_psf = FX;
     1095    stars[i].E1_sm_psf  = FX;
     1096    stars[i].E2_sm_psf  = FX;
     1097
     1098    stars[i].X11_sh_psf = FX;
     1099    stars[i].X12_sh_psf = FX;
     1100    stars[i].X22_sh_psf = FX;
     1101    stars[i].E1_sh_psf  = FX;
     1102    stars[i].E2_sh_psf  = FX;
     1103
     1104    stars[i].kronFlux  = flux * 1.25;
     1105    stars[i].kronFluxErr = fSN * flux * 1.25;
     1106
     1107    stars[i].kronInner = fSN * flux * 0.9;
     1108    stars[i].kronOuter = fSN * flux * 1.5;
     1109
     1110    stars[i].skyLimitRad = 1;
     1111    stars[i].skyLimitFlux = 2;
     1112    stars[i].skyLimitSlope = 0.2;
     1113
     1114    stars[i].flags     = Flag[i];
     1115    stars[i].flags2    = 0x80;
     1116
     1117    stars[i].nFrames   = 1;
     1118
     1119    if (ADDNOISE) {
     1120      stars[i].X += FX * fSN * rnd_gauss(0.0, 1.0);
     1121      stars[i].Y += FY * fSN * rnd_gauss(0.0, 1.0);
     1122      float Moff = fSN*rnd_gauss(0.0, 1.0);
     1123      stars[i].M += Moff;
     1124      stars[i].Map += Moff;
     1125      stars[i].MapRaw += Moff;
     1126      stars[i].Mcalib += Moff;
     1127    }
     1128  }
     1129
    10161130  gfits_table_set_CMF_PS1_V5_Lensing (ftable, stars, Nstars);
    10171131  gfits_modify (ftable->header, "EXTTYPE",   "%s", 1, "PS1_V5");
  • branches/eam_branches/ipp-20140610/Ohana/src/addstar/test/simple.dvo

    r36912 r36934  
    399399  N_FRAMES          : SKIP # not ingested into DVO                   
    400400end                                                                   
     401
     402# this list is good for PS1_SV3
     403list testfields_PS1_SV3
     404  IPP_IDET          : detid     
     405  X_PSF             : xccd     
     406  Y_PSF             : yccd     
     407  X_PSF_SIG         : xccd:err
     408  Y_PSF_SIG         : yccd:err
     409  POSANGLE          : posangle
     410  PLTSCALE          : platescale
     411  PSF_INST_MAG      : mag:inst 
     412  PSF_INST_MAG_SIG  : mag:err   
     413  PSF_INST_FLUX     : flux:inst
     414  PSF_INST_FLUX_SIG : flux:inst:err
     415  AP_MAG            : mag:aper:inst
     416  AP_MAG_RAW        : SKIP # not ingested into DVO
     417  AP_MAG_RADIUS     : SKIP # not ingested into DVO
     418  AP_FLUX           : flux:aper:inst 
     419  AP_FLUX_SIG       : flux:aper:inst:err
     420  CAL_PSF_MAG       : mag:cal
     421  CAL_PSF_MAG_SIG   : mag:cal:err
     422  RA_PSF            : ra
     423  DEC_PSF           : dec
     424  AP_NPIX           : SKIP # not ingested into DVO                   
     425  PEAK_FLUX_AS_MAG  : SKIP # not ingested into DVO                   
     426  SKY               : sky                                             
     427  SKY_SIGMA         : sky_err                                         
     428  PSF_CHISQ         : psf_chisq                                       
     429  CR_NSIGMA         : cr_nsigma                                       
     430  EXT_NSIGMA        : ext_nsigma                                     
     431  PSF_MAJOR         : fwhm_maj # XXX technically, this is not FWHM but Sigma
     432  PSF_MINOR         : fwhm_min # XXX technically, this is not FWHM but Sigma
     433  PSF_THETA         : theta # FAIL                                   
     434  PSF_CORE          : SKIP # not ingested into DVO
     435  PSF_FWHM_MAJ      : SKIP # not ingested into DVO
     436  PSF_FWHM_MIN      : SKIP # not ingested into DVO
     437  PSF_QF            : psf_qf                                         
     438  PSF_QF_PERFECT    : SKIP # not ingested into DVO                   
     439  PSF_NDOF          : psf_ndof                               
     440  PSF_NPIX          : psf_npix                               
     441  MOMENTS_XX        : Mxx                                             
     442  MOMENTS_XY        : Mxy                                             
     443  MOMENTS_YY        : Myy                                             
     444  MOMENTS_M3C       : SKIP # not ingested into DVO                   
     445  MOMENTS_M3S       : SKIP # not ingested into DVO                   
     446  MOMENTS_M4C       : SKIP # not ingested into DVO                   
     447  MOMENTS_M4S       : SKIP # not ingested into DVO                   
     448  MOMENTS_R1        : SKIP # not ingested into DVO                   
     449  MOMENTS_RH        : SKIP # not ingested into DVO                   
     450  KRON_FLUX         : flux:kron:inst                                 
     451  KRON_FLUX_ERR     : flux:kron:inst:err                                     
     452  KRON_FLUX_INNER   : SKIP # not ingested into DVO                       
     453  KRON_FLUX_OUTER   : SKIP # not ingested into DVO                   
     454  FLAGS             : phot_flags                                     
     455  FLAGS2            : SKIP # not ingested into DVO                       
     456  N_FRAMES          : SKIP # not ingested into DVO                   
     457end                                                                   
Note: See TracChangeset for help on using the changeset viewer.