IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42044


Ignore:
Timestamp:
Feb 17, 2022, 11:51:38 AM (4 years ago)
Author:
eugene
Message:

radial aperture fluxes onto lensing elements, overloading the X11, etc values

Location:
branches/eam_branches/ipp-20211108/Ohana/src/addstar/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20211108/Ohana/src/addstar/src/FilterStars.c

    r40291 r42044  
    77 * *** bad photFlags
    88 */
     9
     10// As a temporary hack, I am going to overload the following fields with radial aperture values
     11// from the convolved images:
     12
     13# define  F_ApR5_C1 X11_sm_obj
     14# define dF_ApR5_C1  E1_sm_obj
     15# define  F_ApR6_C1 X22_sm_obj
     16# define dF_ApR6_C1  E2_sm_obj
     17# define  F_ApR7_C1 X11_sh_obj
     18# define dF_ApR7_C1  E2_sh_obj
     19
     20# define  F_ApR5_C2 X11_sm_psf
     21# define dF_ApR5_C2  E1_sm_psf
     22# define  F_ApR6_C2 X22_sm_psf
     23# define dF_ApR6_C2  E2_sm_psf
     24# define  F_ApR7_C2 X11_sh_psf
     25# define dF_ApR7_C2  E2_sh_psf
    926
    1027// the imageID supplied here is the sequence **within this set**
     
    133150      if (!isnan(outcat->lensing[N].dF_ApR7)) outcat->lensing[N].dF_ApR7 /= image[0].exptime;
    134151      if (!isnan(outcat->lensing[N].sF_ApR7)) outcat->lensing[N].sF_ApR7 /= image[0].exptime;
     152
     153      // XXX optionall use these overloaded names?
     154      if (!isnan(outcat->lensing[N]. F_ApR5_C1)) outcat->lensing[N]. F_ApR5_C1 /= image[0].exptime;
     155      if (!isnan(outcat->lensing[N].dF_ApR5_C1)) outcat->lensing[N].dF_ApR5_C1 /= image[0].exptime;
     156      if (!isnan(outcat->lensing[N]. F_ApR6_C1)) outcat->lensing[N]. F_ApR6_C1 /= image[0].exptime;
     157      if (!isnan(outcat->lensing[N].dF_ApR6_C1)) outcat->lensing[N].dF_ApR6_C1 /= image[0].exptime;
     158      if (!isnan(outcat->lensing[N]. F_ApR7_C1)) outcat->lensing[N]. F_ApR7_C1 /= image[0].exptime;
     159      if (!isnan(outcat->lensing[N].dF_ApR7_C1)) outcat->lensing[N].dF_ApR7_C1 /= image[0].exptime;
     160
     161      if (!isnan(outcat->lensing[N]. F_ApR5_C2)) outcat->lensing[N]. F_ApR5_C2 /= image[0].exptime;
     162      if (!isnan(outcat->lensing[N].dF_ApR5_C2)) outcat->lensing[N].dF_ApR5_C2 /= image[0].exptime;
     163      if (!isnan(outcat->lensing[N]. F_ApR6_C2)) outcat->lensing[N]. F_ApR6_C2 /= image[0].exptime;
     164      if (!isnan(outcat->lensing[N].dF_ApR6_C2)) outcat->lensing[N].dF_ApR6_C2 /= image[0].exptime;
     165      if (!isnan(outcat->lensing[N]. F_ApR7_C2)) outcat->lensing[N]. F_ApR7_C2 /= image[0].exptime;
     166      if (!isnan(outcat->lensing[N].dF_ApR7_C2)) outcat->lensing[N].dF_ApR7_C2 /= image[0].exptime;
    135167    }
    136168   
  • branches/eam_branches/ipp-20211108/Ohana/src/addstar/src/ReadXradFITS.c

    r38654 r42044  
    11# include "addstar.h"
     2
     3// As a temporary hack, I am going to overload the following fields with radial aperture values
     4// from the convolved images:
     5
     6# define  F_ApR5_C1 X11_sm_obj
     7# define dF_ApR5_C1  E1_sm_obj
     8# define  F_ApR6_C1 X22_sm_obj
     9# define dF_ApR6_C1  E2_sm_obj
     10# define  F_ApR7_C1 X11_sh_obj
     11# define dF_ApR7_C1  E2_sh_obj
     12
     13# define  F_ApR5_C2 X11_sm_psf
     14# define dF_ApR5_C2  E1_sm_psf
     15# define  F_ApR6_C2 X22_sm_psf
     16# define dF_ApR6_C2  E2_sm_psf
     17# define  F_ApR7_C2 X11_sh_psf
     18# define dF_ApR7_C2  E2_sh_psf
    219
    320// given a file with the pointer at the start of the table block and the
     
    2441
    2542  // I want to read the following columns from this table:
     43  // All of these fields should have the same number of rows
     44  // the APER_* fields should have the same number of columns (number of radii)
    2645 
    2746  off_t Nrow, NrowAlt;
     
    2948  char type[16], name[80];
    3049
     50  strcpy (name, "IPP_IDET");
     51  int *RadID = gfits_get_bintable_column_data (theader, &table, name, type, &Nrow, &Ncol);
     52  myAssert (!strcmp(type, "int"), "wrong column type for %s\n", name);
     53
     54  strcpy (name, "PSF_FWHM");
     55  float *PSFfwhm = gfits_get_bintable_column_data (theader, &table, name, type, &NrowAlt, &Ncol);
     56  myAssert (!strcmp(type, "float"), "wrong column type for %s\n", name);
     57  myAssert (Nrow == NrowAlt, "row mismatch?");
     58
    3159  strcpy (name, "APER_FLUX");
    32   float *AperFlux = gfits_get_bintable_column_data (theader, &table, name, type, &Nrow, &Ncol);
     60  float *AperFlux = gfits_get_bintable_column_data (theader, &table, name, type, &NrowAlt, &Ncol);
    3361  myAssert (!strcmp(type, "float"), "wrong column type for %s\n", name);
     62  myAssert (Nrow == NrowAlt, "row mismatch?");
     63  fprintf (stderr, "reading APER_FLUX for %d apertures\n", Ncol);
    3464
    3565  strcpy (name, "APER_FLUX_ERR");
    3666  float *AperFluxErr = gfits_get_bintable_column_data (theader, &table, name, type, &NrowAlt, &NcolAlt);
    3767  myAssert (!strcmp(type, "float"), "wrong column type for %s\n", name);
    38   myAssert (Nrow == NrowAlt, "column mismatch?");
     68  myAssert (Nrow == NrowAlt, "row mismatch?");
    3969  myAssert (Ncol == NcolAlt, "column mismatch?");
    4070
     
    4272  float *AperFluxStd = gfits_get_bintable_column_data (theader, &table, name, type, &NrowAlt, &NcolAlt);
    4373  myAssert (!strcmp(type, "float"), "wrong column type for %s\n", name);
    44   myAssert (Nrow == NrowAlt, "column mismatch?");
     74  myAssert (Nrow == NrowAlt, "row mismatch?");
    4575  myAssert (Ncol == NcolAlt, "column mismatch?");
    4676
     
    4878  float *AperFill = gfits_get_bintable_column_data (theader, &table, name, type, &NrowAlt, &NcolAlt);
    4979  myAssert (!strcmp(type, "float"), "wrong column type for %s\n", name);
    50   myAssert (Nrow == NrowAlt, "column mismatch?");
     80  myAssert (Nrow == NrowAlt, "row mismatch?");
    5181  myAssert (Ncol == NcolAlt, "column mismatch?");
    5282
    53   strcpy (name, "IPP_IDET");
    54   int *RadID = gfits_get_bintable_column_data (theader, &table, name, type, &NrowAlt, &NcolAlt);
    55   myAssert (!strcmp(type, "int"), "wrong column type for %s\n", name);
    56   myAssert (Nrow == NrowAlt, "column mismatch?");
     83  // XXX this is not a bug, it is guaranteed since we have 3 convolution targets (raw, 6pix, 8pix)
     84  // if (Nrow > catalog->Nmeasure) {
     85  //   myAbort("more radial measurements than stars?  seems like a bug\n");
     86  // }
    5787
    58   if (Nrow > catalog->Nmeasure) {
    59     myAbort("more radial measurements than stars?  seems like a bug\n");
     88  // myAssert (catalog->lensing, "lensing is not allocated");
     89  // we could allocate here, or just insist this is an error?
     90  if (!catalog->lensing) {
     91    ALLOCATE (catalog->lensing, Lensing, catalog->Nmeasure);
     92    catalog->Nlensing = catalog->Nmeasure;
    6093  }
    6194
    62   myAssert (catalog->lensing, "lensing is not allocated");
    63   // we could allocate here, or just insist this is an error?
    64   // if (!catalog->lensing) {
    65   //   ALLOCATE (catalog->lensing, Lensing, catalog->Nmeasure);
    66   // }
     95  // In the loop below, we need to assign the 3 fwhm values to the three sets of structure
     96  // elements. I believe the sequence is fixed (RAW, C1, C2).  Get the fwhm values from the
     97  // first entry and compare to the rest
     98
     99  float fwhmValues[3];
     100  fwhmValues[0] = PSFfwhm[0];
     101  fwhmValues[1] = PSFfwhm[1];
     102  fwhmValues[2] = PSFfwhm[2];
    67103
    68104  int i;
    69   int Nap = 0;
     105  int Nap = 0; 
    70106  for (i = 0; i < catalog->Nmeasure; i++) {
     107    dvo_lensing_init (&catalog->lensing[i]);
     108
    71109    if (catalog->measure[i].detID < RadID[Nap]) {
    72110      continue;
     
    74112    }
    75113    if (catalog->measure[i].detID > RadID[Nap]) {
    76       myAbort("radial apertures out of order?  seems like a bug\n");
    77       // this would be a radial aperture which does not have a radial aperture
     114      myAbort("radial apertures for source not in psf list? sources out of order?  seems like a bug\n");
     115      // this could be a radial aperture which does not have a PSF source, but that is not possible
    78116    }
    79117
    80     // we assumed we have already set up lensing in ReadStarsFITS.c
     118    // confirm the 3 FWHM values:
     119    myAssert (fwhmValues[0] == PSFfwhm[Nap+0], "FWHM mismatch %f vs %f", fwhmValues[0], PSFfwhm[Nap+0]);
     120    myAssert (fwhmValues[1] == PSFfwhm[Nap+1], "FWHM mismatch %f vs %f", fwhmValues[1], PSFfwhm[Nap+1]);
     121    myAssert (fwhmValues[2] == PSFfwhm[Nap+2], "FWHM mismatch %f vs %f", fwhmValues[2], PSFfwhm[Nap+2]);
    81122
     123    // EAM 2022.02.17 : here is the comment for the PV3 load:
    82124    // XXX this is all hard-wired and should make use of the headers.
    83125    // psphot cmfs have 5 radial apertures:
     
    85127    // SDSS  3, 4, 5, 6, 7
    86128
    87     catalog->lensing[i]. F_ApR5 = AperFlux   [Nap*Ncol + 2];
    88     catalog->lensing[i].dF_ApR5 = AperFluxErr[Nap*Ncol + 2];
    89     catalog->lensing[i].sF_ApR5 = AperFluxStd[Nap*Ncol + 2];
    90     catalog->lensing[i].fF_ApR5 = AperFill   [Nap*Ncol + 2];
     129    // EAM 2022.02.17 : here is the situation for UNIONS DR3:
     130    // we have 3 convolutions (raw, 6", 8")
     131    // for each we have 6 apertures with max radii of (4, 8, 16, 32, 48, 64) pixels = (1, 2, 4, 8, 12, 16) arcsec
     132    // I am going to save (4, 16, 32) which have index of (0, 2, 3)
    91133
    92     catalog->lensing[i]. F_ApR6 = AperFlux   [Nap*Ncol + 3];
    93     catalog->lensing[i].dF_ApR6 = AperFluxErr[Nap*Ncol + 3];
    94     catalog->lensing[i].sF_ApR6 = AperFluxStd[Nap*Ncol + 3];
    95     catalog->lensing[i].fF_ApR6 = AperFill   [Nap*Ncol + 3];
     134    # define RAD_0 0
     135    # define RAD_1 2
     136    # define RAD_2 3
     137    catalog->lensing[i]. F_ApR5    = AperFlux   [(Nap + 0)*Ncol + RAD_0];
     138    catalog->lensing[i].dF_ApR5    = AperFluxErr[(Nap + 0)*Ncol + RAD_0];
     139    catalog->lensing[i].sF_ApR5    = AperFluxStd[(Nap + 0)*Ncol + RAD_0];
     140    catalog->lensing[i].fF_ApR5    = AperFill   [(Nap + 0)*Ncol + RAD_0];
     141                                   
     142    catalog->lensing[i]. F_ApR6    = AperFlux   [(Nap + 0)*Ncol + RAD_1];
     143    catalog->lensing[i].dF_ApR6    = AperFluxErr[(Nap + 0)*Ncol + RAD_1];
     144    catalog->lensing[i].sF_ApR6    = AperFluxStd[(Nap + 0)*Ncol + RAD_1];
     145    catalog->lensing[i].fF_ApR6    = AperFill   [(Nap + 0)*Ncol + RAD_1];
     146                                   
     147    catalog->lensing[i]. F_ApR7    = AperFlux   [(Nap + 0)*Ncol + RAD_2];
     148    catalog->lensing[i].dF_ApR7    = AperFluxErr[(Nap + 0)*Ncol + RAD_2];
     149    catalog->lensing[i].sF_ApR7    = AperFluxStd[(Nap + 0)*Ncol + RAD_2];
     150    catalog->lensing[i].fF_ApR7    = AperFill   [(Nap + 0)*Ncol + RAD_2];
    96151
    97     catalog->lensing[i]. F_ApR7 = AperFlux   [Nap*Ncol + 4];
    98     catalog->lensing[i].dF_ApR7 = AperFluxErr[Nap*Ncol + 4];
    99     catalog->lensing[i].sF_ApR7 = AperFluxStd[Nap*Ncol + 4];
    100     catalog->lensing[i].fF_ApR7 = AperFill   [Nap*Ncol + 4];
    101     Nap ++;
     152    catalog->lensing[i]. F_ApR5_C1 = AperFlux   [(Nap + 1)*Ncol + RAD_0];
     153    catalog->lensing[i].dF_ApR5_C1 = AperFluxErr[(Nap + 1)*Ncol + RAD_0];
     154    catalog->lensing[i]. F_ApR6_C1 = AperFlux   [(Nap + 1)*Ncol + RAD_1];
     155    catalog->lensing[i].dF_ApR6_C1 = AperFluxErr[(Nap + 1)*Ncol + RAD_1];
     156    catalog->lensing[i]. F_ApR7_C1 = AperFlux   [(Nap + 1)*Ncol + RAD_2];
     157    catalog->lensing[i].dF_ApR7_C1 = AperFluxErr[(Nap + 1)*Ncol + RAD_2];
     158
     159    catalog->lensing[i]. F_ApR5_C2 = AperFlux   [(Nap + 2)*Ncol + RAD_0];
     160    catalog->lensing[i].dF_ApR5_C2 = AperFluxErr[(Nap + 2)*Ncol + RAD_0];
     161    catalog->lensing[i]. F_ApR6_C2 = AperFlux   [(Nap + 2)*Ncol + RAD_1];
     162    catalog->lensing[i].dF_ApR6_C2 = AperFluxErr[(Nap + 2)*Ncol + RAD_1];
     163    catalog->lensing[i]. F_ApR7_C2 = AperFlux   [(Nap + 2)*Ncol + RAD_2];
     164    catalog->lensing[i].dF_ApR7_C2 = AperFluxErr[(Nap + 2)*Ncol + RAD_2];
     165
     166    catalog->lensing[i].detID = catalog->measure[i].detID;
     167
     168    // XXX set the measure, object, etc ID values here
     169    // catalog->lensing[i].objID : set in find_matches_closest.c
     170    // catalog->lensing[i].catID : set in find_matches_closest.c
     171    // catalog->lensing[i].averef : set in find_matches_closest.c
     172    // catalog->lensing[i].imageID : set in FilterStars.c and UpdateImageIDs.c
     173
     174    Nap += 3;
    102175  }
    103176  myAssert (Nap == Nrow, "did we go too far???");
     
    108181  free (AperFluxStd);
    109182  free (AperFill);
     183  free (PSFfwhm);
    110184  free (RadID);
    111185
Note: See TracChangeset for help on using the changeset viewer.