Changeset 42044
- Timestamp:
- Feb 17, 2022, 11:51:38 AM (4 years ago)
- Location:
- branches/eam_branches/ipp-20211108/Ohana/src/addstar/src
- Files:
-
- 2 edited
-
FilterStars.c (modified) (2 diffs)
-
ReadXradFITS.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20211108/Ohana/src/addstar/src/FilterStars.c
r40291 r42044 7 7 * *** bad photFlags 8 8 */ 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 9 26 10 27 // the imageID supplied here is the sequence **within this set** … … 133 150 if (!isnan(outcat->lensing[N].dF_ApR7)) outcat->lensing[N].dF_ApR7 /= image[0].exptime; 134 151 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; 135 167 } 136 168 -
branches/eam_branches/ipp-20211108/Ohana/src/addstar/src/ReadXradFITS.c
r38654 r42044 1 1 # 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 2 19 3 20 // given a file with the pointer at the start of the table block and the … … 24 41 25 42 // 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) 26 45 27 46 off_t Nrow, NrowAlt; … … 29 48 char type[16], name[80]; 30 49 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 31 59 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); 33 61 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); 34 64 35 65 strcpy (name, "APER_FLUX_ERR"); 36 66 float *AperFluxErr = gfits_get_bintable_column_data (theader, &table, name, type, &NrowAlt, &NcolAlt); 37 67 myAssert (!strcmp(type, "float"), "wrong column type for %s\n", name); 38 myAssert (Nrow == NrowAlt, " columnmismatch?");68 myAssert (Nrow == NrowAlt, "row mismatch?"); 39 69 myAssert (Ncol == NcolAlt, "column mismatch?"); 40 70 … … 42 72 float *AperFluxStd = gfits_get_bintable_column_data (theader, &table, name, type, &NrowAlt, &NcolAlt); 43 73 myAssert (!strcmp(type, "float"), "wrong column type for %s\n", name); 44 myAssert (Nrow == NrowAlt, " columnmismatch?");74 myAssert (Nrow == NrowAlt, "row mismatch?"); 45 75 myAssert (Ncol == NcolAlt, "column mismatch?"); 46 76 … … 48 78 float *AperFill = gfits_get_bintable_column_data (theader, &table, name, type, &NrowAlt, &NcolAlt); 49 79 myAssert (!strcmp(type, "float"), "wrong column type for %s\n", name); 50 myAssert (Nrow == NrowAlt, " columnmismatch?");80 myAssert (Nrow == NrowAlt, "row mismatch?"); 51 81 myAssert (Ncol == NcolAlt, "column mismatch?"); 52 82 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 // } 57 87 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; 60 93 } 61 94 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]; 67 103 68 104 int i; 69 int Nap = 0; 105 int Nap = 0; 70 106 for (i = 0; i < catalog->Nmeasure; i++) { 107 dvo_lensing_init (&catalog->lensing[i]); 108 71 109 if (catalog->measure[i].detID < RadID[Nap]) { 72 110 continue; … … 74 112 } 75 113 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 aperture114 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 78 116 } 79 117 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]); 81 122 123 // EAM 2022.02.17 : here is the comment for the PV3 load: 82 124 // XXX this is all hard-wired and should make use of the headers. 83 125 // psphot cmfs have 5 radial apertures: … … 85 127 // SDSS 3, 4, 5, 6, 7 86 128 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) 91 133 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]; 96 151 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; 102 175 } 103 176 myAssert (Nap == Nrow, "did we go too far???"); … … 108 181 free (AperFluxStd); 109 182 free (AperFill); 183 free (PSFfwhm); 110 184 free (RadID); 111 185
Note:
See TracChangeset
for help on using the changeset viewer.
