Changeset 38655
- Timestamp:
- Aug 1, 2015, 10:57:47 AM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150625/Ohana/src/relastro
- Files:
-
- 9 edited
-
include/relastro.h (modified) (3 diffs)
-
src/FitPM.c (modified) (1 diff)
-
src/FitPMandPar.c (modified) (1 diff)
-
src/UpdateObjectOffsets.c (modified) (1 diff)
-
src/UpdateObjects.c (modified) (13 diffs)
-
src/args.c (modified) (2 diffs)
-
src/high_speed_catalogs.c (modified) (1 diff)
-
src/hpm_catalogs.c (modified) (1 diff)
-
src/relastro_objects.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150625/Ohana/src/relastro/include/relastro.h
r38612 r38655 294 294 int CHIPORDER; 295 295 int CHIPMAP; 296 297 int N_BOOTSTRAP_SAMPLES; 296 298 297 299 int MaxDensityUse; … … 710 712 int CatalogMaxNmeasure (Catalog *catalog, int Ncatalog); 711 713 int FitAstromPoints_Project (FitStats *fitStats, double *Tmean, double *Trange, double *parRange); 712 int UpdateObjects_SelectMeasures (FitStats *fit, Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int cat, off_t measOff, intisStack);714 int UpdateObjects_SelectMeasures (FitStats *fit, Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int isStack); 713 715 int UpdateObjects_Stack (Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int Nsecfilt, FitStats *fitStats); 714 716 int UpdateObjects_Chips (Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int Nsecfilt, FitStats *fitStats, int cat, off_t measOff); … … 722 724 void FitStatsReset (FitStats *tgt); 723 725 FitStats *FitStatsInit (int Nmax, int Nboot); 726 int FitAstromResultSetPM (FitAstromResult *fit, int Nfit, Average *average); -
branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/FitPM.c
r38604 r38655 1 1 # include "relastro.h" 2 2 3 // initial values of *fit are ignored 3 4 int FitPM (FitAstromResult *fit, FitAstromData *data, FitAstromPoint *points, int Npoints) { 4 5 -
branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/FitPMandPar.c
r38612 r38655 1 1 # include "relastro.h" 2 2 3 // initial values of *fit are ignored 3 4 int FitPMandPar (FitAstromResult *fit, FitAstromData *data, FitAstromPoint *points, int Npoints) { 4 5 -
branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/UpdateObjectOffsets.c
r38471 r38655 185 185 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 186 186 187 if (N_BOOTSTRAP_SAMPLES > 1) strextend (&command, "-bootstrap-samples %d", N_BOOTSTRAP_SAMPLES); 188 187 189 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 188 190 strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); -
branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/UpdateObjects.c
r38612 r38655 1 1 # include "relastro.h" 2 2 # define PAR_TOOFEW 5 3 # define NBOOT 1004 3 5 4 // This function operates on both Measure and MeasureTiny. In the big stages, this should … … 19 18 FitStats *sumStatsStack = FitStatsInit (0, 0); 20 19 21 FitStats *fitStatsChips = FitStatsInit (NmeasureMax, N BOOT);22 FitStats *fitStatsStack = FitStatsInit (NmeasureMax, N BOOT);20 FitStats *fitStatsChips = FitStatsInit (NmeasureMax, N_BOOTSTRAP_SAMPLES); 21 FitStats *fitStatsStack = FitStatsInit (NmeasureMax, N_BOOTSTRAP_SAMPLES); 23 22 24 23 int i; … … 39 38 SecFilt *secfilt = &catalog[i].secfilt[j*Nsecfilt]; 40 39 40 int XVERB = FALSE; 41 XVERB |= (average[0].objID == OBJ_ID_SRC) && (average[0].catID == CAT_ID_SRC); 42 XVERB |= (average[0].objID == OBJ_ID_DST) && (average[0].catID == CAT_ID_DST); 43 if ((OBJ_ID_SRC || OBJ_ID_DST) && !XVERB) continue; 44 41 45 UpdateObjects_Stack(average, secfilt, measure, measureBig, Nsecfilt, fitStatsStack); 42 46 UpdateObjects_Chips(average, secfilt, measure, measureBig, Nsecfilt, fitStatsChips, i, m); … … 90 94 91 95 // select the measurements to be used in this analysis 92 UpdateObjects_SelectMeasures (fitStats, average, secfilt, measure, measureBig, cat, measOff,FALSE);96 UpdateObjects_SelectMeasures (fitStats, average, secfilt, measure, measureBig, FALSE); 93 97 94 98 // if there are no exposure detections, use the stack position … … 123 127 } 124 128 125 // XXX handle the case with only 1 or few points 126 127 fitStats->Nfit = 0; 128 for (k = 0; k < fitStats->NfitAlloc; k++) { 129 BootstrapResample (fitStats->sample, fitStats->points, fitStats->Npoints); 130 if (!FitPM (&fitStats->fit[k], fitStats->fitdataPM, fitStats->sample, fitStats->Npoints)) continue; 131 fitStats->Nfit ++; 132 } 133 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA); 134 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC); 135 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_uR); 136 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_uD); 137 129 if (fitStats->NfitAlloc == 1) { 130 // if N_BOOTSTRAP_SAMPLES = 1, no bootstrap resampling: 131 FitPM (&fitPM, fitStats->fitdataPM, fitStats->points, fitStats->Npoints); 132 } else { 133 fitStats->Nfit = 0; 134 for (k = 0; k < fitStats->NfitAlloc; k++) { 135 BootstrapResample (fitStats->sample, fitStats->points, fitStats->Npoints); 136 if (!FitPM (&fitStats->fit[k], fitStats->fitdataPM, fitStats->sample, fitStats->Npoints)) continue; 137 fitStats->Nfit ++; 138 } 139 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA); 140 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC); 141 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_uR); 142 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_uD); 143 } 138 144 FitAstromSetChisq (&fitPM, fitStats->points, fitStats->Npoints, FIT_PM_ONLY); 139 145 140 146 // project Ro, Do back to RA,DEC 141 147 XY_to_RD (&fitPM.Ro, &fitPM.Do, fitPM.Ro, fitPM.Do, &fitStats->coords); 142 if (XVERB) fprintf (stderr, "project: %f %f : %f %f : %f\n", fitPM.Ro, fitPM.Do, fitPM.uR, fitPM.uD, fitPM.p);143 148 if (fabs(fitPM.Ro) < 0.01) fprintf (stderr, "watch out for 0,360 boundary\n"); 144 // XXX : does this make sense at 0,360 boundary?145 149 146 150 fitPM.p = fitPM.dp = 0.0; … … 168 172 } 169 173 170 fitStats->Nfit = 0; 171 for (k = 0; k < fitStats->NfitAlloc; k++) { 172 BootstrapResample (fitStats->sample, fitStats->points, fitStats->Npoints); 173 FitPMandPar (&fitStats->fit[k], fitStats->fitdataPar, fitStats->sample, fitStats->Npoints); 174 fitStats->Nfit ++; 175 } 176 BootstrapRobustStats (&fitPar, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA); 177 BootstrapRobustStats (&fitPar, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC); 178 BootstrapRobustStats (&fitPar, fitStats->fit, fitStats->Nfit, FIT_RESULT_uR); 179 BootstrapRobustStats (&fitPar, fitStats->fit, fitStats->Nfit, FIT_RESULT_uD); 180 BootstrapRobustStats (&fitPar, fitStats->fit, fitStats->Nfit, FIT_RESULT_PLX); 181 174 if (fitStats->NfitAlloc == 1) { 175 // if N_BOOTSTRAP_SAMPLES = 1, no bootstrap resampling: 176 FitPMandPar (&fitPar, fitStats->fitdataPar, fitStats->points, fitStats->Npoints); 177 } else { 178 fitStats->Nfit = 0; 179 for (k = 0; k < fitStats->NfitAlloc; k++) { 180 BootstrapResample (fitStats->sample, fitStats->points, fitStats->Npoints); 181 FitPMandPar (&fitStats->fit[k], fitStats->fitdataPar, fitStats->sample, fitStats->Npoints); 182 fitStats->Nfit ++; 183 } 184 BootstrapRobustStats (&fitPar, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA); 185 BootstrapRobustStats (&fitPar, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC); 186 BootstrapRobustStats (&fitPar, fitStats->fit, fitStats->Nfit, FIT_RESULT_uR); 187 BootstrapRobustStats (&fitPar, fitStats->fit, fitStats->Nfit, FIT_RESULT_uD); 188 BootstrapRobustStats (&fitPar, fitStats->fit, fitStats->Nfit, FIT_RESULT_PLX); 189 } 182 190 FitAstromSetChisq (&fitPar, fitStats->points, fitStats->Npoints, FIT_PM_AND_PAR); 183 191 192 // project Ro, Do back to RA,DEC 184 193 XY_to_RD (&fitPar.Ro, &fitPar.Do, fitPar.Ro, fitPar.Do, &fitStats->coords); 194 if (fabs(fitPar.Ro) < 0.01) fprintf (stderr, "watch out for 0,360 boundary\n"); 195 185 196 average[0].flags |= ID_STAR_FIT_PAR; 186 197 fitStats->Npar ++; 187 188 if (fabs(fitPar.Ro) < 0.01) fprintf (stderr, "watch out for 0,360 boundary\n");189 198 190 199 // XXX a hard-wired hack... … … 199 208 // if we only have one point, this is silly... 200 209 201 fitStats->Nfit = 0; 202 for (k = 0; k < fitStats->NfitAlloc; k++) { 203 BootstrapResample (fitStats->sample, fitStats->points, fitStats->Npoints); 204 FitPosPMfixed (&fitStats->fit[k], fitStats->fitdataPos, fitStats->sample, fitStats->Npoints); 205 fitStats->Nfit ++; 206 } 207 BootstrapRobustStats (&fitPos, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA); 208 BootstrapRobustStats (&fitPos, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC); 210 if (fitStats->NfitAlloc == 1) { 211 FitAstromResultSetPM (&fitPos, 1, average); 212 FitPosPMfixed (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints); 213 } else { 214 fitStats->Nfit = 0; 215 FitAstromResultSetPM (fitStats->fit, fitStats->NfitAlloc, average); 216 for (k = 0; k < fitStats->NfitAlloc; k++) { 217 BootstrapResample (fitStats->sample, fitStats->points, fitStats->Npoints); 218 FitPosPMfixed (&fitStats->fit[k], fitStats->fitdataPos, fitStats->sample, fitStats->Npoints); 219 fitStats->Nfit ++; 220 } 221 BootstrapRobustStats (&fitPos, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA); 222 BootstrapRobustStats (&fitPos, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC); 223 } 209 224 FitAstromSetChisq (&fitPos, fitStats->points, fitStats->Npoints, FIT_AVERAGE); 210 225 … … 215 230 } 216 231 217 // XXXupdate the bit flags of which points were used232 // update the bit flags of which points were used 218 233 for (k = 0; k < fitStats->Npoints; k++) { 219 234 int Nm = fitStats->points[k].measure; … … 223 238 } 224 239 225 # if (0) 240 // we can set the star reference-image color only if we have loaded the image data 226 241 int setRefColor = areImagesMatched(); 227 242 if (setRefColor) { 243 float *C_blue = NULL; 244 float *C_red = NULL; 245 ALLOCATE (C_blue, float, fitStats->Npoints); 246 ALLOCATE (C_red, float, fitStats->Npoints); 247 248 int NcBlue = 0; 249 int NcRed = 0; 250 251 for (k = 0; k < fitStats->Npoints; k++) { 252 int Nm = fitStats->points[k].measure; 253 float colorBlue = getColorBlue (measOff + Nm, cat); 254 if (!isnan(colorBlue)) { 255 C_blue[NcBlue] = colorBlue; 256 NcBlue++; 257 } 258 float colorRed = getColorRed (measOff + Nm, cat); 259 if (!isnan(colorRed)) { 260 C_red[NcRed] = colorRed; 261 NcRed++; 262 } 263 } 264 228 265 // need to reassign here if isfinite() 229 266 float colorMedian; 230 dsort (C_blue, NcBlue);267 fsort (C_blue, NcBlue); 231 268 colorMedian = (NcBlue > 0) ? C_blue[(int)(0.5*NcBlue)] : NAN; 232 269 average[0].refColorBlue = colorMedian; 233 dsort (C_red, NcRed);270 fsort (C_red, NcRed); 234 271 colorMedian = (NcRed > 0) ? C_red[(int)(0.5*NcRed)] : NAN; 235 272 average[0].refColorRed = colorMedian; 236 } 237 # endif 273 274 free (C_blue); 275 free (C_red); 276 } 238 277 239 278 /* choose the result based on the chisq values */ … … 362 401 363 402 // select the measurements to be used in this analysis 364 UpdateObjects_SelectMeasures (fitStats, average, secfilt, measure, measureBig, 0, 0,TRUE);403 UpdateObjects_SelectMeasures (fitStats, average, secfilt, measure, measureBig, TRUE); 365 404 366 405 // too few measurements for average position (require 2 values) … … 421 460 } 422 461 423 int UpdateObjects_SelectMeasures (FitStats *fit, Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int cat, off_t measOff, intisStack) {462 int UpdateObjects_SelectMeasures (FitStats *fit, Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int isStack) { 424 463 425 464 // I've already allocated fit->points (and fit->sample) with space for fit->NpointsAlloc entries … … 512 551 513 552 points[Npoints].dT = measure[k].dt; 514 515 // XXX516 int setRefColor = 0;517 if (setRefColor) {518 points[Npoints].C_blue = getColorBlue (measOff+k, cat);519 points[Npoints].C_red = getColorRed (measOff+k, cat);520 }521 553 522 554 points[Npoints].measure = k; … … 720 752 myAbort ("invalid mode"); 721 753 } 754 fit->Nfit = Npoints; 722 755 return (TRUE); 723 756 } 757 758 int FitAstromResultSetPM (FitAstromResult *fit, int Nfit, Average *average) { 759 760 int i; 761 762 if (USE_GALAXY_MODEL) { 763 for (i = 0; i < Nfit; i++) { 764 fit->uR = average->uRgal; 765 fit->uD = average->uDgal; 766 } 767 } else { 768 for (i = 0; i < Nfit; i++) { 769 fit->uR = 0.0; 770 fit->uD = 0.0; 771 } 772 } 773 774 return TRUE; 775 } -
branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/args.c
r38441 r38655 271 271 remove_argument (N, &argc, argv); 272 272 APPLY_OFFSETS = TRUE; 273 } 274 275 N_BOOTSTRAP_SAMPLES = 1; 276 if ((N = get_argument (argc, argv, "-bootstrap-samples"))) { 277 remove_argument (N, &argc, argv); 278 N_BOOTSTRAP_SAMPLES = atoi (argv[N]); 279 remove_argument (N, &argc, argv); 280 if ((N_BOOTSTRAP_SAMPLES < 1) || ((N_BOOTSTRAP_SAMPLES > 1) && (N_BOOTSTRAP_SAMPLES < 20))) { 281 fprintf (stderr, "-bootstrap-samples must be either 1 (no sampling) or >= 20\n"); 282 exit (2); 283 } 273 284 } 274 285 … … 697 708 remove_argument (N, &argc, argv); 698 709 MaxDensityUse = TRUE; 710 } 711 712 N_BOOTSTRAP_SAMPLES = 1; 713 if ((N = get_argument (argc, argv, "-bootstrap-samples"))) { 714 remove_argument (N, &argc, argv); 715 N_BOOTSTRAP_SAMPLES = atoi (argv[N]); 716 remove_argument (N, &argc, argv); 717 if ((N_BOOTSTRAP_SAMPLES < 1) || ((N_BOOTSTRAP_SAMPLES > 1) && (N_BOOTSTRAP_SAMPLES < 20))) { 718 fprintf (stderr, "-bootstrap-samples must be either 1 (no sampling) or >= 20\n"); 719 exit (2); 720 } 699 721 } 700 722 -
branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/high_speed_catalogs.c
r38471 r38655 176 176 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 177 177 178 if (MinBadQF > 0.0) { strextend (&command, "-min-bad-psfqf %f", MinBadQF); } 179 if (MaxMeanOffset != 10.0) { strextend (&command, "-max-mean-offset %f", MaxMeanOffset); } 178 if (MinBadQF > 0.0) strextend (&command, "-min-bad-psfqf %f", MinBadQF); 179 if (MaxMeanOffset != 10.0) strextend (&command, "-max-mean-offset %f", MaxMeanOffset); 180 if (N_BOOTSTRAP_SAMPLES > 1) strextend (&command, "-bootstrap-samples %d", N_BOOTSTRAP_SAMPLES); 180 181 181 182 if (WHERE_A[0]) { strextend (&command, "-D WHERE_A \"%s\"", WHERE_A); } -
branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/hpm_catalogs.c
r38471 r38655 174 174 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 175 175 176 if (MinBadQF > 0.0) { strextend (&command, "-min-bad-psfqf %f", MinBadQF); } 177 if (MaxMeanOffset != 10.0) { strextend (&command, "-max-mean-offset %f", MaxMeanOffset); } 176 if (MinBadQF > 0.0) strextend (&command, "-min-bad-psfqf %f", MinBadQF); 177 if (MaxMeanOffset != 10.0) strextend (&command, "-max-mean-offset %f", MaxMeanOffset); 178 if (N_BOOTSTRAP_SAMPLES > 1) strextend (&command, "-bootstrap-samples %d", N_BOOTSTRAP_SAMPLES); 178 179 179 180 if (TimeSelect) { -
branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/relastro_objects.c
r38471 r38655 172 172 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 173 173 174 if (MinBadQF > 0.0) { strextend (&command, "-min-bad-psfqf %f", MinBadQF); } 175 if (MaxMeanOffset != 10.0) { strextend (&command, "-max-mean-offset %f", MaxMeanOffset); } 174 if (MinBadQF > 0.0) strextend (&command, "-min-bad-psfqf %f", MinBadQF); 175 if (MaxMeanOffset != 10.0) strextend (&command, "-max-mean-offset %f", MaxMeanOffset); 176 if (N_BOOTSTRAP_SAMPLES > 1) strextend (&command, "-bootstrap-samples %d", N_BOOTSTRAP_SAMPLES); 176 177 177 178 if (TimeSelect) {
Note:
See TracChangeset
for help on using the changeset viewer.
