Changeset 42821
- Timestamp:
- May 8, 2025, 4:29:52 PM (12 months ago)
- Location:
- trunk/Ohana
- Files:
-
- 1 deleted
- 74 edited
- 11 copied
-
. (modified) (1 prop)
-
src/addstar/Makefile (modified) (3 diffs)
-
src/addstar/include/addstar.h (modified) (2 diffs)
-
src/addstar/src/ReadStarsFITS.c (modified) (1 diff)
-
src/addstar/src/ReadXradFITS.c (modified) (1 diff)
-
src/addstar/src/args.c (modified) (2 diffs)
-
src/addstar/src/find_matches_closest.c (modified) (2 diffs)
-
src/addstar/src/photcodes.c (copied) (copied from branches/eam_branches/ipp-20230313/Ohana/src/addstar/src/photcodes.c )
-
src/dvomerge/src/dvomergeUpdate_catalogs.c (modified) (1 diff)
-
src/dvomerge/src/merge_catalogs_old.c (modified) (1 diff)
-
src/getstar/include/getstar.h (modified) (1 diff)
-
src/getstar/src/args.c (modified) (1 diff)
-
src/getstar/src/write_getstar_ps1_dev_0.c (modified) (1 diff)
-
src/kapa2/Makefile (modified) (4 diffs)
-
src/kapa2/cmaps (deleted)
-
src/kapa2/colormaps (copied) (copied from branches/eam_branches/ipp-20230313/Ohana/src/kapa2/colormaps )
-
src/kapa2/include/constants.h (modified) (1 diff)
-
src/kapa2/include/prototypes.h (modified) (1 diff)
-
src/kapa2/src (modified) (1 prop)
-
src/kapa2/src/FindColormap.c.in (copied) (copied from branches/eam_branches/ipp-20230313/Ohana/src/kapa2/src/FindColormap.c.in )
-
src/kapa2/src/SetColormap.c (modified) (3 diffs)
-
src/libautocode/def/average-ps1-ref-v2.d (copied) (copied from branches/eam_branches/ipp-20230313/Ohana/src/libautocode/def/average-ps1-ref-v2.d )
-
src/libautocode/def/image-ps1-ref-v2.d (copied) (copied from branches/eam_branches/ipp-20230313/Ohana/src/libautocode/def/image-ps1-ref-v2.d )
-
src/libautocode/def/measure-ps1-ref-v2.d (copied) (copied from branches/eam_branches/ipp-20230313/Ohana/src/libautocode/def/measure-ps1-ref-v2.d )
-
src/libautocode/def/photcode-ps1-ref-v2.d (copied) (copied from branches/eam_branches/ipp-20230313/Ohana/src/libautocode/def/photcode-ps1-ref-v2.d )
-
src/libautocode/def/secfilt-ps1-ref-v2.d (copied) (copied from branches/eam_branches/ipp-20230313/Ohana/src/libautocode/def/secfilt-ps1-ref-v2.d )
-
src/libdvo/include/dvodb.h (modified) (1 diff)
-
src/libdvo/include/libdvo_astro.h (modified) (1 diff)
-
src/libdvo/src/cmf-ps1-v5-r0.c (modified) (1 diff)
-
src/libdvo/src/coordops.c (modified) (3 diffs)
-
src/libdvo/src/dbExtractMeasures.c (modified) (2 diffs)
-
src/libdvo/src/dvo_photcode_utils.c (modified) (2 diffs)
-
src/libkapa/src/IOfuncs.c (modified) (1 diff)
-
src/libkapa/src/KapaWindow.c (modified) (2 diffs)
-
src/libohana/include/ohana.h (modified) (1 diff)
-
src/libohana/src/ohana_allocate.c (modified) (3 diffs)
-
src/opihi/cmd.astro/cdensify.c (modified) (8 diffs)
-
src/opihi/cmd.astro/imfit-fgauss-pol.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-fgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-pgauss-psf.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-pgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-q2gauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-qfgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-qgauss-psf.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-qgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-qrgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-r2gauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-rgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-sgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-tgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-vgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit.c (modified) (7 diffs)
-
src/opihi/cmd.astro/mkgauss.c (modified) (4 diffs)
-
src/opihi/cmd.astro/region.c (modified) (1 diff)
-
src/opihi/cmd.data/Makefile (modified) (2 diffs)
-
src/opihi/cmd.data/histbins.c (copied) (copied from branches/eam_branches/ipp-20230313/Ohana/src/opihi/cmd.data/histbins.c )
-
src/opihi/cmd.data/impoints.c (copied) (copied from branches/eam_branches/ipp-20230313/Ohana/src/opihi/cmd.data/impoints.c )
-
src/opihi/cmd.data/init.c (modified) (4 diffs)
-
src/opihi/cmd.data/interpolate_presort.c (modified) (2 diffs)
-
src/opihi/cmd.data/vgroup.c (modified) (2 diffs)
-
src/opihi/dvo/avperiodogram.c (modified) (1 diff)
-
src/opihi/dvo/avperiodomatch.c (modified) (1 diff)
-
src/opihi/dvo/avselect.c (modified) (3 diffs)
-
src/opihi/dvo/gstar.c (modified) (1 diff)
-
src/opihi/dvo/mextract.c (modified) (4 diffs)
-
src/opihi/dvo/mmatch.c (modified) (4 diffs)
-
src/opihi/dvo/mmextract.c (modified) (4 diffs)
-
src/opihi/lib.data/mrq2dmin.c (modified) (3 diffs)
-
src/opihi/lib.data/spline.c (modified) (2 diffs)
-
src/opihi/lib.shell/convert_to_RPN.c (modified) (1 diff)
-
src/opihi/lib.shell/stack_math.c (modified) (2 diffs)
-
src/opihi/test/cdensify.sh (copied) (copied from branches/eam_branches/ipp-20230313/Ohana/src/opihi/test/cdensify.sh )
-
src/relphot (modified) (1 prop)
-
src/relphot/include/relphot.h (modified) (3 diffs)
-
src/relphot/src/ConfigInit.c (modified) (1 diff)
-
src/relphot/src/ImageOps.c (modified) (3 diffs)
-
src/relphot/src/StarOps.c (modified) (14 diffs)
-
src/relphot/src/args.c (modified) (4 diffs)
-
src/relphot/src/bcatalog.c (modified) (12 diffs)
-
src/relphot/src/extra.c (modified) (3 diffs)
-
src/relphot/src/fit1d_irls.c (modified) (2 diffs)
-
src/relphot/src/initialize.c (modified) (1 diff)
-
src/relphot/src/load_catalogs.c (modified) (2 diffs)
-
src/relphot/src/reload_catalogs.c (modified) (1 diff)
-
src/relphot/src/relphot.c (modified) (1 diff)
-
src/tools/src/mpcorb_predict.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo changed
-
trunk/Ohana/src/addstar/Makefile
r42389 r42821 96 96 $(SRC)/find_matches_refstars.$(ARCH).o \ 97 97 $(SRC)/find_matches_closest_refstars.$(ARCH).o \ 98 $(SRC)/photcodes.$(ARCH).o \ 98 99 $(SRC)/getgsc.$(ARCH).o \ 99 100 $(SRC)/getusno.$(ARCH).o \ … … 151 152 $(SRC)/find_matches_refstars.$(ARCH).o \ 152 153 $(SRC)/find_subset.$(ARCH).o \ 154 $(SRC)/photcodes.$(ARCH).o \ 153 155 $(SRC)/getgsc.$(ARCH).o \ 154 156 $(SRC)/getusno.$(ARCH).o \ … … 181 183 $(SRC)/find_matches_refstars.$(ARCH).o \ 182 184 $(SRC)/find_subset.$(ARCH).o \ 185 $(SRC)/photcodes.$(ARCH).o \ 183 186 $(SRC)/getgsc.$(ARCH).o \ 184 187 $(SRC)/getusno.$(ARCH).o \ -
trunk/Ohana/src/addstar/include/addstar.h
r42712 r42821 142 142 int OLD_RESORT; 143 143 int READ_XRAD_DATA; 144 int CONVOLVED_APERTURES; 144 145 int DIFF_WITH_INV; 145 146 … … 344 345 void GetConfig (char *config, char *field, char *format, int N, void *ptr); 345 346 347 int isGPC1warp (int photcode); 348 int isGPC1stack (int photcode); 349 346 350 /** 347 351 there is an inconsistency to be resolved: fixed structures (like Image) -
trunk/Ohana/src/addstar/src/ReadStarsFITS.c
r42477 r42821 1290 1290 // this is may optionally be replaced by the internal sequence (see FilterStars.c) 1291 1291 catalog->measure[i].detID = ps1data[i].detID; 1292 1292 1293 1293 dvo_lensing_init (&catalog->lensing[i]); 1294 1294 -
trunk/Ohana/src/addstar/src/ReadXradFITS.c
r42077 r42821 97 97 // first entry and compare to the rest 98 98 99 float fwhmValues[3];100 fwhmValues[0] = PSFfwhm[0];101 fwhmValues[1] = PSFfwhm[1];102 fwhmValues[2] = PSFfwhm[2];103 104 int i;105 99 int Nap = 0; 106 for (i = 0; i < catalog->Nmeasure; i++) { 107 dvo_lensing_init (&catalog->lensing[i]); 108 109 if (catalog->measure[i].detID < RadID[Nap]) { 110 continue; 100 101 if (CONVOLVED_APERTURES) { 102 // XXX code to support the 3 convolved apertures 103 104 float fwhmValues[3]; 105 fwhmValues[0] = PSFfwhm[0]; 106 fwhmValues[1] = PSFfwhm[1]; 107 fwhmValues[2] = PSFfwhm[2]; 108 109 for (int i = 0; i < catalog->Nmeasure; i++) { 110 dvo_lensing_init (&catalog->lensing[i]); 111 112 if (catalog->measure[i].detID < RadID[Nap]) { 113 continue; 114 // this is a psf measurement which does not have a radial aperture 115 } 116 if (catalog->measure[i].detID > RadID[Nap]) { 117 myAbort("radial apertures for source not in psf list? sources out of order? seems like a bug\n"); 118 // this could be a radial aperture which does not have a PSF source, but that is not possible 119 } 120 121 // confirm the 3 FWHM values: 122 myAssert (fwhmValues[0] == PSFfwhm[Nap+0], "FWHM mismatch %f vs %f", fwhmValues[0], PSFfwhm[Nap+0]); 123 myAssert (fwhmValues[1] == PSFfwhm[Nap+1], "FWHM mismatch %f vs %f", fwhmValues[1], PSFfwhm[Nap+1]); 124 myAssert (fwhmValues[2] == PSFfwhm[Nap+2], "FWHM mismatch %f vs %f", fwhmValues[2], PSFfwhm[Nap+2]); 125 126 // EAM 2022.02.17 : here is the comment for the PV3 load: 127 // XXX this is all hard-wired and should make use of the headers. 128 // psphot cmfs have 5 radial apertures: 129 // array 0, 1, 2, 3, 4 130 // SDSS 3, 4, 5, 6, 7 131 132 // EAM 2022.02.17 : here is the situation for UNIONS DR3: 133 // we have 3 convolutions (raw, 6", 8") 134 // for each we have 6 apertures with max radii of (4, 8, 16, 32, 48, 64) pixels = (1, 2, 4, 8, 12, 16) arcsec 135 // I am going to save (4, 16, 32) which have index of (0, 2, 3) 136 137 # define RAD_0 0 138 # define RAD_1 2 139 # define RAD_2 3 140 catalog->lensing[i]. F_ApR5 = AperFlux [(Nap + 0)*Ncol + RAD_0]; 141 catalog->lensing[i].dF_ApR5 = AperFluxErr[(Nap + 0)*Ncol + RAD_0]; 142 catalog->lensing[i].sF_ApR5 = AperFluxStd[(Nap + 0)*Ncol + RAD_0]; 143 catalog->lensing[i].fF_ApR5 = AperFill [(Nap + 0)*Ncol + RAD_0]; 144 145 catalog->lensing[i]. F_ApR6 = AperFlux [(Nap + 0)*Ncol + RAD_1]; 146 catalog->lensing[i].dF_ApR6 = AperFluxErr[(Nap + 0)*Ncol + RAD_1]; 147 catalog->lensing[i].sF_ApR6 = AperFluxStd[(Nap + 0)*Ncol + RAD_1]; 148 catalog->lensing[i].fF_ApR6 = AperFill [(Nap + 0)*Ncol + RAD_1]; 149 150 catalog->lensing[i]. F_ApR7 = AperFlux [(Nap + 0)*Ncol + RAD_2]; 151 catalog->lensing[i].dF_ApR7 = AperFluxErr[(Nap + 0)*Ncol + RAD_2]; 152 catalog->lensing[i].sF_ApR7 = AperFluxStd[(Nap + 0)*Ncol + RAD_2]; 153 catalog->lensing[i].fF_ApR7 = AperFill [(Nap + 0)*Ncol + RAD_2]; 154 155 catalog->lensing[i]. F_ApR5_C1 = AperFlux [(Nap + 1)*Ncol + RAD_0]; 156 catalog->lensing[i].dF_ApR5_C1 = AperFluxErr[(Nap + 1)*Ncol + RAD_0]; 157 catalog->lensing[i]. F_ApR6_C1 = AperFlux [(Nap + 1)*Ncol + RAD_1]; 158 catalog->lensing[i].dF_ApR6_C1 = AperFluxErr[(Nap + 1)*Ncol + RAD_1]; 159 catalog->lensing[i]. F_ApR7_C1 = AperFlux [(Nap + 1)*Ncol + RAD_2]; 160 catalog->lensing[i].dF_ApR7_C1 = AperFluxErr[(Nap + 1)*Ncol + RAD_2]; 161 162 catalog->lensing[i]. F_ApR5_C2 = AperFlux [(Nap + 2)*Ncol + RAD_0]; 163 catalog->lensing[i].dF_ApR5_C2 = AperFluxErr[(Nap + 2)*Ncol + RAD_0]; 164 catalog->lensing[i]. F_ApR6_C2 = AperFlux [(Nap + 2)*Ncol + RAD_1]; 165 catalog->lensing[i].dF_ApR6_C2 = AperFluxErr[(Nap + 2)*Ncol + RAD_1]; 166 catalog->lensing[i]. F_ApR7_C2 = AperFlux [(Nap + 2)*Ncol + RAD_2]; 167 catalog->lensing[i].dF_ApR7_C2 = AperFluxErr[(Nap + 2)*Ncol + RAD_2]; 168 169 catalog->lensing[i].detID = catalog->measure[i].detID; 170 171 // XXX set the measure, object, etc ID values here 172 // catalog->lensing[i].objID : set in find_matches_closest.c 173 // catalog->lensing[i].catID : set in find_matches_closest.c 174 // catalog->lensing[i].averef : set in find_matches_closest.c 175 // catalog->lensing[i].imageID : set in FilterStars.c and UpdateImageIDs.c 176 177 Nap += 3; 178 } 179 } else { 180 // PSF values for unconvolve data are undefined ? 181 182 for (int i = 0; i < catalog->Nmeasure; i++) { 183 dvo_lensing_init (&catalog->lensing[i]); 184 111 185 // this is a psf measurement which does not have a radial aperture 186 if (catalog->measure[i].detID < RadID[Nap]) { continue; } 187 188 // this could be a radial aperture which does not have a PSF source, but that is not possible 189 if (catalog->measure[i].detID > RadID[Nap]) { 190 myAbort("radial apertures for source not in psf list? sources out of order? seems like a bug\n"); 191 } 192 193 // EAM 2022.02.17 : here is the comment for the PV3 load: 194 // XXX this is all hard-wired and should make use of the headers. 195 // psphot cmfs have 5 radial apertures: 196 // array 0, 1, 2, 3, 4 197 // SDSS 3, 4, 5, 6, 7 198 199 // EAM 2022.02.17 : here is the situation for UNIONS DR4: 200 // we have 1 convolution (raw) 201 // for each we have 6 apertures with max radii of (4, 8, 16, 32, 48, 64) pixels = (1, 2, 4, 8, 12, 16) arcsec 202 // I am going to save (4, 16, 32) which have index of (0, 2, 3) 203 204 # define RAD_0 0 205 # define RAD_1 2 206 # define RAD_2 3 207 catalog->lensing[i]. F_ApR5 = AperFlux [(Nap + 0)*Ncol + RAD_0]; 208 catalog->lensing[i].dF_ApR5 = AperFluxErr[(Nap + 0)*Ncol + RAD_0]; 209 catalog->lensing[i].sF_ApR5 = AperFluxStd[(Nap + 0)*Ncol + RAD_0]; 210 catalog->lensing[i].fF_ApR5 = AperFill [(Nap + 0)*Ncol + RAD_0]; 211 212 catalog->lensing[i]. F_ApR6 = AperFlux [(Nap + 0)*Ncol + RAD_1]; 213 catalog->lensing[i].dF_ApR6 = AperFluxErr[(Nap + 0)*Ncol + RAD_1]; 214 catalog->lensing[i].sF_ApR6 = AperFluxStd[(Nap + 0)*Ncol + RAD_1]; 215 catalog->lensing[i].fF_ApR6 = AperFill [(Nap + 0)*Ncol + RAD_1]; 216 217 catalog->lensing[i]. F_ApR7 = AperFlux [(Nap + 0)*Ncol + RAD_2]; 218 catalog->lensing[i].dF_ApR7 = AperFluxErr[(Nap + 0)*Ncol + RAD_2]; 219 catalog->lensing[i].sF_ApR7 = AperFluxStd[(Nap + 0)*Ncol + RAD_2]; 220 catalog->lensing[i].fF_ApR7 = AperFill [(Nap + 0)*Ncol + RAD_2]; 221 222 catalog->lensing[i].detID = catalog->measure[i].detID; 223 224 // XXX set the measure, object, etc ID values here 225 // catalog->lensing[i].objID : set in find_matches_closest.c 226 // catalog->lensing[i].catID : set in find_matches_closest.c 227 // catalog->lensing[i].averef : set in find_matches_closest.c 228 // catalog->lensing[i].imageID : set in FilterStars.c and UpdateImageIDs.c 229 230 Nap += 1; 112 231 } 113 if (catalog->measure[i].detID > RadID[Nap]) {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 possible116 }117 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]);122 123 // EAM 2022.02.17 : here is the comment for the PV3 load:124 // XXX this is all hard-wired and should make use of the headers.125 // psphot cmfs have 5 radial apertures:126 // array 0, 1, 2, 3, 4127 // SDSS 3, 4, 5, 6, 7128 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) arcsec132 // I am going to save (4, 16, 32) which have index of (0, 2, 3)133 134 # define RAD_0 0135 # define RAD_1 2136 # define RAD_2 3137 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];151 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 here169 // catalog->lensing[i].objID : set in find_matches_closest.c170 // catalog->lensing[i].catID : set in find_matches_closest.c171 // catalog->lensing[i].averef : set in find_matches_closest.c172 // catalog->lensing[i].imageID : set in FilterStars.c and UpdateImageIDs.c173 174 Nap += 3;175 232 } 176 233 myAssert (Nap == Nrow, "did we go too far???"); -
trunk/Ohana/src/addstar/src/args.c
r42712 r42821 91 91 remove_argument (N, &argc, argv); 92 92 READ_XRAD_DATA = TRUE; 93 } 94 CONVOLVED_APERTURES = FALSE; 95 if ((N = get_argument (argc, argv, "-convolved-ap"))) { 96 remove_argument (N, &argc, argv); 97 CONVOLVED_APERTURES = TRUE; 93 98 } 94 99 DIFF_WITH_INV = FALSE; … … 304 309 } 305 310 /* force using single time from PHU */ 311 FORCE_SINGLE_TIME = FALSE; 312 if ((N = get_argument (argc, argv, "-force-single-time"))) { 313 FORCE_SINGLE_TIME = TRUE; 314 remove_argument (N, &argc, argv); 315 } 316 /* accept bad header astrometry */ 306 317 FORCE_SINGLE_TIME = FALSE; 307 318 if ((N = get_argument (argc, argv, "-force-single-time"))) { -
trunk/Ohana/src/addstar/src/find_matches_closest.c
r40291 r42821 248 248 /* in UPDATE mode, this value is not saved; use relphot to recalculate */ 249 249 if (Nsec > -1) { 250 if (isGPC1warp(tgtcat[0].measure[Nmeas].photcode)) { 251 if (FALSE && isnan(tgtcat[0].secfilt[n*Nsecfilt+Nsec].MpsfWrp)) { 252 tgtcat[0].secfilt[n*Nsecfilt+Nsec].MpsfWrp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF); 253 tgtcat[0].secfilt[n*Nsecfilt+Nsec].MkronWrp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_KRON); 254 tgtcat[0].secfilt[n*Nsecfilt+Nsec].MapWrp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_APER); 255 } 256 goto set_average; 257 } 258 if (isGPC1stack(tgtcat[0].measure[Nmeas].photcode)) { 259 if (FALSE && isnan(tgtcat[0].secfilt[n*Nsecfilt+Nsec].MpsfStk)) { 260 tgtcat[0].secfilt[n*Nsecfilt+Nsec].MpsfStk = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF); 261 tgtcat[0].secfilt[n*Nsecfilt+Nsec].MkronStk = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_KRON); 262 tgtcat[0].secfilt[n*Nsecfilt+Nsec].MapStk = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_APER); 263 } 264 goto set_average; 265 } 250 266 if (isnan(tgtcat[0].secfilt[n*Nsecfilt+Nsec].MpsfChp)) { 251 tgtcat[0].secfilt[n*Nsecfilt+Nsec].MpsfChp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF); 252 } 253 } 267 tgtcat[0].secfilt[n*Nsecfilt+Nsec].MpsfChp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF); 268 tgtcat[0].secfilt[n*Nsecfilt+Nsec].MkronChp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_KRON); 269 tgtcat[0].secfilt[n*Nsecfilt+Nsec].MapChp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_APER); 270 } 271 } 272 set_average: 254 273 255 274 /* Nm is updated, but not written out in -update mode (for existing entries) … … 352 371 /* in UPDATE mode, this value is not saved; use relphot to recalculate */ 353 372 if (Nsec > -1) { 354 tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].MpsfChp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF); 355 } 373 if (isGPC1warp(tgtcat[0].measure[Nmeas].photcode)) { 374 // tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].MpsfWrp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF); 375 // tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].MkronWrp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_KRON); 376 // tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].MapWrp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_APER); 377 goto set_average_2; 378 } 379 if (isGPC1stack(tgtcat[0].measure[Nmeas].photcode)) { 380 // tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].MpsfStk = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF); 381 // tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].MkronStk = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_KRON); 382 // tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].MapStk = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_APER); 383 goto set_average_2; 384 } 385 if (isnan(tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].MpsfChp)) { 386 tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].MpsfChp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF); 387 tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].MkronChp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_KRON); 388 tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].MapChp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_APER); 389 } 390 } 391 set_average_2: 356 392 357 393 Nmeas ++; -
trunk/Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c
r42133 r42821 2 2 # define DEBUG 1 3 3 # define MACHINE_GROUPS 1 4 # define MEMCHECK_VERBOSE 0 4 5 5 6 // in parallel mode, the target database may be distributed, while the input database is -
trunk/Ohana/src/dvomerge/src/merge_catalogs_old.c
r41341 r42821 497 497 int outputIndex; 498 498 if (secfiltMap) { 499 if (secfiltMap[j] < 0) continue; // skip secfilt entries from input that are not in the output 499 500 outputIndex = (Nave * NsecfiltOut) + secfiltMap[j]; 500 501 } else { -
trunk/Ohana/src/getstar/include/getstar.h
r27435 r42821 35 35 PhotCode *photcode; 36 36 37 float EpochMJD; 38 time_t EpochUnix; 39 37 40 int args PROTO((int argc, char **argv)); 38 41 int ConfigInit PROTO((int *argc, char **argv)); -
trunk/Ohana/src/getstar/src/args.c
r34459 r42821 37 37 VERBOSE = TRUE; 38 38 remove_argument (N, &argc, argv); 39 } 40 41 EpochUnix = 0; 42 EpochMJD = NAN; 43 if ((N = get_argument (argc, argv, "-epoch-mjd"))) { 44 remove_argument (N, &argc, argv); 45 EpochMJD = atof (argv[N]); 46 remove_argument (N, &argc, argv); 47 EpochUnix = ohana_mjd_to_sec (EpochMJD); 39 48 } 40 49 -
trunk/Ohana/src/getstar/src/write_getstar_ps1_dev_0.c
r40291 r42821 45 45 output[i].R = average[i].R; 46 46 output[i].D = average[i].D; 47 if (isfinite(EpochMJD) && isfinite(average[i].uR) && isfinite(average[i].uD)) { 48 // RA(epoch) = RA(mean) + uR*(t - Tmean)/cos(dec) 49 // XXX how does this behave near dec = 90? 50 // double dT = (EpochUnix - average[i].Tmean) / (86400*365.25); 51 // XXX refcat 20220324.v0 does not have Tmean correctly set to 2016.0 = MJD 57388.0 52 // NOTE average[i].Tmean is in UNIX, but here I am using the MJD of the Gaia DR3 reference epoch 53 double dT = (EpochMJD - 57388.0) / 365.25; 54 double dR = average[i].uR * dT / cos(RAD_DEG*average[i].D) / 3600.0; 55 double dD = average[i].uD * dT / 3600.0; 56 output[i].R += dR; 57 output[i].D += dD; 58 } 47 59 48 60 output[i].code = average[i].flags; -
trunk/Ohana/src/kapa2/Makefile
r41344 r42821 10 10 SRC = $(HOME)/src 11 11 INC = $(HOME)/include 12 DATA = $(DESTDATA)/kapa 12 13 include ../../Makefile.Common 14 15 %.c : %.c.in 16 sed "s|@DATADIR@|$(DATA)|" $< > $@ 13 17 14 18 # programs may add their own internal requirements here … … 21 25 22 26 kapa: $(BIN)/kapa.$(ARCH) 23 install: $(DESTBIN)/kapa 27 install: $(DESTBIN)/kapa cmaps 24 28 25 29 PDF = \ … … 100 104 $(SRC)/CheckButtons.$(ARCH).o $(SRC)/InvertButton.$(ARCH).o \ 101 105 $(SRC)/UpdatePointer.$(ARCH).o $(SRC)/JPEGit24.$(ARCH).o \ 102 $(SRC)/ButtonFunctions.$(ARCH).o \ 103 $(SRC)/SetChannel.$(ARCH).o \ 106 $(SRC)/ButtonFunctions.$(ARCH).o $(SRC)/FindColormap.$(ARCH).o \ 104 107 $(SRC)/SetColorScale.$(ARCH).o $(SRC)/ColorCube.$(ARCH).o \ 105 $(SRC)/ColorHistogram.$(ARCH).o $(SRC)/CreateWide.$(ARCH).o 108 $(SRC)/ColorHistogram.$(ARCH).o $(SRC)/CreateWide.$(ARCH).o \ 109 $(SRC)/SetChannel.$(ARCH).o 106 110 107 111 OBJ = $(KAPA) $(PDF) $(BDRAW) $(PSFILES) 112 113 cmaps: 114 @echo "installing colormaps for kapa" 115 @if [ ! -d $(DATA)/colormaps ]; then mkdir -p $(DATA)/colormaps; fi 116 @if [ -d $(HOME)/colormaps ]; then rm -f $(HOME)/colormaps/*~; fi 117 @if [ -d $(HOME)/colormaps ]; then rm -f $(HOME)/colormaps/#*; fi 118 @if [ -d $(HOME)/colormaps ]; then for i in `find $(HOME)/colormaps -name CVS -prune -o -type f -print`; do cp -f $$i $(DATA)/colormaps; done; fi 108 119 109 120 # dependancy rules for include files ######################## … … 116 127 117 128 $(BIN)/kapa.$(ARCH): $(OBJ) 129 130 .PRECIOUS: $(SRC)/FindColormap.c -
trunk/Ohana/src/kapa2/include/constants.h
r40501 r42821 54 54 } KapaChannels; 55 55 56 typedef enum { 57 KAPA_CM_NONE, 58 KAPA_CM_RAW, 59 KAPA_CM_CSV, 60 KAPA_CM_CET, 61 KAPA_CM_CET_REV, 62 KAPA_CM_LEGACY, 63 KAPA_CM_STATIC, 64 } KapaColorMapMode; 65 56 66 // use an enum to identify the 3 dimensions: 57 67 typedef enum { -
trunk/Ohana/src/kapa2/include/prototypes.h
r41344 r42821 328 328 int ResizeByImage (int sock); 329 329 330 char *ParseColormapName (char *name, KapaColorMapMode *mode); 331 int CheckFileAccess (char *name); 332 char *FindColormap (char *name); 333 char *ParseColormapModeFromEnum (KapaColorMapMode mode); 334 void ListColormaps (void); -
trunk/Ohana/src/kapa2/src
-
Property svn:ignore
set to
FindColormap.c
-
Property svn:ignore
set to
-
trunk/Ohana/src/kapa2/src/SetColormap.c
r41341 r42821 21 21 float scale, blueRef, redRef, greenRef; 22 22 Graphic *graphic; 23 24 if (inName && !strcasecmp(inName, "list")) { 25 ListColormaps (); 26 return TRUE; 27 } 23 28 24 29 graphic = GetGraphic(); … … 214 219 215 220 /* anuenue */ 216 if (!strncmp (graphic->colormapName, "file:", 5) || 217 !strncmp (graphic->colormapName, "lgcy:", 5) || 218 !strncmp (graphic->colormapName, "cetf:", 5) || 219 !strncmp (graphic->colormapName, "cetr:", 5) || 220 !strncmp (graphic->colormapName, "csvf:", 5)) { 221 222 FILE *f = fopen (&graphic->colormapName[5], "r"); 223 if (!f) { 224 fprintf (stderr, "failed to open colormap file %s\n", &graphic->colormapName[5]); 221 KapaColorMapMode mode = KAPA_CM_STATIC; 222 223 // we should already have handled the static colormaps by this point 224 char *basename = ParseColormapName (graphic->colormapName, &mode); 225 if (mode == KAPA_CM_STATIC) { 226 fprintf (stderr, "unknown static colormap name %s\n", graphic->colormapName); 227 free (basename); 228 return FALSE; 229 } 230 231 // look in local directory and installation directory 232 char *truename = FindColormap (basename); 233 FREE (basename); 234 235 if (!truename) { 236 fprintf (stderr, "cannot find colormap file %s\n", &graphic->colormapName[5]); 225 237 return FALSE; 226 } 227 char line[1024]; 228 229 int lastIndex = 0; 230 float lastRed = 0.0; 231 float lastBlue = 0.0; 232 float lastGreen = 0.0; 233 234 int isCSV = !strncmp (graphic->colormapName, "csvf:", 5); 235 int isCET = !strncmp (graphic->colormapName, "cetf:", 5); 236 int isCETRev = !strncmp (graphic->colormapName, "cetr:", 5); 237 int isLegacy = !strncmp (graphic->colormapName, "lgcy:", 5); 238 239 float fracIndex, fracRed, fracBlue, fracGreen; 240 241 if (isCET || isCETRev) fracIndex = 0.0; 242 243 while (scan_line_maxlen (f, line, 1024) != EOF) { 244 // file contains f R G B : f = 0.0 - 1.0, R,G,B = 0.0 - 1.0 245 246 int Nscan; 247 if (isCSV) { 248 Nscan = sscanf (line, "%f,%f,%f,%f", &fracIndex, &fracRed, &fracGreen, &fracBlue); 249 if (Nscan != 4) continue; 250 } 251 if (isCET || isCETRev) { 252 Nscan = sscanf (line, "%f,%f,%f", &fracRed, &fracGreen, &fracBlue); 253 fracIndex += 1.0 / 256.0; 254 if (Nscan != 3) continue; 255 } 256 if (isLegacy) { 257 Nscan = sscanf (line, "%f %f %f %f", &fracIndex, &fracRed, &fracBlue, &fracGreen); 258 if (Nscan != 4) continue; 259 } 260 if (!isCSV && !isLegacy && !isCET && !isCETRev) { 261 Nscan = sscanf (line, "%f %f %f %f", &fracIndex, &fracRed, &fracGreen, &fracBlue); 262 if (Nscan != 4) continue; 263 } 264 265 int nextIndex = fracIndex * MaxValue; 266 if (nextIndex <= lastIndex) { 267 lastRed = fracRed; 268 lastBlue = fracBlue; 269 lastGreen = fracGreen; 270 continue; 271 } 272 float dRdI = (fracRed - lastRed) / (float) (nextIndex - lastIndex); 273 float dBdI = (fracBlue - lastBlue) / (float) (nextIndex - lastIndex); 274 float dGdI = (fracGreen - lastGreen) / (float) (nextIndex - lastIndex); 275 for (i = lastIndex; i < nextIndex; i++) { 276 float redValue = 0xffff * (dRdI * (i - lastIndex) + lastRed); 277 float blueValue = 0xffff * (dBdI * (i - lastIndex) + lastBlue); 278 float greenValue = 0xffff * (dGdI * (i - lastIndex) + lastGreen); 279 SETVALUE (graphic[0].cmap[i].red, redValue, 0, 0xffff); 280 SETVALUE (graphic[0].cmap[i].blue, blueValue, 0, 0xffff); 281 SETVALUE (graphic[0].cmap[i].green, greenValue, 0, 0xffff); 282 } 238 } 239 240 FILE *f = fopen (truename, "r"); 241 if (!f) { 242 fprintf (stderr, "failed to open colormap file %s\n", truename); 243 FREE (truename); 244 return FALSE; 245 } 246 FREE (truename); 247 248 char line[1024]; 249 250 int lastIndex = 0; 251 float lastRed = 0.0; 252 float lastBlue = 0.0; 253 float lastGreen = 0.0; 254 255 float fracIndex, fracRed, fracBlue, fracGreen; 256 257 if (mode == KAPA_CM_CET || mode == KAPA_CM_CET_REV) fracIndex = 0.0; 258 259 int checkFormat = TRUE; 260 261 while (scan_line_maxlen (f, line, 1024) != EOF) { 262 // file contains f R G B : f = 0.0 - 1.0, R,G,B = 0.0 - 1.0 263 // skip any lines with comment character: 264 265 char *p = line; 266 while ((*p != 0) && OHANA_WHITESPACE(*p)) { p++; } 267 if (*p == 0) { continue; } 268 if (*p == '#') { continue; } 269 270 // attempt to confirm the format (and warn if it does not seem to match) 271 if (checkFormat) { 272 int Nscan1 = sscanf (line, "%f,%f,%f,%f", &fracIndex, &fracRed, &fracGreen, &fracBlue); 273 int Nscan2 = sscanf (line, "%f,%f,%f", &fracRed, &fracGreen, &fracBlue); 274 int Nscan3 = sscanf (line, "%f %f %f %f", &fracIndex, &fracRed, &fracBlue, &fracGreen); 275 276 if (Nscan1 == 4) { 277 if (mode != KAPA_CM_CSV) { fprintf (stderr, "warning: %s appears to be format csvf: not %s\n line: %s\n", graphic->colormapName, ParseColormapModeFromEnum(mode), line); } 278 } 279 if (Nscan2 == 3) { 280 if ((mode != KAPA_CM_CET) && (mode != KAPA_CM_CET_REV)) { fprintf (stderr, "warning: %s appears to be format cetf: or cetf: not %s\n line: %s\n", graphic->colormapName, ParseColormapModeFromEnum(mode), line); } 281 } 282 if (Nscan3 == 4) { 283 if (mode != KAPA_CM_RAW) { fprintf (stderr, "warning: %s appears to be format file: not %s\n line: %s\n", graphic->colormapName, ParseColormapModeFromEnum(mode), line); } 284 } 285 checkFormat = FALSE; 286 } 287 288 int Nscan; 289 if (mode == KAPA_CM_CSV) { 290 Nscan = sscanf (line, "%f,%f,%f,%f", &fracIndex, &fracRed, &fracGreen, &fracBlue); 291 if (Nscan != 4) continue; 292 } 293 if ((mode == KAPA_CM_CET || mode == KAPA_CM_CET_REV)) { 294 Nscan = sscanf (line, "%f,%f,%f", &fracRed, &fracGreen, &fracBlue); 295 fracIndex += 1.0 / 256.0; 296 if (Nscan != 3) continue; 297 } 298 if (mode == KAPA_CM_LEGACY) { 299 Nscan = sscanf (line, "%f %f %f %f", &fracIndex, &fracRed, &fracBlue, &fracGreen); 300 if (Nscan != 4) continue; 301 } 302 if (mode == KAPA_CM_RAW) { 303 Nscan = sscanf (line, "%f %f %f %f", &fracIndex, &fracRed, &fracGreen, &fracBlue); 304 if (Nscan != 4) continue; 305 } 306 307 int nextIndex = fracIndex * MaxValue; 308 if (nextIndex <= lastIndex) { 283 309 lastRed = fracRed; 284 310 lastBlue = fracBlue; 285 311 lastGreen = fracGreen; 286 lastIndex = nextIndex; 287 } 288 fclose (f); 289 290 if ((int) (MaxValue*fracIndex) < MaxValue) { 291 float dRdI = (1.0 - lastRed) / (float) (MaxValue - lastIndex); 292 float dBdI = (1.0 - lastBlue) / (float) (MaxValue - lastIndex); 293 float dGdI = (1.0 - lastGreen) / (float) (MaxValue - lastIndex); 294 for (i = lastIndex; i < MaxValue; i++) { 295 float redValue = 0xffff * (dRdI * (i - lastIndex) + lastRed); 296 float blueValue = 0xffff * (dBdI * (i - lastIndex) + lastBlue); 297 float greenValue = 0xffff * (dGdI * (i - lastIndex) + lastGreen); 298 SETVALUE (graphic[0].cmap[i].red, redValue, 0, 0xffff); 299 SETVALUE (graphic[0].cmap[i].blue, blueValue, 0, 0xffff); 300 SETVALUE (graphic[0].cmap[i].green, greenValue, 0, 0xffff); 301 } 302 } 303 304 // reverse the color sequence: 305 if (isCETRev) { 306 for (i = 0; i < MaxValue / 2; i++) { 307 unsigned short tmp; 308 // fprintf (stderr, "swap: %d %d\n", graphic[0].cmap[i].red, graphic[0].cmap[MaxValue - 1 - i].red); 309 tmp = graphic[0].cmap[i].red; graphic[0].cmap[i].red = graphic[0].cmap[MaxValue - 1 - i].red; graphic[0].cmap[MaxValue - 1 - i].red = tmp; 310 tmp = graphic[0].cmap[i].blue; graphic[0].cmap[i].blue = graphic[0].cmap[MaxValue - 1 - i].blue; graphic[0].cmap[MaxValue - 1 - i].blue = tmp; 311 tmp = graphic[0].cmap[i].green; graphic[0].cmap[i].green = graphic[0].cmap[MaxValue - 1 - i].green; graphic[0].cmap[MaxValue - 1 - i].green = tmp; 312 } 313 } 314 315 goto store_colors; 316 } 317 318 return (FALSE); 312 continue; 313 } 314 float dRdI = (fracRed - lastRed) / (float) (nextIndex - lastIndex); 315 float dBdI = (fracBlue - lastBlue) / (float) (nextIndex - lastIndex); 316 float dGdI = (fracGreen - lastGreen) / (float) (nextIndex - lastIndex); 317 for (i = lastIndex; i < nextIndex; i++) { 318 float redValue = 0xffff * (dRdI * (i - lastIndex) + lastRed); 319 float blueValue = 0xffff * (dBdI * (i - lastIndex) + lastBlue); 320 float greenValue = 0xffff * (dGdI * (i - lastIndex) + lastGreen); 321 SETVALUE (graphic[0].cmap[i].red, redValue, 0, 0xffff); 322 SETVALUE (graphic[0].cmap[i].blue, blueValue, 0, 0xffff); 323 SETVALUE (graphic[0].cmap[i].green, greenValue, 0, 0xffff); 324 } 325 lastRed = fracRed; 326 lastBlue = fracBlue; 327 lastGreen = fracGreen; 328 lastIndex = nextIndex; 329 } 330 fclose (f); 331 332 if ((int) (MaxValue*fracIndex) < MaxValue) { 333 float dRdI = (1.0 - lastRed) / (float) (MaxValue - lastIndex); 334 float dBdI = (1.0 - lastBlue) / (float) (MaxValue - lastIndex); 335 float dGdI = (1.0 - lastGreen) / (float) (MaxValue - lastIndex); 336 for (i = lastIndex; i < MaxValue; i++) { 337 float redValue = 0xffff * (dRdI * (i - lastIndex) + lastRed); 338 float blueValue = 0xffff * (dBdI * (i - lastIndex) + lastBlue); 339 float greenValue = 0xffff * (dGdI * (i - lastIndex) + lastGreen); 340 SETVALUE (graphic[0].cmap[i].red, redValue, 0, 0xffff); 341 SETVALUE (graphic[0].cmap[i].blue, blueValue, 0, 0xffff); 342 SETVALUE (graphic[0].cmap[i].green, greenValue, 0, 0xffff); 343 } 344 } 345 346 // reverse the color sequence: 347 if (mode == KAPA_CM_CET_REV) { 348 for (i = 0; i < MaxValue / 2; i++) { 349 unsigned short tmp; 350 // fprintf (stderr, "swap: %d %d\n", graphic[0].cmap[i].red, graphic[0].cmap[MaxValue - 1 - i].red); 351 tmp = graphic[0].cmap[i].red; graphic[0].cmap[i].red = graphic[0].cmap[MaxValue - 1 - i].red; graphic[0].cmap[MaxValue - 1 - i].red = tmp; 352 tmp = graphic[0].cmap[i].blue; graphic[0].cmap[i].blue = graphic[0].cmap[MaxValue - 1 - i].blue; graphic[0].cmap[MaxValue - 1 - i].blue = tmp; 353 tmp = graphic[0].cmap[i].green; graphic[0].cmap[i].green = graphic[0].cmap[MaxValue - 1 - i].green; graphic[0].cmap[MaxValue - 1 - i].green = tmp; 354 } 355 } 319 356 320 357 store_colors: … … 333 370 return (TRUE); 334 371 } 335 -
trunk/Ohana/src/libdvo/include/dvodb.h
r42389 r42821 547 547 548 548 dbValue dbExtractAverages PROTO((Average *average, SecFilt *secfilt, Measure *measure, Lensobj *lensobj, StarPar *starpar, GalPhot *galphot, dbField *field)); 549 dbValue dbExtractMeasures PROTO((Average *average, SecFilt *secfilt, Measure *measure, Lensing *lensing, StarPar *starpar, dbField *field));549 dbValue dbExtractMeasures PROTO((Average *average, SecFilt *secfilt, Lensobj *lensobj, Measure *measure, Lensing *lensing, StarPar *starpar, GalPhot *galphot, dbField *field)); 550 550 dbValue dbExtractImages PROTO((Image *image, off_t Nimage, off_t N, dbField *field)); 551 551 -
trunk/Ohana/src/libdvo/include/libdvo_astro.h
r42075 r42821 20 20 PROJ_TNX, // zenithal 21 21 PROJ_DIS, // zenithal (TAN + polyterms) 22 PROJ_CAR, // cartesian (Plat-Carre) 22 23 PROJ_LIN, // cartesian 23 24 PROJ_PLY, // cartesian (allow polyterms) -
trunk/Ohana/src/libdvo/src/cmf-ps1-v5-r0.c
r42477 r42821 96 96 SWAP_BYTE (236); // SRC_CHIP_Y 97 97 SWAP_BYTE (238); // PADDING3 98 SWAP_WORD (24 2); // MOMENTS_R199 SWAP_WORD (24 6); // MOMENTS_RH100 SWAP_WORD (2 50); // KRON_FLUX101 SWAP_WORD (25 4); // KRON_FLUX_ERR102 SWAP_WORD (25 8); // KRON_FLUX_INNER103 SWAP_WORD (26 2); // KRON_FLUX_OUTER104 SWAP_WORD (26 6); // SKY_LIMIT_RAD105 SWAP_WORD (2 70); // SKY_LIMIT_FLUX106 SWAP_WORD (27 4); // SKY_LIMIT_SLOPE107 SWAP_WORD (27 8); // FLAGS98 SWAP_WORD (240); // MOMENTS_R1 99 SWAP_WORD (244); // MOMENTS_RH 100 SWAP_WORD (248); // KRON_FLUX 101 SWAP_WORD (252); // KRON_FLUX_ERR 102 SWAP_WORD (256); // KRON_FLUX_INNER 103 SWAP_WORD (260); // KRON_FLUX_OUTER 104 SWAP_WORD (264); // SKY_LIMIT_RAD 105 SWAP_WORD (268); // SKY_LIMIT_FLUX 106 SWAP_WORD (272); // SKY_LIMIT_SLOPE 107 SWAP_WORD (276); // FLAGS 108 108 SWAP_WORD (280); // FLAGS2 109 109 SWAP_BYTE (284); // N_FRAMES -
trunk/Ohana/src/libdvo/src/coordops.c
r42389 r42821 1072 1072 if (!strncmp(&ctype[4], "-TNX", 4)) return PROJ_TNX; 1073 1073 if (!strncmp(&ctype[4], "-DIS", 4)) return PROJ_DIS; 1074 if (!strncmp(&ctype[4], "-CAR", 4)) return PROJ_CAR; 1074 1075 if (!strncmp(&ctype[4], "-LIN", 4)) return PROJ_LIN; 1075 1076 if (!strncmp(&ctype[0], "GENE", 4)) return PROJ_LIN; // note ctype[0] … … 1094 1095 case PROJ_TNX: strcpy(&ctype[4], "-TNX"); return TRUE; 1095 1096 case PROJ_DIS: strcpy(&ctype[4], "-DIS"); return TRUE; 1097 case PROJ_CAR: strcpy(&ctype[4], "-CAR"); return TRUE; 1096 1098 case PROJ_LIN: strcpy(&ctype[4], "-LIN"); return TRUE; 1097 1099 case PROJ_PLY: strcpy(&ctype[4], "-PLY"); return TRUE; … … 1118 1120 case PROJ_DIS: 1119 1121 return PROJ_MODE_ZENITHAL; 1122 case PROJ_CAR: 1120 1123 case PROJ_LIN: 1121 1124 case PROJ_PLY: -
trunk/Ohana/src/libdvo/src/dbExtractMeasures.c
r42102 r42821 85 85 86 86 /* return measure.field based on the selection */ 87 dbValue dbExtractMeasures (Average *average, SecFilt *secfilt, Measure *measure, Lensing *lensing, StarPar *starpar, dbField *field) {87 dbValue dbExtractMeasures (Average *average, SecFilt *secfilt, Lensobj *lensobj, Measure *measure, Lensing *lensing, StarPar *starpar, GalPhot *galphot, dbField *field) { 88 88 89 89 int Nsec; … … 264 264 265 265 // the following values come from the mean lensobj table 266 case MAG_OPTION_X11_SM_OBJ: 267 case MAG_OPTION_X12_SM_OBJ: 268 case MAG_OPTION_X22_SM_OBJ: 269 case MAG_OPTION_E1_SM_OBJ: 270 case MAG_OPTION_E2_SM_OBJ: 271 case MAG_OPTION_X11_SH_OBJ: 272 case MAG_OPTION_X12_SH_OBJ: 273 case MAG_OPTION_X22_SH_OBJ: 274 case MAG_OPTION_E1_SH_OBJ: 275 case MAG_OPTION_E2_SH_OBJ: 276 case MAG_OPTION_X11_SM_PSF: 277 case MAG_OPTION_X12_SM_PSF: 278 case MAG_OPTION_X22_SM_PSF: 279 case MAG_OPTION_E1_SM_PSF: 280 case MAG_OPTION_E2_SM_PSF: 281 case MAG_OPTION_X11_SH_PSF: 282 case MAG_OPTION_X12_SH_PSF: 283 case MAG_OPTION_X22_SH_PSF: 284 case MAG_OPTION_E1_SH_PSF: 285 case MAG_OPTION_E2_SH_PSF: 286 287 case MAG_OPTION_E1_PSF: 288 case MAG_OPTION_E2_PSF: 289 290 case MAG_OPTION_F_AP_R5: 291 case MAG_OPTION_F_ERR_AP_R5: 292 case MAG_OPTION_F_STDEV_AP_R5: 293 case MAG_OPTION_F_FILL_AP_R5: 294 case MAG_OPTION_F_AP_R6: 295 case MAG_OPTION_F_ERR_AP_R6: 296 case MAG_OPTION_F_STDEV_AP_R6: 297 case MAG_OPTION_F_FILL_AP_R6: 298 case MAG_OPTION_F_AP_R7: 299 case MAG_OPTION_F_ERR_AP_R7: 300 case MAG_OPTION_F_STDEV_AP_R7: 301 case MAG_OPTION_F_FILL_AP_R7: 302 case MAG_OPTION_E1: 303 case MAG_OPTION_E2: 304 305 case MAG_OPTION_GAL_MAG: 306 case MAG_OPTION_GAL_MAG_ERR: 307 case MAG_OPTION_GAL_MAJ: 308 case MAG_OPTION_GAL_MAJ_ERR: 309 case MAG_OPTION_GAL_MIN: 310 case MAG_OPTION_GAL_MIN_ERR: 311 case MAG_OPTION_GAL_THETA: 312 case MAG_OPTION_GAL_THETA_ERR: 313 case MAG_OPTION_GAL_INDEX: 314 case MAG_OPTION_GAL_CHISQ: 315 case MAG_OPTION_GAL_NPIX: 316 case MAG_OPTION_GAL_FLAGS: 317 case MAG_OPTION_GAL_TYPE: 318 case MAG_OPTION_GAL_OBJ_ID: 319 case MAG_OPTION_GAL_CAT_ID: 320 case MAG_OPTION_GAL_DET_ID: 321 case MAG_OPTION_GAL_IMAGE_ID: 322 323 case MAG_OPTION_NONE: 324 break; 266 // g:X11_SM_OBJ, etc, are only valid for average 267 case MAG_OPTION_X11_SM_OBJ: { value.Flt = LensValue_X11_sm_obj (field->photcode, lensobj, average->Nlensobj); break; } 268 case MAG_OPTION_X12_SM_OBJ: { value.Flt = LensValue_X12_sm_obj (field->photcode, lensobj, average->Nlensobj); break; } 269 case MAG_OPTION_X22_SM_OBJ: { value.Flt = LensValue_X22_sm_obj (field->photcode, lensobj, average->Nlensobj); break; } 270 case MAG_OPTION_E1_SM_OBJ: { value.Flt = LensValue_E1_sm_obj (field->photcode, lensobj, average->Nlensobj); break; } 271 case MAG_OPTION_E2_SM_OBJ: { value.Flt = LensValue_E2_sm_obj (field->photcode, lensobj, average->Nlensobj); break; } 272 273 case MAG_OPTION_X11_SH_OBJ: { value.Flt = LensValue_X11_sh_obj (field->photcode, lensobj, average->Nlensobj); break; } 274 case MAG_OPTION_X12_SH_OBJ: { value.Flt = LensValue_X12_sh_obj (field->photcode, lensobj, average->Nlensobj); break; } 275 case MAG_OPTION_X22_SH_OBJ: { value.Flt = LensValue_X22_sh_obj (field->photcode, lensobj, average->Nlensobj); break; } 276 case MAG_OPTION_E1_SH_OBJ: { value.Flt = LensValue_E1_sh_obj (field->photcode, lensobj, average->Nlensobj); break; } 277 case MAG_OPTION_E2_SH_OBJ: { value.Flt = LensValue_E2_sh_obj (field->photcode, lensobj, average->Nlensobj); break; } 278 279 case MAG_OPTION_X11_SM_PSF: { value.Flt = LensValue_X11_sm_psf (field->photcode, lensobj, average->Nlensobj); break; } 280 case MAG_OPTION_X12_SM_PSF: { value.Flt = LensValue_X12_sm_psf (field->photcode, lensobj, average->Nlensobj); break; } 281 case MAG_OPTION_X22_SM_PSF: { value.Flt = LensValue_X22_sm_psf (field->photcode, lensobj, average->Nlensobj); break; } 282 case MAG_OPTION_E1_SM_PSF: { value.Flt = LensValue_E1_sm_psf (field->photcode, lensobj, average->Nlensobj); break; } 283 case MAG_OPTION_E2_SM_PSF: { value.Flt = LensValue_E2_sm_psf (field->photcode, lensobj, average->Nlensobj); break; } 284 285 case MAG_OPTION_X11_SH_PSF: { value.Flt = LensValue_X11_sh_psf (field->photcode, lensobj, average->Nlensobj); break; } 286 case MAG_OPTION_X12_SH_PSF: { value.Flt = LensValue_X12_sh_psf (field->photcode, lensobj, average->Nlensobj); break; } 287 case MAG_OPTION_X22_SH_PSF: { value.Flt = LensValue_X22_sh_psf (field->photcode, lensobj, average->Nlensobj); break; } 288 case MAG_OPTION_E1_SH_PSF: { value.Flt = LensValue_E1_sh_psf (field->photcode, lensobj, average->Nlensobj); break; } 289 case MAG_OPTION_E2_SH_PSF: { value.Flt = LensValue_E2_sh_psf (field->photcode, lensobj, average->Nlensobj); break; } 290 291 case MAG_OPTION_F_AP_R5: { value.Flt = LensValue_F_ApR5 (field->photcode, lensobj, average->Nlensobj); break; } 292 case MAG_OPTION_F_ERR_AP_R5: { value.Flt = LensValue_dF_ApR5 (field->photcode, lensobj, average->Nlensobj); break; } 293 case MAG_OPTION_F_STDEV_AP_R5: { value.Flt = LensValue_sF_ApR5 (field->photcode, lensobj, average->Nlensobj); break; } 294 case MAG_OPTION_F_FILL_AP_R5: { value.Flt = LensValue_fF_ApR5 (field->photcode, lensobj, average->Nlensobj); break; } 295 296 case MAG_OPTION_F_AP_R6: { value.Flt = LensValue_F_ApR6 (field->photcode, lensobj, average->Nlensobj); break; } 297 case MAG_OPTION_F_ERR_AP_R6: { value.Flt = LensValue_dF_ApR6 (field->photcode, lensobj, average->Nlensobj); break; } 298 case MAG_OPTION_F_STDEV_AP_R6: { value.Flt = LensValue_sF_ApR6 (field->photcode, lensobj, average->Nlensobj); break; } 299 case MAG_OPTION_F_FILL_AP_R6: { value.Flt = LensValue_fF_ApR6 (field->photcode, lensobj, average->Nlensobj); break; } 300 301 case MAG_OPTION_F_AP_R7: { value.Flt = LensValue_F_ApR7 (field->photcode, lensobj, average->Nlensobj); break; } 302 case MAG_OPTION_F_ERR_AP_R7: { value.Flt = LensValue_dF_ApR7 (field->photcode, lensobj, average->Nlensobj); break; } 303 case MAG_OPTION_F_STDEV_AP_R7: { value.Flt = LensValue_sF_ApR7 (field->photcode, lensobj, average->Nlensobj); break; } 304 case MAG_OPTION_F_FILL_AP_R7: { value.Flt = LensValue_fF_ApR7 (field->photcode, lensobj, average->Nlensobj); break; } 305 306 case MAG_OPTION_E1: { value.Flt = LensValue_E1 (field->photcode, lensobj, average->Nlensobj); break; } 307 case MAG_OPTION_E2: { value.Flt = LensValue_E2 (field->photcode, lensobj, average->Nlensobj); break; } 308 309 case MAG_OPTION_GAL_MAG: { value.Flt = GalphotValue_GAL_MAG (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 310 case MAG_OPTION_GAL_MAG_ERR: { value.Flt = GalphotValue_GAL_MAG_ERR (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 311 case MAG_OPTION_GAL_MAJ: { value.Flt = GalphotValue_GAL_MAJ (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 312 case MAG_OPTION_GAL_MAJ_ERR: { value.Flt = GalphotValue_GAL_MAJ_ERR (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 313 case MAG_OPTION_GAL_MIN: { value.Flt = GalphotValue_GAL_MIN (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 314 case MAG_OPTION_GAL_MIN_ERR: { value.Flt = GalphotValue_GAL_MIN_ERR (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 315 case MAG_OPTION_GAL_THETA: { value.Flt = GalphotValue_GAL_THETA (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 316 case MAG_OPTION_GAL_THETA_ERR:{ value.Flt = GalphotValue_GAL_THETA_ERR(field->photcode, field->magClass, galphot, average->Ngalphot); break; } 317 case MAG_OPTION_GAL_INDEX: { value.Flt = GalphotValue_GAL_INDEX (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 318 case MAG_OPTION_GAL_CHISQ: { value.Flt = GalphotValue_GAL_CHISQ (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 319 case MAG_OPTION_GAL_NPIX: { value.Flt = GalphotValue_GAL_NPIX (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 320 case MAG_OPTION_GAL_TYPE: { value.Flt = GalphotValue_GAL_TYPE (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 321 case MAG_OPTION_GAL_FLAGS: { value.Flt = GalphotValue_GAL_FLAGS (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 322 323 case MAG_OPTION_GAL_OBJ_ID: { value.Flt = GalphotValue_GAL_OBJ_ID (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 324 case MAG_OPTION_GAL_CAT_ID: { value.Flt = GalphotValue_GAL_CAT_ID (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 325 case MAG_OPTION_GAL_DET_ID: { value.Flt = GalphotValue_GAL_DET_ID (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 326 case MAG_OPTION_GAL_IMAGE_ID: { value.Flt = GalphotValue_GAL_IMAGE_ID (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 327 328 case MAG_OPTION_E1_PSF: break; 329 case MAG_OPTION_E2_PSF: break; 330 case MAG_OPTION_NONE: break; 325 331 } 326 332 break; -
trunk/Ohana/src/libdvo/src/dvo_photcode_utils.c
r33649 r42821 1 1 # include <dvo.h> 2 3 /* the photcode table includes a number of SEC types, photcodes->Nsecfilt 4 hashNsec[code] returns the number in the sequence 0 - Nsecfilt for a given SEC code 5 */ 6 7 // these APIs originally just matched by number of the code, but they should 8 // match by the *name* of the photcode (e.g., g = g) 2 9 3 10 // Create a map between the secfilt values from one photcode table to another … … 11 18 // loop over entries in the input table 12 19 for (i = 0; i < NsecfiltIn; i++) { 13 int code = input[0].codeNsec[i]; 20 int inseq = input[0].codeNsec[i]; 21 myAssert (inseq > -1, "invalid SEC"); 22 int incode = input[0].hashcode[inseq]; 14 23 int entry = -1; 15 24 // find the matching entry in the output table 16 25 for (j = 0; j < NsecfiltOut; j++) { 17 int outcode = output[0].codeNsec[j]; 18 if (code == outcode) { 19 entry = j; 20 break; 21 } 26 int outseq = output[0].codeNsec[j]; 27 myAssert (outseq > -1, "invalid SEC"); 28 int outcode = output[0].hashcode[outseq]; 29 if (strcmp (input[0].code[incode].name, output[0].code[outcode].name)) continue; 30 entry = j; 31 break; 22 32 } 23 // if (entry == -1) {24 // // entry is missing fail (no printfs in this file)25 // free(map);26 // return(FALSE);27 // }28 29 33 // if entry is still -1, we will skip this one (not map into the output db) 30 34 map[i] = entry; -
trunk/Ohana/src/libkapa/src/IOfuncs.c
r36084 r42821 89 89 if (Nbytes == 0) { 90 90 return TRUE; 91 } 92 if (Nbytes < 0) { 93 fprintf (stderr, "error in kapa communication (KiiScanMessage) %s\n", buffer); 94 return FALSE; 91 95 } 92 96 -
trunk/Ohana/src/libkapa/src/KapaWindow.c
r41377 r42821 259 259 data[0].formatYm, data[0].formatYp); 260 260 261 memset (&data[0].coords, 0, sizeof(data[0].coords)); 262 261 263 KiiScanMessage (fd, "%f %f %f %f", 262 264 &data[0].coords.pc1_1, &data[0].coords.pc2_2, … … 301 303 KiiSendCommand (fd, 4, "GSTY"); 302 304 303 KapaScanGraphData (fd, data); 305 if (!KapaScanGraphData (fd, data)) { 306 fprintf (stderr, "error getting graph data KapaGetGraphData (sent GSTY)\n"); 307 return FALSE; 308 } 304 309 305 310 KiiWaitAnswer (fd, "DONE"); -
trunk/Ohana/src/libohana/include/ohana.h
r42389 r42821 170 170 171 171 /* if your build crashes on OFF_T_MODE, you probably need to add your 64bit hardware to this list */ 172 # if def _LARGEFILE_SOURCE172 # if defined(_LARGEFILE_SOURCE) && !defined(OFF_T_FMT) 173 173 # define OFF_T_FMT "%jd" 174 174 # endif 175 175 176 # if def lin64176 # if defined(lin64) && !defined(OFF_T_FMT) 177 177 # define OFF_T_FMT "%jd" 178 178 # endif 179 179 180 180 // mac is annoying 181 # if def _DARWIN_C_SOURCE181 # if defined(_DARWIN_C_SOURCE) && !defined(OFF_T_FMT) 182 182 # define OFF_T_FMT "%lld" 183 183 # endif 184 # if def darwin_x86184 # if defined(darwin_x86) && !defined(OFF_T_FMT) 185 185 # define OFF_T_FMT "%lld" 186 186 # endif 187 # if def darwin187 # if defined(darwin) && !defined(OFF_T_FMT) 188 188 # define OFF_T_FMT "%lld" 189 189 # endif -
trunk/Ohana/src/libohana/src/ohana_allocate.c
r42074 r42821 448 448 int status = TRUE; 449 449 450 OhanaMemblock *prevBlock = NULL; 451 450 452 while (thisBlock) { 451 453 … … 475 477 Nbytes += thisBlock->size; 476 478 479 prevBlock = thisBlock; // save for debugging 477 480 thisBlock = thisBlock->prevBlock; 478 481 } … … 480 483 if (Ntotal || VERBOSE) { 481 484 fprintf (stderr, "%zd memory blocks allocated (%zd bytes total), %zd good, %zd bad ", Ntotal, Nbytes, Ngood, Nbad); 482 fprintf (stderr, "@ %s:%d (%s)\n", myFile, myLine, myFunc); 485 fprintf (stderr, "@ %s:%d (%s) ", myFile, myLine, myFunc); 486 fprintf (stderr, "(%zd penultimate block)\n", (size_t) prevBlock); 483 487 } 484 488 -
trunk/Ohana/src/opihi/cmd.astro/cdensify.c
r41515 r42821 1 1 # include "data.h" 2 # define dCOS(A) ((double) cos ((double)RAD_DEG*A)) 2 3 3 4 # define CHECKVAL(ARG) if (!isfinite(ARG)) { gprint (GP_ERR, "illegal value for %s: %f\n", #ARG, ARG); return (FALSE); } … … 116 117 PutCoords (&newcoords, &bf[0].header); 117 118 119 // use the mask to prevent double-counting 120 ALLOCATE_PTR (mask, char, Nx*Ny); 121 118 122 float scalescale = scale*scale; 119 123 float scale2 = (scale + 1.0) * (scale + 1.0); … … 142 146 coords.crval1 = rn; 143 147 coords.crval2 = *d; 148 149 // XXX do not oversample by more than a factor of 10 150 float dXn = dX * MAX(fabs(dCOS(*d)), 0.1); 144 151 145 152 float F = 1.0; 146 153 if (vv) { F = isFloatScale ? Fs[i] : Is[i]; } 154 155 // reset the mask so we do not double-count 156 memset (mask, 0, Nx*Ny); 147 157 148 158 switch (PSFTYPE) { … … 162 172 break; 163 173 case IS_SQUARE: 164 for (ix = -scale; ix <= scale; ix += dX ) {174 for (ix = -scale; ix <= scale; ix += dXn) { 165 175 for (iy = -scale; iy <= scale; iy += dY) { 166 176 double rp, dp; … … 184 194 break; 185 195 case IS_CIRCLE: 186 for (ix = -scale ; ix <= scale; ix += dX) {187 for (iy = -scale ; iy <= scale; iy += dY) {196 for (ix = -scale - dXn; ix <= scale + dXn; ix += dXn) { 197 for (iy = -scale - dY; iy <= scale + dY; iy += dY) { 188 198 float r2 = ix*ix + iy*iy; 189 199 double rp, dp; … … 199 209 if (Xb < 0) continue; 200 210 if (Yb < 0) continue; 211 if (mask[Xb + Yb*Nx]) continue; 212 mask[Xb + Yb*Nx] = 1; 201 213 if (vv) { 202 214 val[Xb + Yb*Nx] += Normalize ? fCircle*F : F; … … 208 220 break; 209 221 case IS_GAUSS: 210 for (ix = -3.0*scale; ix <= 3.0*scale; ix += dX ) {222 for (ix = -3.0*scale; ix <= 3.0*scale; ix += dXn) { 211 223 for (iy = -3.0*scale; iy <= 3.0*scale; iy += dY) { 212 224 float r2 = ix*ix + iy*iy; … … 232 244 } 233 245 } 246 247 free (mask); 234 248 return (TRUE); 235 249 } -
trunk/Ohana/src/opihi/cmd.astro/imfit-fgauss-pol.c
r42078 r42821 51 51 set_variable ("Zpk", par[5]); 52 52 set_variable ("Sg", par[6]); 53 54 /* 55 set_variable ("dXg", dpar[0]); 56 set_variable ("dYg", dpar[1]); 57 set_variable ("dSXg", NAN); 58 set_variable ("dSYg", NAN); 59 set_variable ("dSXYg", NAN); 60 set_variable ("dZpk", dpar[5]); 61 set_variable ("dSg", dpar[6]); 62 */ 53 63 } 54 64 -
trunk/Ohana/src/opihi/cmd.astro/imfit-fgauss.c
r42078 r42821 39 39 set_variable ("Zpk", par[5]); 40 40 set_variable ("Sg", par[6]); 41 42 /* 43 set_variable ("dXg", dpar[0]); 44 set_variable ("dYg", dpar[1]); 45 set_variable ("dSXg", 2.35 / dpar[2]); 46 set_variable ("dSYg", 2.35 / dpar[3]); 47 set_variable ("dSXYg", dpar[4]); 48 set_variable ("dZpk", dpar[5]); 49 set_variable ("dSg", dpar[6]); 50 */ 41 51 } 42 52 -
trunk/Ohana/src/opihi/cmd.astro/imfit-pgauss-psf.c
r39457 r42821 35 35 set_variable ("Zpk", par[2]); 36 36 set_variable ("Sg", par[3]); 37 38 /* 39 set_variable ("dXg", dpar[0]); 40 set_variable ("dYg", dpar[1]); 41 set_variable ("dZpk", dpar[2]); 42 set_variable ("dSg", dpar[3]); 43 */ 37 44 } 38 45 -
trunk/Ohana/src/opihi/cmd.astro/imfit-pgauss.c
r39457 r42821 37 37 set_variable ("Zpk", par[5]); 38 38 set_variable ("Sg", par[6]); 39 40 /* 41 set_variable ("dXg", dpar[0]); 42 set_variable ("dYg", dpar[1]); 43 set_variable ("dSXg", 2.35 / dpar[2]); 44 set_variable ("dSYg", 2.35 / dpar[3]); 45 set_variable ("dSXYg", dpar[4]); 46 set_variable ("dZpk", dpar[5]); 47 set_variable ("dSg", dpar[6]); 48 */ 39 49 } 40 50 -
trunk/Ohana/src/opihi/cmd.astro/imfit-q2gauss.c
r42078 r42821 41 41 set_variable ("Sg", par[6]); 42 42 set_variable ("Sr", par[7]); 43 44 /* 45 set_variable ("dXg", dpar[0]); 46 set_variable ("dYg", dpar[1]); 47 set_variable ("dSXg", 2.35 / dpar[2]); 48 set_variable ("dSYg", 2.35 / dpar[3]); 49 set_variable ("dSXYg", dpar[4]); 50 set_variable ("dZpk", dpar[5]); 51 set_variable ("dSg", dpar[6]); 52 set_variable ("dSr", dpar[7]); 53 */ 43 54 } 44 55 -
trunk/Ohana/src/opihi/cmd.astro/imfit-qfgauss.c
r39457 r42821 41 41 set_variable ("Zpk", par[5]); 42 42 set_variable ("Sg", par[6]); 43 44 /* 45 set_variable ("dXg", dpar[0]); 46 set_variable ("dYg", dpar[1]); 47 set_variable ("dSXg", 2.35 / dpar[2]); 48 set_variable ("dSYg", 2.35 / dpar[3]); 49 set_variable ("dSXYg", dpar[4]); 50 set_variable ("dZpk", dpar[5]); 51 set_variable ("dSg", dpar[6]); 52 */ 43 53 } 44 54 -
trunk/Ohana/src/opihi/cmd.astro/imfit-qgauss-psf.c
r39457 r42821 38 38 set_variable ("Zpk", par[2]); 39 39 set_variable ("Sg", par[3]); 40 41 /* 42 set_variable ("dXg", dpar[0]); 43 set_variable ("dYg", dpar[1]); 44 set_variable ("dZpk", dpar[2]); 45 set_variable ("dSg", dpar[3]); 46 */ 40 47 } 41 48 -
trunk/Ohana/src/opihi/cmd.astro/imfit-qgauss.c
r42078 r42821 41 41 set_variable ("Sg", par[6]); 42 42 set_variable ("Sr", par[7]); 43 44 /* 45 set_variable ("dXg", dpar[0]); 46 set_variable ("dYg", dpar[1]); 47 set_variable ("dSXg", 2.35 / dpar[2]); 48 set_variable ("dSYg", 2.35 / dpar[3]); 49 set_variable ("dSXYg", dpar[4]); 50 set_variable ("dZpk", dpar[5]); 51 set_variable ("dSg", dpar[6]); 52 set_variable ("dSr", dpar[7]); 53 */ 43 54 } 44 55 -
trunk/Ohana/src/opihi/cmd.astro/imfit-qrgauss.c
r42078 r42821 42 42 set_variable ("Sg", par[6]); 43 43 set_variable ("Npow", par[7]); 44 45 /* 46 set_variable ("dXg", dpar[0]); 47 set_variable ("dYg", dpar[1]); 48 set_variable ("dSXg", 2.35 / dpar[2]); 49 set_variable ("dSYg", 2.35 / dpar[3]); 50 set_variable ("dSXYg", dpar[4]); 51 set_variable ("dZpk", dpar[5]); 52 set_variable ("dSg", dpar[6]); 53 set_variable ("dNpow", dpar[7]); 54 */ 44 55 } 45 56 -
trunk/Ohana/src/opihi/cmd.astro/imfit-r2gauss.c
r42078 r42821 85 85 set_variable ("SYf", 2.35 * sqrt(2.0) / par[8]); 86 86 set_variable ("SXYf", par[9]); 87 88 /* 89 set_variable ("dXg", dpar[0]); 90 set_variable ("dYg", dpar[1]); 91 set_variable ("dSXg", 2.35 * sqrt(2.0) / dpar[2]); 92 set_variable ("dSYg", 2.35 * sqrt(2.0) / dpar[3]); 93 set_variable ("dSXYg", dpar[4]); 94 set_variable ("dZpk", dpar[5]); 95 set_variable ("dSg", dpar[6]); 96 set_variable ("dSXf", 2.35 * sqrt(2.0) / dpar[7]); 97 set_variable ("dSYf", 2.35 * sqrt(2.0) / dpar[8]); 98 set_variable ("dSXYf", dpar[9]); 99 */ 87 100 } -
trunk/Ohana/src/opihi/cmd.astro/imfit-rgauss.c
r42078 r42821 42 42 set_variable ("Sg", par[6]); 43 43 set_variable ("Sr", par[7]); 44 45 /* 46 set_variable ("dXg", dpar[0]); 47 set_variable ("dYg", dpar[1]); 48 set_variable ("dSXg", 2.35 / dpar[2]); 49 set_variable ("dSYg", 2.35 / dpar[3]); 50 set_variable ("dSXYg", dpar[4]); 51 set_variable ("dZpk", dpar[5]); 52 set_variable ("dSg", dpar[6]); 53 set_variable ("dSr", dpar[7]); 54 */ 44 55 } 45 56 -
trunk/Ohana/src/opihi/cmd.astro/imfit-sgauss.c
r39457 r42821 49 49 set_variable ("SYf", 2.35 / par[8]); 50 50 set_variable ("SXYf", par[9]); 51 52 /* 53 set_variable ("dXg", dpar[0]); 54 set_variable ("dYg", dpar[1]); 55 set_variable ("dSXg", 2.35 / dpar[2]); 56 set_variable ("dSYg", 2.35 / dpar[3]); 57 set_variable ("dSXYg", dpar[4]); 58 set_variable ("dZpk", dpar[5]); 59 set_variable ("dSg", dpar[6]); 60 set_variable ("dSXf", 2.35 / dpar[7]); 61 set_variable ("dSYf", 2.35 / dpar[8]); 62 set_variable ("dSXYf", dpar[9]); 63 */ 51 64 } 52 65 -
trunk/Ohana/src/opihi/cmd.astro/imfit-tgauss.c
r39457 r42821 80 80 set_variable ("SYf", 2.35 * sqrt(2.0) / par[8]); 81 81 set_variable ("SXYf", par[9]); 82 83 /* 84 set_variable ("dXg", dpar[0]); 85 set_variable ("dYg", dpar[1]); 86 set_variable ("dSXg", 2.35 * sqrt(2.0) / dpar[2]); 87 set_variable ("dSYg", 2.35 * sqrt(2.0) / dpar[3]); 88 set_variable ("dSXYg", dpar[4]); 89 set_variable ("dZpk", dpar[5]); 90 set_variable ("dSg", dpar[6]); 91 set_variable ("dSXf", 2.35 * sqrt(2.0) / dpar[7]); 92 set_variable ("dSYf", 2.35 * sqrt(2.0) / dpar[8]); 93 set_variable ("dSXYf", dpar[9]); 94 */ 82 95 } -
trunk/Ohana/src/opihi/cmd.astro/imfit-vgauss.c
r39457 r42821 69 69 set_variable ("SXf", par[7]); 70 70 set_variable ("SYf", par[8]); 71 72 /* 73 set_variable ("dXg", dpar[0]); 74 set_variable ("dYg", dpar[1]); 75 set_variable ("dSXg", 2.35 / dpar[2]); 76 set_variable ("dSYg", 2.35 / dpar[3]); 77 set_variable ("dSXYg", dpar[4]); 78 set_variable ("dZpk", dpar[5]); 79 set_variable ("dSg", dpar[6]); 80 set_variable ("dSXf", dpar[7]); 81 set_variable ("dSYf", dpar[8]); 82 */ 71 83 } -
trunk/Ohana/src/opihi/cmd.astro/imfit.c
r42078 r42821 13 13 } 14 14 15 Buffer *var = NULL; 16 if ((N = get_argument (argc, argv, "-var-image"))) { 17 remove_argument (N, &argc, argv); 18 var = SelectBuffer (argv[N], OLDBUFFER, TRUE); 19 if (!var) { 20 gprint (GP_ERR, "unknown buffer for variance %s\n", argv[N]); 21 FREE (Save); 22 return (FALSE); 23 } 24 remove_argument (N, &argc, argv); 25 } 26 15 27 int Insert = FALSE; 16 28 if ((N = get_argument (argc, argv, "-insert"))) { … … 18 30 Insert = TRUE; 19 31 if (Save) { gprint (GP_ERR, "-save and -insert are mutually exclusive\n"); free (Save); return (FALSE); } 32 if (var) { gprint (GP_ERR, "-save and -var-image are mutually exclusive\n"); return (FALSE); } 20 33 } 21 34 … … 40 53 Gain = atof(argv[N]); 41 54 remove_argument (N, &argc, argv); 55 if (var) { gprint (GP_ERR, "warning: -var-image selected, -gain will have no effect\n"); } 42 56 } 43 57 … … 48 62 RDnoise = atof(argv[N]); 49 63 remove_argument (N, &argc, argv); 64 if (var) { gprint (GP_ERR, "warning: -var-image selected, -rdnoise will have no effect\n"); } 50 65 } 51 66 … … 140 155 if (j + sy >= Ny) continue; 141 156 float *V = (float *)(buf[0].matrix.buffer) + (j+sy)*buf[0].matrix.Naxis[0] + sx; 157 float *dV = (var) ? ((float *)(var[0].matrix.buffer) + (j+sy)*var[0].matrix.Naxis[0] + sx) : NULL; 142 158 for (int i = 0; i < dX; i++) { 143 159 if (i + sx < 0) continue; … … 145 161 if (*V > SatThreshold) goto next; // skip pixels above threshold 146 162 if (!isfinite(*V)) goto next; // skip nan pixels 147 dz[N] = (SQ(RDnoise) + MAX(0.0, *V/Gain)); // treat negative pixels as pure read noise 163 if (dV) { 164 dz[N] = *dV; 165 } else { 166 dz[N] = (SQ(RDnoise) + MAX(0.0, *V/Gain)); // treat negative pixels as pure read noise 167 } 148 168 if (dz[N] <= 0) goto next; 149 169 dz[N] = 1.0 / dz[N]; … … 154 174 next: 155 175 V++; 176 if (dV) { dV++; } 156 177 } 157 178 } -
trunk/Ohana/src/opihi/cmd.astro/mkgauss.c
r41341 r42821 11 11 Buffer *buf; 12 12 13 // if TRUE, integrated flux is Flux, else Io is Flux 13 14 int Normalize = FALSE; 14 15 if ((N = get_argument (argc, argv, "-norm"))) { … … 16 17 remove_argument (N, &argc, argv); 17 18 } 19 20 // Io or integrated flux (depending on value of Normalize) 21 float Flux = 1.0; 22 if ((N = get_argument (argc, argv, "-flux"))) { 23 remove_argument (N, &argc, argv); 24 Flux = atof(argv[N]); 25 remove_argument (N, &argc, argv); 26 } 27 18 28 19 29 // this should be Nx/2, Ny/2 if not set … … 29 39 if ((argc < 3) || (argc > 5)) { 30 40 gprint (GP_ERR, "USAGE: mkgauss (buffer) (sigma) [[sy/sx] angle]\n"); 41 gprint (GP_ERR, " -flux flux : integral or peak is flux (default is 1.0)\n"); 42 gprint (GP_ERR, " -norm : integral is flux (else peak)\n"); 43 gprint (GP_ERR, " -c X Y : place center at X,Y\n"); 31 44 return (FALSE); 32 45 } … … 66 79 /* f = exp (-r), r = (x^2 / 2Sx) + (y^2 / 2Sy) + Sxy*x*y */ 67 80 68 double Io = Normalize ? 1.0 / (2.0 * M_PI * Sig_x * Sig_y) : 1.0;81 double Io = Normalize ? Flux / (2.0 * M_PI * Sig_x * Sig_y) : Flux; 69 82 70 83 in = (float *) buf[0].matrix.buffer; -
trunk/Ohana/src/opihi/cmd.astro/region.c
r42078 r42821 160 160 if (!strcasecmp (argv[CtypeArg], "PAR")) { strcpy (graphmode.coords.ctype, "DEC--PAR"); goto got_ctype; } 161 161 if (!strcasecmp (argv[CtypeArg], "MOL")) { strcpy (graphmode.coords.ctype, "DEC--MOL"); goto got_ctype; } 162 if (!strcasecmp (argv[CtypeArg], "LIN")) { strcpy (graphmode.coords.ctype, "DEC--LIN"); goto got_ctype; } 163 if (!strcasecmp (argv[CtypeArg], "CAR")) { strcpy (graphmode.coords.ctype, "DEC--CAT"); goto got_ctype; } 162 164 gprint (GP_ERR, "ERROR: invalid projection type %s\n", argv[CtypeArg]); 163 gprint (GP_ERR, "allowed values: TAN, SIN, ARC, STG, ZEA, AIT, GLS, PAR, MOL \n");165 gprint (GP_ERR, "allowed values: TAN, SIN, ARC, STG, ZEA, AIT, GLS, PAR, MOL, LIN, CAR\n"); 164 166 return FALSE; 165 167 } -
trunk/Ohana/src/opihi/cmd.data/Makefile
r42456 r42821 67 67 $(SRC)/ungridify.$(ARCH).o \ 68 68 $(SRC)/histogram.$(ARCH).o \ 69 $(SRC)/histbins.$(ARCH).o \ 69 70 $(SRC)/tdhistogram.$(ARCH).o \ 70 71 $(SRC)/hermitian1d.$(ARCH).o \ … … 80 81 $(SRC)/imresample.$(ARCH).o \ 81 82 $(SRC)/imcollapse.$(ARCH).o \ 83 $(SRC)/impoints.$(ARCH).o \ 82 84 $(SRC)/integrate.$(ARCH).o \ 83 85 $(SRC)/interpolate.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.data/init.c
r42456 r42821 56 56 int ungridify PROTO((int, char **)); 57 57 int histogram PROTO((int, char **)); 58 int histbins PROTO((int, char **)); 58 59 int tdhistogram PROTO((int, char **)); 59 60 int hermitian1d PROTO((int, char **)); … … 70 71 int imresample PROTO((int, char **)); 71 72 int imcollapse PROTO((int, char **)); 73 int impoints PROTO((int, char **)); 72 74 int integrate PROTO((int, char **)); 73 75 int interpolate PROTO((int, char **)); … … 265 267 {1, "header", header, "print image header"}, 266 268 {1, "histogram", histogram, "generate histogram from vector"}, 269 {1, "histbins", histbins, "generate histogram from vector, bins specified by vectors"}, 267 270 {1, "tdhistogram", tdhistogram, "generate 2D histogram image from vector set"}, 268 271 {1, "hermitian1d", hermitian1d, "generate 1-D Hermitian Polynomial"}, … … 281 284 {1, "imconvolve", imconvolve, "full 2D real-space convolution"}, 282 285 {1, "imstats", imstats, "statistics on a portion of an image"}, 286 {1, "impoints", impoints, "insert points into an image by vector pair"}, 283 287 {1, "integrate", integrate, "integrate a vector"}, 284 288 {1, "interpolate_presort", interpolate_presort, "interpolate between vector pairs"}, -
trunk/Ohana/src/opihi/cmd.data/interpolate_presort.c
r41341 r42821 17 17 /** check basic syntax **/ 18 18 if (argc != 5) { 19 gprint (GP_ERR, "USAGE: interpolate Xi Yi Xo Yo \n");19 gprint (GP_ERR, "USAGE: interpolate Xi Yi Xo Yo [-fill-ends]\n"); 20 20 gprint (GP_ERR, " Xi Yi - sorted reference vectors\n"); 21 21 gprint (GP_ERR, " Xo - output positions (vector)\n"); … … 23 23 gprint (GP_ERR, " (vectors must be pre-sorted)\n"); 24 24 gprint (GP_ERR, " (use 'threshold' to interpolate to a value)\n"); 25 gprint (GP_ERR, " -fill-ends : values outside of range are set to end-point values\n"); 25 26 return (FALSE); 26 27 } -
trunk/Ohana/src/opihi/cmd.data/vgroup.c
r33963 r42821 70 70 ALLOCATE (values, double, xin[0].Nelements); 71 71 72 for (i = 0; i < xout[0].Nelements - 1; i++) { 72 // if we specify binsize, then we need to examine all bins 73 int Nout = isnan(binsize) ? xout[0].Nelements - 1 : xout[0].Nelements; 74 for (i = 0; i < Nout; i++) { 73 75 if (isnan(binsize)) { 74 76 xmin = xout[0].elements.Flt[i]; … … 81 83 N = 0; 82 84 for (j = 0; j < xin[0].Nelements; j++) { 83 if (xin[0].elements.Flt[j] < xmin) continue;84 if (xin[0].elements.Flt[j] > xmax) continue;85 if (xin[0].elements.Flt[j] < xmin) continue; 86 if (xin[0].elements.Flt[j] >= xmax) continue; 85 87 if (yin) { 86 88 values[N] = yin[0].elements.Flt[j]; -
trunk/Ohana/src/opihi/dvo/avperiodogram.c
r40574 r42821 274 274 // The first 3 values[] / fields[] will be time, mag, dmag 275 275 for (off_t n = 0; n < Nmfields; n++) { 276 mvalues[n] = dbExtractMeasures (average, secfilt, &measure[k], NULL, NULL, &mfields[n]);276 mvalues[n] = dbExtractMeasures (average, secfilt, NULL, &measure[k], NULL, NULL, NULL, &mfields[n]); 277 277 } 278 278 if (!dbBooleanCond (mstack, Nmstack, mvalues)) continue; -
trunk/Ohana/src/opihi/dvo/avperiodomatch.c
r41379 r42821 302 302 // The first 3 values[] / fields[] will be time, mag, dmag 303 303 for (off_t n = 0; n < Nmfields; n++) { 304 mvalues[n] = dbExtractMeasures (average, secfilt, &measure[k], NULL, NULL, &mfields[n]);304 mvalues[n] = dbExtractMeasures (average, secfilt, NULL, &measure[k], NULL, NULL, NULL, &mfields[n]); 305 305 } 306 306 if (!dbBooleanCond (mstack, Nmstack, mvalues)) continue; -
trunk/Ohana/src/opihi/dvo/avselect.c
r41341 r42821 17 17 int VERBOSE; 18 18 char name[1024]; 19 float RADIUS;19 opihi_flt RADIUS; 20 20 21 21 Catalog catalog; 22 22 23 23 Vector **vec, **invec, *RAvec, *DECvec, *IDXvec, *RADvec; 24 Vector *RINvec = NULL; 24 25 dbField *fields; 25 26 dbValue *values; … … 102 103 } 103 104 104 RADIUS = atof (argv[1]); 105 106 /* load regions which contain all supplied RA,DEC coordinates */ 105 if (SelectScalar (argv[1], &RADIUS)) { 106 remove_argument (1, &argc, argv); 107 } else { 108 gprint (GP_ERR, " RADIUS must be a numerical value\n"); 109 goto help; 110 if ((RINvec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto help; 111 RADIUS = 0.0; // find the max radius for region selection: 112 for (i = 0; i < RINvec->Nelements; i++) { 113 RADIUS = MAX(RINvec->elements.Flt[i], RADIUS); 114 } 115 } 116 117 /* load regions which contain all supplied RA,DEC coordinates (for RINvec, uses max radius) */ 107 118 if ((skylist = SelectRegionsByCoordVectorsAndRadius (RAvec, DECvec, RADIUS/3600.0)) == NULL) goto escape; 108 119 … … 167 178 return status; 168 179 } 169 170 RADIUS = atof (argv[1]);171 remove_argument (1, &argc, argv);172 180 173 181 // parse the fields to be extracted and returned -
trunk/Ohana/src/opihi/dvo/gstar.c
r41427 r42821 401 401 gprint (GP_LOG, "%20s ", date); 402 402 gprint (GP_LOG, "%f ", catalog.average[k].Trange / 86400.0); 403 404 gprint (GP_LOG, "%ld ", catalog.average[k].extID); 405 // gprint (GP_LOG, "0x%16x ", catalog.average[k].extID); 403 406 } 404 407 -
trunk/Ohana/src/opihi/dvo/mextract.c
r42103 r42821 221 221 } 222 222 223 int needLensobj = dbFieldNeedLensobj (fields, Nfields); 223 224 int needLensing = dbFieldNeedLensing (fields, Nfields); 224 225 int needStarpar = dbFieldNeedStarpar (fields, Nfields, FALSE); 226 int needGalphot = dbFieldNeedGalphot (fields, Nfields); 225 227 226 228 // the lensing table does not have a good index to/from the measure table. if we need lensing … … 247 249 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 248 250 catalog.catflags |= needLensing ? DVO_LOAD_LENSING : DVO_SKIP_LENSING; 251 catalog.catflags |= needLensobj ? DVO_LOAD_LENSOBJ : DVO_SKIP_LENSOBJ; 249 252 catalog.catflags |= needStarpar ? DVO_LOAD_STARPAR : DVO_SKIP_STARPAR; 253 catalog.catflags |= needGalphot ? DVO_LOAD_GALPHOT : DVO_SKIP_GALPHOT; 250 254 catalog.Nsecfilt = Nsecfilt; 251 255 … … 297 301 dbExtractMeasuresInitMeas (); // reset counters for saved fields (costs very little 298 302 299 int Nstarpar = average->starparOffset; 300 StarPar *starpar = needStarpar && average->Nstarpar ? &catalog.starpar[Nstarpar] : NULL; 303 int nStar = average->starparOffset; 304 StarPar *starpar = needStarpar && average->Nstarpar ? &catalog.starpar[nStar] : NULL; 305 306 int nLens = average->lensobjOffset; 307 Lensobj *lensobj = needLensobj && average->Nlensobj ? &catalog.lensobj[nLens] : NULL; 308 309 int nPhot = average->galphotOffset; 310 GalPhot *galphot = needGalphot && average->Ngalphot ? &catalog.galphot[nPhot] : NULL; 301 311 302 312 Lensing *lensing = NULL; … … 313 323 314 324 for (n = 0; n < Nfields; n++) { 315 values[n] = dbExtractMeasures (average, secfilt, &catalog.measure[m], lensing, starpar, &fields[n]);325 values[n] = dbExtractMeasures (average, secfilt, lensobj, &catalog.measure[m], lensing, starpar, galphot, &fields[n]); 316 326 } 317 327 // fprintf (stderr, "object: ave: %f, cat: %f, averef %d\n", fields[n].name, values[2], values[3], catalog.measure[m].averef); -
trunk/Ohana/src/opihi/dvo/mmatch.c
r41341 r42821 232 232 ALLOCATE (index, off_t, Nelem); 233 233 234 // int needLensing = dbFieldNeedLensing (fields, Nfields); 234 int needLensobj = dbFieldNeedLensobj (fields, Nfields); 235 //int needLensing = dbFieldNeedLensing (fields, Nfields); 235 236 int needStarpar = dbFieldNeedStarpar (fields, Nfields, FALSE); 237 int needGalphot = dbFieldNeedGalphot (fields, Nfields); 236 238 237 239 // grab data from all selected sky regions … … 249 251 catalog.filename = HOST_ID ? hostfile : skylist[0].filename[i]; 250 252 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT | DVO_LOAD_MEASURE; 253 catalog.catflags |= needLensobj ? DVO_LOAD_LENSOBJ : DVO_SKIP_LENSOBJ; 251 254 catalog.catflags |= needStarpar ? DVO_LOAD_STARPAR : DVO_SKIP_STARPAR; 255 catalog.catflags |= needGalphot ? DVO_LOAD_GALPHOT : DVO_SKIP_GALPHOT; 252 256 catalog.Nsecfilt = Nsecfilt; 253 257 … … 289 293 Average *average = &catalog.average[Ncat]; 290 294 291 int Nstarpar = average->starparOffset; 292 StarPar *starpar = needStarpar ? &catalog.starpar[Nstarpar] : NULL; 295 int nStar = average->starparOffset; 296 StarPar *starpar = needStarpar && average->Nstarpar ? &catalog.starpar[nStar] : NULL; 297 298 int nLens = average->lensobjOffset; 299 Lensobj *lensobj = needLensobj && average->Nlensobj ? &catalog.lensobj[nLens] : NULL; 300 301 int nPhot = average->galphotOffset; 302 GalPhot *galphot = needGalphot && average->Ngalphot ? &catalog.galphot[nPhot] : NULL; 293 303 294 304 // int Nlensing = average->lensobjOffset; … … 299 309 300 310 for (n = 0; n < Nfields; n++) { 301 values[n] = dbExtractMeasures (average, secfilt, &catalog.measure[m], NULL, starpar, &fields[n]);311 values[n] = dbExtractMeasures (average, secfilt, lensobj, &catalog.measure[m], NULL, starpar, galphot, &fields[n]); 302 312 } 303 313 -
trunk/Ohana/src/opihi/dvo/mmextract.c
r39457 r42821 174 174 } 175 175 176 // int needLensing = dbFieldNeedLensing (fields, Nfields); 176 int needLensobj = dbFieldNeedLensobj (fields, Nfields); 177 //int needLensing = dbFieldNeedLensing (fields, Nfields); 177 178 int needStarpar = dbFieldNeedStarpar (fields, Nfields, FALSE); 179 int needGalphot = dbFieldNeedGalphot (fields, Nfields); 178 180 179 181 // grab data from all selected sky regions … … 185 187 catalog.filename = skylist[0].filename[i]; 186 188 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 189 // catalog.catflags |= needLensing ? DVO_LOAD_LENSING : DVO_SKIP_LENSING; 190 catalog.catflags |= needLensobj ? DVO_LOAD_LENSOBJ : DVO_SKIP_LENSOBJ; 191 catalog.catflags |= needStarpar ? DVO_LOAD_STARPAR : DVO_SKIP_STARPAR; 192 catalog.catflags |= needGalphot ? DVO_LOAD_GALPHOT : DVO_SKIP_GALPHOT; 187 193 catalog.Nsecfilt = Nsecfilt; 188 194 … … 220 226 Average *average = &catalog.average[j]; 221 227 222 int Nstarpar = average->starparOffset; 223 StarPar *starpar = needStarpar ? &catalog.starpar[Nstarpar] : NULL; 228 int nStar = average->starparOffset; 229 StarPar *starpar = needStarpar && average->Nstarpar ? &catalog.starpar[nStar] : NULL; 230 231 int nLens = average->lensobjOffset; 232 Lensobj *lensobj = needLensobj && average->Nlensobj ? &catalog.lensobj[nLens] : NULL; 233 234 int nPhot = average->galphotOffset; 235 GalPhot *galphot = needGalphot && average->Ngalphot ? &catalog.galphot[nPhot] : NULL; 224 236 225 237 // int Nlensing = average->lensobjOffset; … … 231 243 for (n = 0; n < Nfields; n++) { 232 244 // values needs to be a pointer to a type with FLT and INT (with a union, we would save a bit of memory...) 233 values[n] = dbExtractMeasures (average, secfilt, &catalog.measure[m], NULL, starpar, &fields[n]);245 values[n] = dbExtractMeasures (average, secfilt, lensobj, &catalog.measure[m], NULL, starpar, galphot, &fields[n]); 234 246 } 235 247 // fprintf (stderr, "object: ave: %f, cat: %f, averef %d\n", fields[n].name, values[2], values[3], catalog.measure[m].averef); -
trunk/Ohana/src/opihi/lib.data/mrq2dmin.c
r41715 r42821 17 17 static opihi_flt *parmax = NULL; 18 18 19 /** only used locally **/ 19 20 opihi_flt mrq2dcof (opihi_flt *x, opihi_flt *t, opihi_flt *y, opihi_flt *dy, int Npts, 20 21 opihi_flt *par, int Npar, opihi_flt **ta, opihi_flt **tb, … … 60 61 } 61 62 63 /** only used in imfit-test.c ?? **/ 62 64 opihi_flt mrq2dchi (opihi_flt *x, opihi_flt *t, opihi_flt *y, opihi_flt *dy, int Npts, 63 65 opihi_flt *par, int Npar, … … 126 128 chisq = ochisq; 127 129 } 130 131 /* note that the parameter errors are sqrt(alpha[j][j]) */ 128 132 129 133 return (chisq); -
trunk/Ohana/src/opihi/lib.data/spline.c
r42332 r42821 113 113 opihi_flt dx, a, b, value; 114 114 115 // saturate correction at high and low ends 116 if (X < x[0]) return y[0]; 117 if (X > x[N-1]) return y[N-1]; 115 // linear extrapolation past endpoints 116 if (X < x[0]) { 117 hi = 1; 118 lo = 0; 119 goto evaluate; 120 // alternative: saturate correction at high and low ends 121 // return y[0]; 122 } 123 if (X > x[N-1]) { 124 hi = N - 1; 125 lo = N - 2; 126 goto evaluate; 127 // alternative: saturate correction at high and low ends 128 // return y[N-1]; 129 } 118 130 119 131 /* find correct element in array (x must be sorted) */ … … 128 140 } 129 141 } 142 143 evaluate: 130 144 131 145 /* error condition: duplicate abssisca */ -
trunk/Ohana/src/opihi/lib.shell/convert_to_RPN.c
r42080 r42821 77 77 if (!strcmp (argv[i], "isflt")) { type = ST_UNARY; goto gotit; } 78 78 if (!strcmp (argv[i], "length")) { type = ST_UNARY; goto gotit; } 79 if (!strcmp (argv[i], "toupper")) { type = ST_UNARY; goto gotit; } 80 if (!strcmp (argv[i], "tolower")) { type = ST_UNARY; goto gotit; } 79 81 80 82 /* binary operations */ -
trunk/Ohana/src/opihi/lib.shell/stack_math.c
r42389 r42821 1615 1615 int i, Nx; 1616 1616 1617 // handle string vectors in the L_unary function 1618 if (V1->vector->type == OPIHI_STR) { 1619 int status = L_unary (OUT, V1, op); 1620 return status; 1621 } 1622 1617 1623 Nx = V1[0].vector[0].Nelements; 1618 1624 1619 1625 OUT[0].vector = InitVector (); 1620 1626 OUT[0].type = ST_VECTOR_TMP; /*** <<--- says this is a temporary matrix ***/ 1621 1622 if (V1->vector->type == OPIHI_STR) {1623 ResetVector (OUT->vector, V1->vector->type, V1->vector->Nelements);1624 for (i = 0; i < V1->vector->Nelements; i++) {1625 OUT->vector->elements.Str[i] = strcreate (V1->vector->elements.Str[i]);1626 }1627 goto escape;1628 }1629 1627 1630 1628 # define V_FUNC(OP,FTYPE) { \ … … 1744 1742 for (int i = 0; i < Nx; i++) { 1745 1743 Ov[i] = strcreate (Iv[i]); 1744 } 1745 goto escape; 1746 } 1747 if (!strcmp (op, "toupper")) { 1748 for (int i = 0; i < Nx; i++) { 1749 Ov[i] = strcreate (Iv[i]); 1750 for (int j = 0; Ov[i][j]; j++) { 1751 Ov[i][j] = toupper ((unsigned int) Ov[i][j]); 1752 } 1753 } 1754 goto escape; 1755 } 1756 if (!strcmp (op, "tolower")) { 1757 for (int i = 0; i < Nx; i++) { 1758 Ov[i] = strcreate (Iv[i]); 1759 for (int j = 0; Ov[i][j]; j++) { 1760 Ov[i][j] = tolower ((unsigned int) Ov[i][j]); 1761 } 1746 1762 } 1747 1763 goto escape; -
trunk/Ohana/src/relphot
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20230313/Ohana/src/relphot merged: 42568,42696,42705,42708,42740,42761,42818
- Property svn:mergeinfo changed
-
trunk/Ohana/src/relphot/include/relphot.h
r42788 r42821 417 417 int IS_DIFF_DB; 418 418 419 double MAG_MIN; 419 420 double MAG_LIM; 420 421 double SIGMA_LIM; 422 423 double STAR_MAX_PSF_KRON; 424 double PSF_QF_MIN; 425 421 426 double IMAGE_SCATTER; 422 427 double IMAGE_OFFSET; … … 471 476 int RESET_FLATCORR; 472 477 int REPAIR_WARPS; 478 int USE_REF_EQUIV; 473 479 int PRESERVE_PS1; 474 480 int REQUIRE_PSFFIT; … … 486 492 double IMAGE_GOOD_FRACTION; 487 493 int CALIBRATE_STACKS_AND_WARPS; 494 int CALIBRATE_WARPS_LIKE_CHIPS; 495 int CALIBRATE_STACKS_LIKE_CHIPS; 488 496 489 497 int KEEP_UBERCAL; -
trunk/Ohana/src/relphot/src/ConfigInit.c
r41647 r42821 23 23 if (VERBOSE) fprintf (stderr, "loaded config file: %s\n", file); 24 24 25 GetConfig (config, "MAG_LIM", "%lf", 0, &MAG_LIM); 26 GetConfig (config, "SIGMA_LIM", "%lf", 0, &SIGMA_LIM); 25 // the following cuts are limit the objects used to calculate the image zero points. 26 // These are used in bcatalog.c and apply to Mcat (nominal measurement magnitude) 27 GetConfig (config, "SIGMA_LIM", "%lf", 0, &SIGMA_LIM); 28 GetConfig (config, "MAG_LIM", "%lf", 0, &MAG_LIM); 29 30 DefConfig ("MAG_MIN", "%lf", 15.0, MAG_MIN); 31 DefConfig ("STAR_MAX_PSF_KRON", "%lf", 0.2, STAR_MAX_PSF_KRON); 32 DefConfig ("PSF_QF_MIN", "%lf", 0.95, PSF_QF_MIN); 27 33 28 34 DefConfig ("STAR_SCATTER", "%lf", 0.1, STAR_SCATTER); -
trunk/Ohana/src/relphot/src/ImageOps.c
r41664 r42821 531 531 532 532 // until the analysis has converged a bit, do not use the IRLS analysis 533 // default is MaxIterations = 10 534 if (UseStandardOLS(ZPT_IMAGES)) { 533 // default is MaxIterations = 10. 534 535 // However, for stack and warp calibration, we are not iteratively solving for the 536 // zero points. In this case, use IRLS in a single pass 537 if (!CALIBRATE_STACKS_AND_WARPS && UseStandardOLS(ZPT_IMAGES)) { 535 538 brightStars.MaxIterations = 0; 536 539 kronStars.MaxIterations = 0; … … 672 675 673 676 if ((image[i].imageID == TEST_IMAGE1) || (image[i].imageID == TEST_IMAGE2)) { 674 fprintf (stderr, "%1d, %3d : %3d, %3d : %10.6f %10.6f : %6.3f %6.3f %6.3f %6.3f %6.3f : %6.3f\n", (int) i, (int) j, (int) c, (int) m, catalog[c].averageT[n].R, catalog[c].averageT[n].D, MsysKron, MrelKron, Mmos, Mgrid, Mflat, kronStars.alldata->yVector[Nkron]);677 fprintf (stderr, "%1d, %3d : %3d, %3d : %10.6f %10.6f : %6.3f %6.3f | %6.3f %6.3f | %6.3f %6.3f %6.3f %6.3f | %5.3f\n", (int) i, (int) j, (int) c, (int) m, catalog[c].averageT[n].R, catalog[c].averageT[n].D, MsysPSF, MrelPSF, MsysKron, MrelKron, Mmos, Mgrid, Mflat, Moff, psfStars.alldata->dyVector[Nref]); 675 678 } 676 679 … … 702 705 if (mark) continue; 703 706 704 // use liststats to find the 20-pct, median, 80-pct points 705 StatType stats; 706 liststats_setmode (&stats, "MEDIAN"); 707 liststats (psfStars.alldata->yVector, NULL, NULL, Nref, &stats); 708 double altSigma = (stats.Upper80 - stats.Lower20) / 1.6; // 20% to 80% encompasses 60% of the values, corresponds to the range (-0.85 sigma : +0.85 sigma) 709 710 // soften the individual errors with 10% of the scatter above 711 for (j = 0; j < Nref; j++) { 712 double newSigma = hypot(psfStars.alldata->dyVector[j], 0.1*altSigma); 713 psfStars.alldata->dyVector[j] = newSigma; 714 } 715 716 // soften the errors based on the scatter 707 // soften the errors based on the core scatter 717 708 FitDataSetSoften (&psfStars, Nref); 718 709 -
trunk/Ohana/src/relphot/src/StarOps.c
r41647 r42821 34 34 } 35 35 36 // 36 // Nsecfilt is a property of the photcode table. we only need to retrieve it once. 37 static int Nsecfilt = -1; 38 39 // return the average photometry for this measurement 37 40 float getMrel (Catalog *catalog, off_t meas, int cat, dvoMagClassType class, dvoMagSourceType source) { 38 41 … … 41 44 42 45 int ecode = GetPhotcodeEquivCodebyCode (photcode); 46 if (USE_REF_EQUIV) { 47 // tie this photometry to an alternative refernce 48 // (e.g., tie UDR4.i to PV3.i) 49 int refcode = GetPhotcodeEquivCodebyCode (ecode); 50 if (refcode < 0) return NAN; 51 ecode = refcode; 52 } 53 43 54 int Nsec = GetPhotcodeNsec(ecode); 44 int Nsecfilt = GetPhotcodeNsecfilt (); 55 if (Nsec < 0) return NAN; 56 57 if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); } 45 58 46 59 int entry = Nsecfilt*ave+Nsec; … … 312 325 } 313 326 314 i nt Nsecfilt = GetPhotcodeNsecfilt ();327 if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); } 315 328 316 329 SetMrelInfo summary, results; … … 334 347 int i; 335 348 336 i nt Nsecfilt = GetPhotcodeNsecfilt ();349 if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); } 337 350 338 351 SetMrelInfo summary, results; … … 424 437 ThreadInfo *threadinfo = data; 425 438 426 i nt Nsecfilt = GetPhotcodeNsecfilt ();439 if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); } 427 440 428 441 SetMrelInfo results; … … 451 464 off_t k; 452 465 453 i nt Nsecfilt = GetPhotcodeNsecfilt ();466 if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); } 454 467 455 468 off_t m = average[0].measureOffset; … … 559 572 off_t j; 560 573 561 i nt Nsecfilt = GetPhotcodeNsecfilt ();574 if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); } 562 575 563 576 for (i = 0; i < Ncatalog; i++) { … … 601 614 ALLOCATE (slist, double, Ntot); 602 615 603 i nt Nsecfilt = GetPhotcodeNsecfilt ();616 if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); } 604 617 605 618 // eliminate bad stars using the stats for a single secfilt at a time … … 666 679 // N1 = N2 = N3 = N4 = N0 = 0; 667 680 668 i nt Nsecfilt = GetPhotcodeNsecfilt ();681 if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); } 669 682 670 683 Ntot = 0; … … 719 732 StatType stats; 720 733 721 i nt Nsecfilt = GetPhotcodeNsecfilt ();734 if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); } 722 735 723 736 Ntot = 0; … … 760 773 StatType stats; 761 774 762 i nt Nsecfilt = GetPhotcodeNsecfilt ();775 if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); } 763 776 764 777 Ntot = 0; … … 805 818 ALLOCATE (Mlist, double, NBIN); 806 819 807 i nt Nsecfilt = GetPhotcodeNsecfilt ();820 if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); } 808 821 809 822 int Ns; … … 840 853 Graphdata graphdata; 841 854 842 i nt Nsecfilt = GetPhotcodeNsecfilt ();855 if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); } 843 856 844 857 Ntotal = 0; … … 911 924 return; 912 925 913 i nt Nsecfilt = GetPhotcodeNsecfilt ();926 if (Nsecfilt < 0) { Nsecfilt = GetPhotcodeNsecfilt (); } 914 927 915 928 FILE *fout = NULL; -
trunk/Ohana/src/relphot/src/args.c
r42389 r42821 237 237 } 238 238 239 USE_REF_EQUIV = FALSE; 240 if ((N = get_argument (argc, argv, "-use-ref-equiv"))) { 241 remove_argument (N, &argc, argv); 242 USE_REF_EQUIV = TRUE; 243 } 239 244 PRESERVE_PS1 = FALSE; 240 245 if ((N = get_argument (argc, argv, "-preserve-ps1"))) { … … 521 526 remove_argument (N, &argc, argv); 522 527 USE_REFERENCE_WEIGHT = TRUE; 528 } 529 530 /* Normally, stacks and warps are treated differently from chips. In this case, 531 WHAT IS DIFFERENT? 532 */ 533 534 CALIBRATE_WARPS_LIKE_CHIPS = FALSE; 535 if ((N = get_argument (argc, argv, "-calibrate-warps-like-chips"))) { 536 remove_argument (N, &argc, argv); 537 CALIBRATE_WARPS_LIKE_CHIPS = TRUE; 538 } 539 CALIBRATE_STACKS_LIKE_CHIPS = FALSE; 540 if ((N = get_argument (argc, argv, "-calibrate-stacks-like-chips"))) { 541 remove_argument (N, &argc, argv); 542 CALIBRATE_STACKS_LIKE_CHIPS = TRUE; 523 543 } 524 544 … … 836 856 } 837 857 858 USE_REF_EQUIV = FALSE; 859 if ((N = get_argument (argc, argv, "-use-ref-equiv"))) { 860 remove_argument (N, &argc, argv); 861 USE_REF_EQUIV = TRUE; 862 } 838 863 PRESERVE_PS1 = FALSE; 839 864 if ((N = get_argument (argc, argv, "-preserve-ps1"))) { … … 978 1003 } 979 1004 1005 CALIBRATE_WARPS_LIKE_CHIPS = FALSE; 1006 if ((N = get_argument (argc, argv, "-calibrate-warps-like-chips"))) { 1007 remove_argument (N, &argc, argv); 1008 CALIBRATE_WARPS_LIKE_CHIPS = TRUE; 1009 } 1010 CALIBRATE_STACKS_LIKE_CHIPS = FALSE; 1011 if ((N = get_argument (argc, argv, "-calibrate-stacks-like-chips"))) { 1012 remove_argument (N, &argc, argv); 1013 CALIBRATE_STACKS_LIKE_CHIPS = TRUE; 1014 } 1015 980 1016 STAGES = STAGE_CHIP | STAGE_WARP | STAGE_STACK; 981 1017 if ((N = get_argument (argc, argv, "-skip-chip"))) { -
trunk/Ohana/src/relphot/src/bcatalog.c
r42389 r42821 1 1 # include "relphot.h" 2 3 # define BAD_COUNT(FIELD) \ 4 badCount.FIELD ++; \ 5 if (doTest1 && (catalog[0].measure[offset].imageID == TEST_IMAGE1)) { badTest1.FIELD ++; } \ 6 if (doTest2 && (catalog[0].measure[offset].imageID == TEST_IMAGE2)) { badTest2.FIELD ++; } 7 8 typedef struct { 9 int Ncode; 10 int Ntime; 11 int Ndophot; 12 int Nmag; 13 int Nsigma; 14 int Nimag; 15 int Nfew; 16 int Ngalaxy; 17 int Npsfqf; 18 int Nnan; 19 int Nbad; 20 int Npoor; 21 } MyBadCountType; 2 22 3 23 int LimitDensityCatalog_ByNmeasure (Catalog *subcatalog, Catalog *oldcatalog); … … 9 29 off_t NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm; 10 30 float mag; 11 int Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew, Ngalaxy, Npsfqf, Nnan, Nbad, Npoor; 31 32 // int Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew, Ngalaxy, Npsfqf, Nnan, Nbad, Npoor; 12 33 13 34 int Nsecfilt = GetPhotcodeNsecfilt (); … … 26 47 int NmMin = catalog[0].Nmeasure; 27 48 28 Ncode = Ntime = Ndophot = Nmag = Nsigma = Nimag = Nfew = Npsfqf = Ngalaxy = Nnan = Nbad = Npoor = 0; 49 MyBadCountType badCount = {0,0,0, 0,0,0, 0,0,0, 0,0,0}; 50 MyBadCountType badTest1 = {0,0,0, 0,0,0, 0,0,0, 0,0,0}; 51 MyBadCountType badTest2 = {0,0,0, 0,0,0, 0,0,0, 0,0,0}; 52 53 int doTest1 = (TEST_IMAGE1 >= 0); 54 int doTest2 = (TEST_IMAGE2 >= 0); 55 56 FILE *ftest1 = (doTest1) ? fopen ("test1.meas.dat", "a") : NULL; 57 FILE *ftest2 = (doTest2) ? fopen ("test2.meas.dat", "a") : NULL; 58 59 // Ncode = Ntime = Ndophot = Nmag = Nsigma = Nimag = Nfew = Npsfqf = Ngalaxy = Nnan = Nbad = Npoor = 0; 29 60 30 61 // copy the following fields to the subcatalog: … … 57 88 58 89 offset = catalog[0].average[i].measureOffset + j; 90 91 if (doTest1) { 92 Measure *m = &catalog[0].measure[offset]; 93 if (m->imageID == TEST_IMAGE1) { 94 fprintf (ftest1, "%5d %5d %5d | %5d %12d %5.3f %5.3f %5.3f %5.3f %4.3f %4.3f 0x%08x\n", m->detID, m->objID, m->catID, m->photcode, m->t, m->M, m->Map, m->Mkron, m->dM, m->psfQF, m->psfQFperf, m->photFlags); 95 } 96 } 97 if (doTest2) { 98 Measure *m = &catalog[0].measure[offset]; 99 if (m->imageID == TEST_IMAGE2) { 100 fprintf (ftest2, "%5d %5d %5d | %5d %12d %5.3f %5.3f %5.3f %5.3f %4.3f %4.3f 0x%08x\n", m->detID, m->objID, m->catID, m->photcode, m->t, m->M, m->Map, m->Mkron, m->dM, m->psfQF, m->psfQFperf, m->photFlags); 101 } 102 } 59 103 60 104 /* select measurements by photcode */ … … 69 113 } 70 114 if (!found) { 71 Ncode ++;115 BAD_COUNT(Ncode); 72 116 continue; 73 117 } … … 75 119 /* select measurements by time */ 76 120 if (TimeSelect) { 77 if (catalog[0].measure[offset].t < TSTART) { Ntime ++; continue; }78 if (catalog[0].measure[offset].t > TSTOP) { Ntime ++; continue; }121 if (catalog[0].measure[offset].t < TSTART) { BAD_COUNT(Ntime); continue; } 122 if (catalog[0].measure[offset].t > TSTOP) { BAD_COUNT(Ntime); continue; } 79 123 } 80 124 81 125 /* select measurements by quality */ 82 if (DophotSelect && ((catalog[0].measure[offset].photFlags >> 16) != DophotValue)) { Ndophot ++; continue; }126 if (DophotSelect && ((catalog[0].measure[offset].photFlags >> 16) != DophotValue)) { BAD_COUNT(Ndophot); continue; } 83 127 84 128 float Maper = USE_APER_FOR_STARGAL ? catalog[0].measure[offset].Map : catalog[0].measure[offset].Mkron; 85 129 86 130 // skip garbage measurements 87 if (isnan(catalog[0].measure[offset].psfQF) || (catalog[0].measure[offset].psfQF < 0.95)) { Npsfqf ++; continue; }88 if (isnan(catalog[0].measure[offset].psfQFperf) || (catalog[0].measure[offset].psfQFperf < 0.95)) { Npsfqf ++; continue; }89 if (isnan(catalog[0].measure[offset].M)) { Nnan ++; continue; }90 if (isnan(Maper)) { Nnan ++; continue; }131 if (isnan(catalog[0].measure[offset].psfQF) || (catalog[0].measure[offset].psfQF < PSF_QF_MIN)) { BAD_COUNT(Npsfqf); continue; } 132 if (isnan(catalog[0].measure[offset].psfQFperf) || (catalog[0].measure[offset].psfQFperf < PSF_QF_MIN)) { BAD_COUNT(Npsfqf); continue; } 133 if (isnan(catalog[0].measure[offset].M)) { BAD_COUNT(Nnan); continue; } 134 if (isnan(Maper)) { BAD_COUNT(Nnan); continue; } 91 135 92 136 // require 0x01 in photFlags (fitted with a PSF) -- add to the test data 93 if (REQUIRE_PSFFIT && (catalog[0].measure[offset].photFlags & 0x01) == 0) { Nbad ++; continue; }137 if (REQUIRE_PSFFIT && (catalog[0].measure[offset].photFlags & 0x01) == 0) { BAD_COUNT(Nbad); continue; } 94 138 95 139 // very loose cut on PSF - APER mag (Map or Mkron) -- this lightly rejects galaxies & other oddities 96 140 float Mkp = catalog[0].measure[offset].M - Maper; 97 if (fabs(Mkp) > 1.0) { Nbad ++; continue; }141 if (fabs(Mkp) > 1.0) { BAD_COUNT(Nbad); continue; } 98 142 99 143 if (catalog[0].measure[offset].photFlags & code->photomBadMask) { 100 Nbad++;144 BAD_COUNT(Nbad); 101 145 continue; 102 146 } 103 if (catalog[0].measure[offset].photFlags & code->photomPoorMask) { Npoor++; continue;}147 if (catalog[0].measure[offset].photFlags & code->photomPoorMask) { BAD_COUNT(Npoor); continue;} 104 148 105 149 // weak test for galaxies 106 if (Mkp > 0.5) {150 if (Mkp > STAR_MAX_PSF_KRON) { 107 151 nEXT ++; 108 152 } else { … … 112 156 /* select measurements by mag limit */ 113 157 mag = PhotCat (&catalog[0].measure[offset], MAG_CLASS_PSF); 114 if (mag > MAG_LIM) { Nmag ++; continue; } 158 if (mag > MAG_LIM) { BAD_COUNT(Nmag); continue; } 159 if (mag < MAG_MIN) { BAD_COUNT(Nmag); continue; } 160 // note that these two cuts are applied to all photcodes. these are also applied to 161 // the nominal apparent mags : if the expected sensitivity is very different between 162 // different filters, or if exposure times have a large range, these cuts may not be 163 // effective (or may exclude too much). 115 164 116 165 /* select measurements by measurement error */ 117 if ((SIGMA_LIM > 0) && (catalog[0].measure[offset].dM > SIGMA_LIM)) { Nsigma ++; continue; }166 if ((SIGMA_LIM > 0) && (catalog[0].measure[offset].dM > SIGMA_LIM)) { BAD_COUNT(Nsigma); continue; } 118 167 119 168 /* select measurements by mag limit */ 120 169 if (ImagSelect) { 121 170 mag = PhotInst (&catalog[0].measure[offset], MAG_CLASS_PSF); 122 if (mag < ImagMin) { Nimag ++; continue; } 123 if (mag > ImagMax) { Nimag ++; continue; } 124 } 171 if (mag < ImagMin) { BAD_COUNT(Nimag); continue; } 172 if (mag > ImagMax) { BAD_COUNT(Nimag); continue; } 173 } 174 // note that instrumental mag cuts are reasonable for individual exposures using the same 175 // detector, but are probably not appropriate for stacks with a large range of the number 176 // of inputs. 125 177 126 178 // count this measurement as valid for this secfilt entry … … 147 199 if (nEXT >= nPSF) { 148 200 Nmeasure -= Nm; 149 Ngalaxy++;201 badCount.Ngalaxy++; 150 202 continue; 151 203 } … … 157 209 if (Nm <= STAR_TOOFEW) { /* enough measurements total? */ 158 210 Nmeasure -= Nm; 159 Nfew++;211 badCount.Nfew++; 160 212 continue; 161 213 } … … 167 219 if (!anySecfiltGood) { 168 220 Nmeasure -= Nm; 169 Nfew++;221 badCount.Nfew++; 170 222 continue; 171 223 } … … 204 256 subcatalog[0].Naverage, subcatalog[0].Nmeasure, catalog[0].Naverage, catalog[0].Nmeasure, catalog[0].filename, NmMin, NmMax); 205 257 fprintf (stderr, "rejections: %d stars have too few measures:\n %d code, %d time, %d dophot, %d mag, %d sigma, %d imag, %d psfqf, %d Nnan, %d galaxies, %d bad, %d poor\n", 206 Nfew, Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Npsfqf, Nnan, Ngalaxy, Nbad, Npoor); 258 badCount.Nfew, badCount.Ncode, badCount.Ntime, badCount.Ndophot, badCount.Nmag, badCount.Nsigma, badCount.Nimag, badCount.Npsfqf, badCount.Nnan, badCount.Ngalaxy, badCount.Nbad, badCount.Npoor); 259 } 260 261 if (doTest1) { 262 fprintf (stderr, "TEST1 rejections: %d stars have too few measures: %d code, %d time, %d dophot, %d mag, %d sigma, %d imag, %d psfqf, %d Nnan, %d galaxies, %d bad, %d poor\n", 263 badTest1.Nfew, badTest1.Ncode, badTest1.Ntime, badTest1.Ndophot, badTest1.Nmag, badTest1.Nsigma, badTest1.Nimag, badTest1.Npsfqf, badTest1.Nnan, badTest1.Ngalaxy, badTest1.Nbad, badTest1.Npoor); 264 } 265 if (doTest2) { 266 fprintf (stderr, "TEST2 rejections: %d stars have too few measures: %d code, %d time, %d dophot, %d mag, %d sigma, %d imag, %d psfqf, %d Nnan, %d galaxies, %d bad, %d poor\n", 267 badTest2.Nfew, badTest2.Ncode, badTest2.Ntime, badTest2.Ndophot, badTest2.Nmag, badTest2.Nsigma, badTest2.Nimag, badTest2.Npsfqf, badTest2.Nnan, badTest2.Ngalaxy, badTest2.Nbad, badTest2.Npoor); 207 268 } 208 269 … … 212 273 } 213 274 214 free (Nvalid) 275 free (Nvalid); 276 277 if (ftest1) { fclose (ftest1); } 278 if (ftest2) { fclose (ftest2); } 215 279 216 280 return (TRUE); -
trunk/Ohana/src/relphot/src/extra.c
r41647 r42821 70 70 } 71 71 72 // for now (20140710) I need to identify gpc1 stacks explicitly. generalize in the future72 // for now (20140710) I need to identify gpc1 & gpc2 stacks explicitly. generalize in the future 73 73 int isGPC1stack (int photcode) { 74 74 75 if ((photcode == 11000) || (photcode == 14100)) return TRUE; // g-band 76 if ((photcode == 11100) || (photcode == 14200)) return TRUE; // r-band 77 if ((photcode == 11200) || (photcode == 14300)) return TRUE; // i-band 78 if ((photcode == 11300) || (photcode == 14400)) return TRUE; // z-band 79 if ((photcode == 11400) || (photcode == 14500)) return TRUE; // y-band 80 if ((photcode == 11500) || (photcode == 14600)) return TRUE; // w-band 75 // 11000 : GPC1.g.SkyChip 76 // 11001 : VARIOUS.g.SkyChip (output of xcamera stacks) 77 // 14100 : SIMTEST.g.SkyChip 78 // 31000 : GPC2.g.SkyChip 79 80 if (CALIBRATE_STACKS_LIKE_CHIPS) return FALSE; 81 82 if ((photcode == 11000) || (photcode == 11001) || (photcode == 14100) || (photcode == 31000)) return TRUE; // g-band 83 if ((photcode == 11100) || (photcode == 11101) || (photcode == 14200) || (photcode == 31100)) return TRUE; // r-band 84 if ((photcode == 11200) || (photcode == 11201) || (photcode == 14300) || (photcode == 31200)) return TRUE; // i-band 85 if ((photcode == 11300) || (photcode == 11301) || (photcode == 14400) || (photcode == 31300)) return TRUE; // z-band 86 if ((photcode == 11400) || (photcode == 11401) || (photcode == 14500) || (photcode == 31400)) return TRUE; // y-band 87 if ((photcode == 11500) || (photcode == 11501) || (photcode == 14600) || (photcode == 31500)) return TRUE; // w-band 81 88 82 89 return FALSE; … … 85 92 // for now (20140710) I need to identify gpc1 stacks explicitly. generalize in the future 86 93 int isGPC1warp (int photcode) { 94 95 if (CALIBRATE_WARPS_LIKE_CHIPS) return FALSE; 96 97 // 11000 : GPC1.g.SkyChip 98 // 14100 : SIMTEST.g.SkyChip 99 100 // 12000 : GPC1.g.ForcedWarp 101 // 15100 : SIMTEST.g.ForcedWarp 102 // 32000 : GPC2.g.ForcedWarp 87 103 88 104 // diff warps get stack-like photcodes (kind of lame) … … 97 113 } 98 114 99 if ((photcode == 12000) || (photcode == 15100) ) return TRUE; // g-band100 if ((photcode == 12100) || (photcode == 15200) ) return TRUE; // r-band101 if ((photcode == 12200) || (photcode == 15300) ) return TRUE; // i-band102 if ((photcode == 12300) || (photcode == 15400) ) return TRUE; // z-band103 if ((photcode == 12400) || (photcode == 15500) ) return TRUE; // y-band104 if ((photcode == 12500) || (photcode == 15600) ) return TRUE; // w-band115 if ((photcode == 12000) || (photcode == 15100) || (photcode == 32000)) return TRUE; // g-band 116 if ((photcode == 12100) || (photcode == 15200) || (photcode == 32100)) return TRUE; // r-band 117 if ((photcode == 12200) || (photcode == 15300) || (photcode == 32200)) return TRUE; // i-band 118 if ((photcode == 12300) || (photcode == 15400) || (photcode == 32300)) return TRUE; // z-band 119 if ((photcode == 12400) || (photcode == 15500) || (photcode == 32400)) return TRUE; // y-band 120 if ((photcode == 12500) || (photcode == 15600) || (photcode == 32500)) return TRUE; // w-band 105 121 106 122 return FALSE; -
trunk/Ohana/src/relphot/src/fit1d_irls.c
r41557 r42821 374 374 StatType stats; 375 375 liststats_setmode (&stats, "MEDIAN"); 376 liststats (dataset->alldata->yVector, NULL, NULL, Nvalues, &stats); 376 liststats (dataset->alldata->yVector, dataset->alldata->dyVector, NULL, Nvalues, &stats); 377 // liststats sorts yVector and dyVector together 377 378 378 379 double altSigma = (stats.Upper80 - stats.Lower20) / 1.6; // 20% to 80% encompasses 60% of the values, corresponds to the range (-0.85 sigma : +0.85 sigma) … … 380 381 // soften the individual errors with 10% of the scatter above 381 382 for (int j = 0; j < Nvalues; j++) { 382 double newSigma = hypot(dataset->alldata->dyVector[j], 0. 1*altSigma);383 double newSigma = hypot(dataset->alldata->dyVector[j], 0.5*altSigma); 383 384 dataset->alldata->dyVector[j] = newSigma; 384 385 } -
trunk/Ohana/src/relphot/src/initialize.c
r42134 r42821 50 50 fprintf (stderr, "DophotSelect: FALSE\n"); 51 51 } 52 fprintf (stderr, "PSF_QF limit: 0.85 (hardwired)\n");52 fprintf (stderr, "PSF_QF limit: %f\n", PSF_QF_MIN); 53 53 54 54 // fprintf (stderr, "Photom Bad Mask: 0x%08x, Photom Poor Mask: 0x%08x\n"); 55 55 56 fprintf (stderr, "MAG_ LIM: %f, SIGMA_LIM: %f\n", MAG_LIM, SIGMA_LIM);56 fprintf (stderr, "MAG_MIN: %f, MAG_LIM: %f, SIGMA_LIM: %f\n", MAG_MIN, MAG_LIM, SIGMA_LIM); 57 57 fprintf (stderr, "INST_MAG_MIN: %f, INST_MAG_MAX: %f\n", ImagMin, ImagMax); 58 58 59 fprintf (stderr, "STAR_MAX_PSF_KRON: %f\n", STAR_MAX_PSF_KRON); 59 60 fprintf (stderr, "STAR_TOOFEW: %d\n", STAR_TOOFEW); 60 61 -
trunk/Ohana/src/relphot/src/load_catalogs.c
r41647 r42821 151 151 // TimeSelect -time 152 152 // DophotSelect 153 // (note that psfQF is applied rigidly at 0.85, as is the galaxy test) 153 // PSF_QF_MIN 154 // STAR_MAX_PSF_KRON 155 // MAG_MIN 154 156 // MAG_LIM 155 157 // SIGMA_LIM … … 158 160 159 161 char *command = NULL; 160 strextend (&command, "relphot_client %s -load %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -D CAMERA %s -D MAG_LIM %f -D SIGMA_LIM %f", 161 PhotcodeList, table->hosts[i].results, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, CAMERA, MAG_LIM, SIGMA_LIM); 162 strextend (&command, "relphot_client %s -load %s -hostID %d -D CATDIR %s -hostdir %s", PhotcodeList, table->hosts[i].results, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname); 163 strextend (&command, "-region %f %f %f %f -D CAMERA %s", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, CAMERA); 164 strextend (&command, "-D MAG_MIN %f -D MAG_LIM %f -D SIGMA_LIM %f", MAG_MIN, MAG_LIM, SIGMA_LIM); 165 strextend (&command, "-D STAR_MAX_PSF_KRON %f -D PSF_QF_MIN %f", STAR_MAX_PSF_KRON, PSF_QF_MIN); 162 166 163 167 if (VERBOSE) { strextend (&command, "-v"); } -
trunk/Ohana/src/relphot/src/reload_catalogs.c
r42112 r42821 251 251 if (!(STAGES & STAGE_WARP)) { strextend (&command, "-skip-warp"); } 252 252 if (!(STAGES & STAGE_STACK)) { strextend (&command, "-skip-stack"); } 253 if (CALIBRATE_WARPS_LIKE_CHIPS) { strextend (&command, "-calibrate-warps-like-chips"); } 254 if (CALIBRATE_STACKS_LIKE_CHIPS) { strextend (&command, "-calibrate-stacks-like-chips"); } 253 255 254 256 // deprecate -
trunk/Ohana/src/relphot/src/relphot.c
r42483 r42821 33 33 34 34 switch (mode) { 35 case UPDATE_IMAGES: 35 case UPDATE_IMAGES: // -images 36 36 // calculate zero points for images (may group by exposure [mosaic], night [tgroups]; may measure flat-correction) 37 // IF CALLED WITH NLOOP == 0, DOES NOT LOAD bcatalog, just loads image table and generates ImageSubset.dat 37 // IF CALLED WITH NLOOP == 0 (and NOT -only-stacks-and-warps), this step DOES NOT LOAD bcatalog. Instead it just loads 38 // the image table and applies the Mcal values to the measurements. In parallel context, it generates ImageSubset.dat. 38 39 // If called with -update, calls reload_catalogs() just like apply_offsets, UNLESS -only-stacks-and-warps is selected 39 40 relphot_images (skylist); -
trunk/Ohana/src/tools/src/mpcorb_predict.c
r42389 r42821 51 51 PlanetDatum mpcorb_predict (Planets *planet, double mjdObs, int FullCalc); 52 52 53 Planets *mpcorb_read_text (char *filename, int *nplanets );53 Planets *mpcorb_read_text (char *filename, int *nplanets, int noHeader); 54 54 Planets *mpcorb_read_fits (char *filename, int *nplanets); 55 55 void mpcorb_save_fits (char *filename, Planets *planets, int Nplanets); … … 73 73 74 74 int main (int argc, char **argv) { 75 76 if (get_argument (argc, argv, "-h")) goto usage; 77 if (get_argument (argc, argv, "--help")) goto usage; 75 78 76 79 // XXX test … … 84 87 // load the planets 85 88 int Nplanets = 0; 86 Planets *planets = mpcorb_read_text (filename, &Nplanets );89 Planets *planets = mpcorb_read_text (filename, &Nplanets, FALSE); 87 90 for (int i = 0; i < 10; i++) { 88 91 // if it is in the region, use the more accurate calculation … … 92 95 } 93 96 94 if ((argc != 9) && (argc != 10)) goto usage; 95 97 if (argc < 2) goto usage; 96 98 if (!strcasecmp (argv[1], "trange")) mpcorb_trange (argc, argv); 97 99 if (!strcasecmp (argv[1], "moment")) mpcorb_moment (argc, argv); … … 99 101 usage: 100 102 fprintf (stderr, "USAGE: %s trange (MPCORB.DAT) (Tmin) (Tmax) (Rmin) (Rmax) (Dmin) (Dmax) (range.fits)\n", argv[0]); 101 fprintf (stderr, "USAGE: %s moment (range.fits) (Tobs) (Rmin) (Rmax) (Dmin) (Dmax) (output)\n ", argv[0]);103 fprintf (stderr, "USAGE: %s moment (range.fits) (Tobs) (Rmin) (Rmax) (Dmin) (Dmax) (output)\n\n", argv[0]); 102 104 103 105 fprintf (stderr, " trange : generate a table of asteroid orbital elements which fall within the region at Tmin or Tmax (in MJD)\n"); 104 fprintf (stderr, " moment : generate a table of asteroid positions which fall within the region at Tobs (in MJD)\n"); 105 106 fprintf (stderr, " moment : generate a table of asteroid positions which fall within the region at Tobs (in MJD)\n\n"); 107 108 fprintf (stderr, " Tmin, Tmax, Tobs are in MJD; Rmin, Rmax, Dmin, Dmax are in decimal degrees\n"); 109 fprintf (stderr, " Orbital predictions are valid for the PS1 site\n"); 110 111 fprintf (stderr, " trange options:\n"); 112 fprintf (stderr, " -no-header (for files other than MPCORB.DAT)\n"); 113 fprintf (stderr, " -min-obs (Nobs) : minimum number of observations to keep object\n"); 114 fprintf (stderr, " -min-opp (Nopp) : minimum number of oppositions to keep object\n"); 106 115 exit (2); 107 116 } … … 110 119 void mpcorb_trange (int argc, char **argv) { 111 120 112 if (argc != 10) Shutdown ("USAGE: %s trange (MPCORB.DAT) (Tmin) (Tmax) (Rmin) (Rmax) (Dmin) (Dmax) (range.fits)\n", argv[0]); 121 int N; 122 123 int noHeader = FALSE; 124 if ((N = get_argument (argc, argv, "-no-header"))) { 125 remove_argument (N, &argc, argv); 126 noHeader = TRUE; 127 } 128 int MIN_OBS = 0; 129 if ((N = get_argument (argc, argv, "-min-obs"))) { 130 remove_argument (N, &argc, argv); 131 MIN_OBS = atoi(argv[N]); 132 remove_argument (N, &argc, argv); 133 } 134 int MIN_OPP = 0; 135 if ((N = get_argument (argc, argv, "-min-opp"))) { 136 remove_argument (N, &argc, argv); 137 MIN_OPP = atoi(argv[N]); 138 remove_argument (N, &argc, argv); 139 } 140 141 if (argc != 10) Shutdown ("USAGE: %s trange (MPCORB.DAT) (Tmin) (Tmax) (Rmin) (Rmax) (Dmin) (Dmax) (range.fits) [-no-header] [-min-obs] [-min-opp]\n", argv[0]); 113 142 114 143 char *filename = argv[2]; … … 122 151 123 152 int Nplanets = 0; 124 Planets *planets = mpcorb_read_text (filename, &Nplanets );153 Planets *planets = mpcorb_read_text (filename, &Nplanets, noHeader); 125 154 if (VERBOSE) fprintf (stderr, "loaded %d planets\n", Nplanets); 126 155 … … 133 162 if (i % 1000 == 0) fprintf (stderr, "."); 134 163 135 // XXX make these quality cuts user options 136 if (SKIP_BAD && ((planets[i].Nobs < 20) || (planets[i].Nopp < 2))) continue; 164 // skip poor-quality observations 165 if (planets[i].Nobs < MIN_OBS) continue; 166 if (planets[i].Nopp < MIN_OPP) continue; 137 167 138 168 // is the object in the region for the start of the period? … … 804 834 805 835 // read the full MPCORB file, storing desired information in Planets structure 806 Planets *mpcorb_read_text (char *filename, int *nplanets ) {836 Planets *mpcorb_read_text (char *filename, int *nplanets, int noHeader) { 807 837 808 838 ALLOCATE_PTR (buffer, char, NBYTE); … … 838 868 839 869 Nline ++; 840 if ((Nline > 43) && (q - p > 5)) { 870 int doParse = (noHeader || (Nline > 43)); 871 if (doParse && (q - p > 5)) { 841 872 mpcorb_parseline (p, &planets[Nplanets], Nbyte - offset); 873 if ((Nplanets < 10) && DEBUG) fprintf (stderr, "object: %s", planets[Nplanets].ID); 842 874 Nplanets ++; 843 875 CHECK_REALLOCATE (planets, Planets, NPLANETS, Nplanets, 10000);
Note:
See TracChangeset
for help on using the changeset viewer.
