Changeset 15562
- Timestamp:
- Nov 9, 2007, 3:09:20 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 1 deleted
- 69 edited
-
psModules/src/astrom/Makefile.am (modified) (2 diffs)
-
psModules/src/astrom/pmAstrometryTable.c (modified) (4 diffs)
-
psModules/src/astrom/pmAstrometryTable.h (added)
-
psModules/src/camera/pmFPAfile.h (modified) (2 diffs)
-
psModules/src/camera/pmFPAfileDefine.c (modified) (3 diffs)
-
psModules/src/camera/pmFPAfileIO.c (modified) (10 diffs)
-
psModules/src/detrend/pmDetrendDB.c (modified) (1 diff)
-
psModules/src/detrend/pmDetrendDB.h (modified) (2 diffs)
-
psModules/src/imcombine/pmStack.c (modified) (1 diff)
-
psModules/src/imcombine/pmSubtraction.h (modified) (1 diff)
-
psModules/src/objects/Makefile.am (modified) (2 diffs)
-
psModules/src/objects/pmGrowthCurve.h (modified) (2 diffs)
-
psModules/src/objects/pmModel.c (modified) (7 diffs)
-
psModules/src/objects/pmModel.h (modified) (2 diffs)
-
psModules/src/objects/pmModelClass.c (modified) (9 diffs)
-
psModules/src/objects/pmModelClass.h (modified) (2 diffs)
-
psModules/src/objects/pmModelGroup.c (modified) (2 diffs)
-
psModules/src/objects/pmModelGroup.h (modified) (2 diffs)
-
psModules/src/objects/pmModelUtils.c (modified) (4 diffs)
-
psModules/src/objects/pmPSF.c (modified) (13 diffs)
-
psModules/src/objects/pmPSF.h (modified) (2 diffs)
-
psModules/src/objects/pmPSF_IO.c (modified) (15 diffs)
-
psModules/src/objects/pmPSFtry.c (modified) (4 diffs)
-
psModules/src/objects/pmPSFtry.h (modified) (2 diffs)
-
psModules/src/objects/pmPeaks.c (modified) (4 diffs)
-
psModules/src/objects/pmPeaks.h (modified) (2 diffs)
-
psModules/src/objects/pmResiduals.c (modified) (2 diffs)
-
psModules/src/objects/pmResiduals.h (modified) (2 diffs)
-
psModules/src/objects/pmSource.c (modified) (8 diffs)
-
psModules/src/objects/pmSource.h (modified) (6 diffs)
-
psModules/src/objects/pmSourceContour.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceExtendedPars.c (added)
-
psModules/src/objects/pmSourceExtendedPars.h (added)
-
psModules/src/objects/pmSourceFitSet.c (modified) (7 diffs)
-
psModules/src/objects/pmSourceFitSet.h (modified) (2 diffs)
-
psModules/src/objects/pmSourceIO.c (modified) (23 diffs)
-
psModules/src/objects/pmSourceIO.h (modified) (2 diffs)
-
psModules/src/objects/pmSourceIO_CMP.c (modified) (4 diffs)
-
psModules/src/objects/pmSourceIO_OBJ.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceIO_PS1_DEV_0.c (modified) (3 diffs)
-
psModules/src/objects/pmSourceIO_PS1_DEV_1.c (modified) (6 diffs)
-
psModules/src/objects/pmSourceIO_RAW.c (modified) (6 diffs)
-
psModules/src/objects/pmSourceIO_SMPDATA.c (modified) (3 diffs)
-
psModules/src/objects/pmSourceIO_SX.c (modified) (2 diffs)
-
psModules/src/objects/pmSourcePhotometry.c (modified) (14 diffs)
-
psModules/src/objects/pmSourcePlotApResid.c (modified) (3 diffs)
-
psModules/src/objects/pmSourcePlotMoments.c (modified) (2 diffs)
-
psModules/src/objects/pmSourcePlotPSFModel.c (modified) (2 diffs)
-
psModules/src/objects/pmSourcePlots.c (modified) (3 diffs)
-
psModules/src/objects/pmSourcePlots.h (modified) (2 diffs)
-
psModules/src/objects/pmSourceUtils.c (modified) (2 diffs)
-
psModules/src/objects/pmTrend2D.c (modified) (1 diff)
-
psModules/src/objects/pmTrend2D.h (modified) (2 diffs)
-
psastro/src/Makefile.am (modified) (1 diff)
-
psastro/src/psastro.h (modified) (2 diffs)
-
psastro/src/psastroAnalysis.c (modified) (1 diff)
-
psastro/src/psastroArguments.c (modified) (1 diff)
-
psastro/src/psastroDefineFiles.c (modified) (3 diffs)
-
psastro/src/psastroDemoDump.c (modified) (1 diff)
-
psastro/src/psastroEnforceChip.c (deleted)
-
psastro/src/psastroEnforceChips.c (added)
-
psastro/src/psastroLoadRefstars.c (modified) (7 diffs)
-
psastro/src/psastroMosaicAstrom.c (modified) (1 diff)
-
psastro/src/psastroMosaicGradients.c (modified) (2 diffs)
-
psastro/src/psastroMosaicOneChip.c (modified) (1 diff)
-
psastro/src/psastroMosaicSetMatch.c (modified) (1 diff)
-
psphot/src/Makefile.am (modified) (1 diff)
-
psphot/src/psphot.h (modified) (1 diff)
-
psphot/src/psphotAnnuli.c (modified) (1 diff)
-
psphot/src/psphotExtendedSources.c (modified) (1 diff)
-
psphot/src/psphotIsophotal.c (modified) (1 diff)
-
psphot/src/psphotMakeResiduals.c (modified) (3 diffs)
-
psphot/src/psphotPetrosian.c (modified) (1 diff)
-
psphot/src/psphotRadialProfile.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/astrom/Makefile.am
r12519 r15562 8 8 pmAstrometryDistortion.c \ 9 9 pmAstrometryUtils.c \ 10 pmAstrometryTable.c \ 10 11 pmAstrometryWCS.c 11 12 … … 15 16 pmAstrometryDistortion.h \ 16 17 pmAstrometryUtils.h \ 18 pmAstrometryTable.h \ 17 19 pmAstrometryWCS.h 18 20 -
trunk/psModules/src/astrom/pmAstrometryTable.c
r15357 r15562 1 1 /** @file pmAstrometryObjects.c 2 *3 * @brief This file defines the basic types for matching objects4 * based on their astrometry.5 *6 * @ingroup AstroImage7 *8 * @author EAM, IfA9 *10 * @version $Revision: 1.1$ $Name: not supported by cvs2svn $11 * @date $Date: 2007-10-23 20:52:42$12 *13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii14 */2 * 3 * @brief This file defines the basic types for matching objects 4 * based on their astrometry. 5 * 6 * @ingroup AstroImage 7 * 8 * @author EAM, IfA 9 * 10 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-11-10 01:09:20 $ 12 * 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 14 */ 15 15 16 16 #ifdef HAVE_CONFIG_H … … 29 29 #include <pslib.h> 30 30 31 #include "pmConfig.h" 32 #include "pmDetrendDB.h" 31 33 #include "pmHDU.h" 32 34 #include "pmFPA.h" 33 #include "pmAstrometryObjects.h" 35 #include "pmFPALevel.h" 36 #include "pmFPAview.h" 37 #include "pmFPAfile.h" 38 #include "pmAstrometryTable.h" 39 34 40 35 41 /********************* CheckDataStatus functions *****************************/ … … 179 185 bool pmAstromWriteChip (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 180 186 { 181 // define the EXTNAME values used for the table data, and residual image segments 182 { 183 // lookup the EXTNAME values used for table data and image header segments 184 char *rule = NULL; 185 186 // Menu of EXTNAME rules 187 psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "EXTNAME.RULES"); 188 if (!menu) { 189 psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config"); 190 return false; 191 } 192 193 // EXTNAME for image header 194 rule = psMetadataLookupStr(&status, menu, "ASTROMETRY"); 195 if (!rule) { 196 psError(PS_ERR_UNKNOWN, false, "missing entry for ASTROMETRY in EXTNAME.RULES in camera.config"); 197 return false; 198 } 199 extname = pmFPAfileNameFromRule (rule, file, view); 200 } 187 bool status; 188 // *** define the EXTNAME values used for the table data, and residual image segments *** 189 190 // lookup the EXTNAME values used for table data and image header segments 191 char *rule = NULL; 192 193 // Menu of EXTNAME rules 194 psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "EXTNAME.RULES"); 195 if (!menu) { 196 psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config"); 197 return false; 198 } 199 200 // EXTNAME for image header 201 rule = psMetadataLookupStr(&status, menu, "ASTROMETRY"); 202 if (!rule) { 203 psError(PS_ERR_UNKNOWN, false, "missing entry for ASTROMETRY in EXTNAME.RULES in camera.config"); 204 return false; 205 } 206 207 // XXX need to finish this: uncomment when used 208 # if (0) 209 char *extname = pmFPAfileNameFromRule (rule, file, view); 210 # endif 201 211 202 212 // write the chip elements in the following form: … … 244 254 bool pmAstromReadChip (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 245 255 { 246 // define the EXTNAME values used for the table data, and residual image segments 247 { 248 // lookup the EXTNAME values used for table data and image header segments 249 char *rule = NULL; 250 251 // Menu of EXTNAME rules 252 psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "EXTNAME.RULES"); 253 if (!menu) { 254 psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config"); 255 return false; 256 } 257 258 // EXTNAME for image header 259 rule = psMetadataLookupStr(&status, menu, "ASTROMETRY"); 260 if (!rule) { 261 psError(PS_ERR_UNKNOWN, false, "missing entry for ASTROMETRY in EXTNAME.RULES in camera.config"); 262 return false; 263 } 264 extname = pmFPAfileNameFromRule (rule, file, view); 265 } 256 bool status; 257 258 // lookup the EXTNAME values used for table data and image header segments 259 char *rule = NULL; 260 261 // Menu of EXTNAME rules 262 psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "EXTNAME.RULES"); 263 if (!menu) { 264 psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config"); 265 return false; 266 } 267 268 // EXTNAME for image header 269 rule = psMetadataLookupStr(&status, menu, "ASTROMETRY"); 270 if (!rule) { 271 psError(PS_ERR_UNKNOWN, false, "missing entry for ASTROMETRY in EXTNAME.RULES in camera.config"); 272 return false; 273 } 274 275 // XXX finish this: uncomment when used 276 # if (0) 277 char *extname = pmFPAfileNameFromRule (rule, file, view); 278 # endif 266 279 267 280 // read the chip elements in the following form: -
trunk/psModules/src/camera/pmFPAfile.h
r15180 r15562 4 4 * @author EAM, IfA 5 5 * 6 * @version $Revision: 1.2 2$ $Name: not supported by cvs2svn $7 * @date $Date: 2007-1 0-03 21:32:43$6 * @version $Revision: 1.23 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-11-10 01:09:20 $ 8 8 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii 9 9 */ … … 35 35 PM_FPA_FILE_FRINGE, 36 36 PM_FPA_FILE_HEADER, 37 PM_FPA_FILE_ASTROM, 37 38 } pmFPAfileType; 38 39 -
trunk/psModules/src/camera/pmFPAfileDefine.c
r15217 r15562 438 438 return NULL; 439 439 } 440 // EXTWORD (fits->extword) is not relevant to the PHU 440 441 fits = psFitsOpen (realName, "r"); 441 442 if (!fits) { … … 556 557 return NULL; 557 558 } 559 // EXTWORD (fits->extword) is not relevant to the PHU 558 560 fits = psFitsOpen (realName, "r"); 559 561 if (!fits) { … … 665 667 // associated each filename with an element of the FPA 666 668 // save the association on file->names 669 // EXTWORD (fits->extword) is not relevant to the PHU 667 670 fits = psFitsOpen (infiles->data[entry], "r"); 668 671 phu = psFitsReadHeader (NULL, fits); -
trunk/psModules/src/camera/pmFPAfileIO.c
r15333 r15562 34 34 #include "pmResiduals.h" 35 35 #include "pmPSF_IO.h" 36 #include "pmAstrometryTable.h" 36 37 #include "pmFPA_JPEG.h" 37 38 #include "pmSourcePlots.h" … … 192 193 status = pmPSFmodelReadForView (view, file, config); 193 194 break; 195 case PM_FPA_FILE_ASTROM: 196 status = pmAstromReadForView (view, file, config); 197 break; 194 198 case PM_FPA_FILE_JPEG: 195 199 case PM_FPA_FILE_KAPA: … … 273 277 case PM_FPA_FILE_CMF: 274 278 case PM_FPA_FILE_PSF: 279 case PM_FPA_FILE_ASTROM: 275 280 case PM_FPA_FILE_JPEG: 276 281 case PM_FPA_FILE_KAPA: … … 336 341 // have their data stored on the readout->analysis metadata structure of another 337 342 // (existing) fpa 343 if (file->type == PM_FPA_FILE_CMF) { 344 if (!pmFPAviewCheckDataStatusForSources (view, file)) { 345 psTrace("psModules.camera", 6, "skip write for %s, no data for this entry", file->name); 346 return true; 347 } 348 } 338 349 if (file->type == PM_FPA_FILE_PSF) { 339 350 if (!pmPSFmodelCheckDataStatusForView (view, file)) { … … 342 353 } 343 354 } 344 if (file->type == PM_FPA_FILE_ CMF) {345 if (!pm FPAviewCheckDataStatusForSources(view, file)) {355 if (file->type == PM_FPA_FILE_ASTROM) { 356 if (!pmAstromCheckDataStatusForView (view, file)) { 346 357 psTrace("psModules.camera", 6, "skip write for %s, no data for this entry", file->name); 347 358 return true; … … 449 460 case PM_FPA_FILE_PSF: 450 461 status = pmPSFmodelWriteForView (view, file, config); 462 break; 463 464 case PM_FPA_FILE_ASTROM: 465 status = pmAstromWriteForView (view, file, config); 451 466 break; 452 467 … … 508 523 case PM_FPA_FILE_CMF: 509 524 case PM_FPA_FILE_PSF: 525 case PM_FPA_FILE_ASTROM: 510 526 psTrace ("psModules.camera", 5, "closing %s (%s) (%d:%d:%d)\n", file->filename, file->name, view->chip, view->cell, view->readout); 511 527 status = psFitsClose (file->fits); … … 574 590 case PM_FPA_FILE_CMF: 575 591 case PM_FPA_FILE_PSF: 592 case PM_FPA_FILE_ASTROM: 576 593 psTrace ("psModules.camera", 5, "NOT freeing %s (%s) : save for further analysis\n", file->filename, file->name); 577 594 return true; … … 712 729 case PM_FPA_FILE_CMF: 713 730 case PM_FPA_FILE_PSF: 731 case PM_FPA_FILE_ASTROM: 714 732 psTrace ("psModules.camera", 5, "opening %s (%s) (%d:%d:%d)\n", 715 733 file->filename, file->name, view->chip, view->cell, view->readout); … … 861 879 status = pmPSFmodelWritePHU (view, file, config); 862 880 break; 881 case PM_FPA_FILE_ASTROM: 882 status = pmAstromWritePHU (view, file, config); 883 break; 863 884 case PM_FPA_FILE_SX: 864 885 case PM_FPA_FILE_RAW: -
trunk/psModules/src/detrend/pmDetrendDB.c
r13775 r15562 101 101 DETREND_STRING_CASE (SHUTTER); 102 102 DETREND_STRING_CASE (FRINGE); 103 DETREND_STRING_CASE (ASTROM); 103 104 default: 104 105 return NULL; -
trunk/psModules/src/detrend/pmDetrendDB.h
r13775 r15562 9 9 * @author EAM, IfA 10 10 * 11 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2007- 06-13 03:42:33$11 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2007-11-10 01:09:20 $ 13 13 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii 14 14 */ … … 29 29 PM_DETREND_TYPE_FRINGE, 30 30 PM_DETREND_TYPE_BACKGROUND, 31 PM_DETREND_TYPE_ASTROM, 31 32 } pmDetrendType; 32 33 -
trunk/psModules/src/imcombine/pmStack.c
r15396 r15562 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-10-26 23:15:06 $ 12 * 10 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-11-10 01:09:20 $ 13 12 * Copyright 2004-2007 Institute for Astronomy, University of Hawaii 14 13 * -
trunk/psModules/src/imcombine/pmSubtraction.h
r15443 r15562 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-11-03 02:28:24 $ 10 * 8 * @version $Revision: 1.21 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-11-10 01:09:20 $ 11 10 * Copyright 2004-207 Institute for Astronomy, University of Hawaii 12 11 */ -
trunk/psModules/src/objects/Makefile.am
r15039 r15562 10 10 pmModelUtils.c \ 11 11 pmSource.c \ 12 pmSourceExtendedPars.c \ 12 13 pmSourceUtils.c \ 13 14 pmSourceSky.c \ … … 50 51 pmModelUtils.h \ 51 52 pmSource.h \ 53 pmSourceExtendedPars.h \ 52 54 pmSourceUtils.h \ 53 55 pmSourceSky.h \ -
trunk/psModules/src/objects/pmGrowthCurve.h
r11253 r15562 4 4 * @author EAM, IfA 5 5 * 6 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $7 * @date $Date: 2007- 01-24 02:54:15$6 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-11-10 01:09:20 $ 8 8 * Copyright 2006 Institute for Astronomy, University of Hawaii 9 9 */ … … 27 27 pmGrowthCurve; 28 28 29 bool psMemCheckGrowthCurve(psPtr ptr); 30 29 31 pmGrowthCurve *pmGrowthCurveAlloc (psF32 minRadius, psF32 maxRadius, psF32 refRadius); 30 32 psF32 pmGrowthCurveCorrect (pmGrowthCurve *growth, psF32 radius); -
trunk/psModules/src/objects/pmModel.c
r14938 r15562 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2007- 09-21 00:04:07$8 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-11-10 01:09:20 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 46 46 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__); 47 47 48 pmModel *tmp = (pmModel *) psAlloc(sizeof(pmModel));49 psMemSetDeallocator(tmp, (psFreeFunc) modelFree);50 51 48 pmModelClass *class = pmModelClassSelect (type); 52 49 if (class == NULL) { … … 54 51 return(NULL); 55 52 } 53 54 pmModel *tmp = (pmModel *) psAlloc(sizeof(pmModel)); 55 psMemSetDeallocator(tmp, (psFreeFunc) modelFree); 56 56 57 57 tmp->type = type; … … 89 89 } 90 90 91 bool psMemCheckModel(psPtr ptr) 92 { 93 PS_ASSERT_PTR(ptr, false); 94 return ( psMemGetDeallocator(ptr) == (psFreeFunc) modelFree); 95 } 96 91 97 // copy model to a new structure 92 98 pmModel *pmModelCopy (pmModel *model) 93 99 { 100 PS_ASSERT_PTR_NON_NULL(model, NULL); 94 101 95 102 pmModel *new = pmModelAlloc (model->type); … … 217 224 Ro = psImageInterpolateOptionsAlloc( 218 225 PS_INTERPOLATE_BILINEAR, 219 model->residuals->Ro, NULL, NULL, 0, 0.0, 0.0, 1, 0, 0.0);226 model->residuals->Ro, NULL, mask, 0, 0.0, 0.0, 1, 0, 0.0); 220 227 Rx = psImageInterpolateOptionsAlloc( 221 228 PS_INTERPOLATE_BILINEAR, … … 257 264 float oy = yBin*(imageRow + 0.5 - yCenter) + yResidCenter; 258 265 266 psU8 mflux = 0; 259 267 if (mode & PM_MODEL_OP_RES0) { 260 psU8 mflux = 0;261 268 double Fo = 0.0; 262 269 psImageInterpolate (&Fo, NULL, &mflux, ox, oy, Ro); … … 265 272 } 266 273 } 267 if (mode & PM_MODEL_OP_RES1) { 268 psU8 mflux = 0;274 // skip Rx,Ry if Ro is masked 275 if (!mflux && (mode & PM_MODEL_OP_RES1)) { 269 276 double Fx = 0.0; 270 277 double Fy = 0.0; -
trunk/psModules/src/objects/pmModel.h
r14652 r15562 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $8 * @date $Date: 2007- 08-24 00:11:02$7 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-11-10 01:09:20 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 122 122 */ 123 123 pmModel *pmModelAlloc(pmModelType type); 124 bool psMemCheckModel(psPtr ptr); 124 125 125 126 // copy model to a new structure -
trunk/psModules/src/objects/pmModelClass.c
r14938 r15562 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2007- 09-21 00:09:05$8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-11-10 01:09:20 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 57 57 static void ModelClassFree (pmModelClass *modelClass) 58 58 { 59 60 59 if (modelClass == NULL) 61 60 return; … … 70 69 } 71 70 71 bool psMemCheckModelClass(psPtr ptr) 72 { 73 PS_ASSERT_PTR(ptr, false); 74 return ( psMemGetDeallocator(ptr) == (psFreeFunc) ModelClassFree); 75 } 76 72 77 void pmModelClassAdd (pmModelClass *model) 73 78 { 74 79 if (models == NULL) { 75 pmModelClassInit ();80 pmModelClassInit(); 76 81 } 77 82 … … 85 90 { 86 91 // if we do not need to init, return false; 87 if (models != NULL) 92 if (models != NULL) { 88 93 return false; 94 } 89 95 90 96 int Nnew = sizeof (defaultModels) / sizeof (pmModelClass); … … 100 106 pmModelClass *pmModelClassSelect (pmModelType type) 101 107 { 108 if (models == NULL) { 109 pmModelClassInit(); 110 } 111 102 112 if ((type < 0) || (type >= Nmodels)) { 103 113 psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType"); … … 111 121 psFree (models); 112 122 models = NULL; 123 Nmodels = 0; 113 124 return; 114 125 } … … 116 127 psS32 pmModelClassParameterCount (pmModelType type) 117 128 { 129 if (models == NULL) { 130 pmModelClassInit(); 131 } 132 118 133 if ((type < 0) || (type >= Nmodels)) { 119 134 psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType"); … … 125 140 psS32 pmModelClassGetType (char *name) 126 141 { 142 if (models == NULL) { 143 pmModelClassInit(); 144 } 145 127 146 for (int i = 0; i < Nmodels; i++) { 128 147 if (!strcmp(models[i].name, name)) { … … 135 154 char *pmModelClassGetName (pmModelType type) 136 155 { 156 if (models == NULL) { 157 pmModelClassInit(); 158 } 159 137 160 if ((type < 0) || (type >= Nmodels)) { 138 161 psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType"); -
trunk/psModules/src/objects/pmModelClass.h
r14652 r15562 21 21 * @author EAM, IfA 22 22 * 23 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $24 * @date $Date: 2007- 08-24 00:11:02$23 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 24 * @date $Date: 2007-11-10 01:09:20 $ 25 25 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 26 26 */ … … 49 49 pmModelClass *pmModelClassAlloc (int nModels); 50 50 51 // 52 bool psMemCheckModelClass(psPtr ptr); 53 51 54 // initialize the internal (static) model class with the default models 52 55 bool pmModelClassInit (void); -
trunk/psModules/src/objects/pmModelGroup.c
r14652 r15562 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $9 * @date $Date: 2007- 08-24 00:11:02$8 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-11-10 01:09:20 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 68 68 } 69 69 70 bool psMemCheckModelGroup(psPtr ptr) 71 { 72 PS_ASSERT_PTR(ptr, false); 73 return ( psMemGetDeallocator(ptr) == (psFreeFunc) ModelGroupFree); 74 } 75 70 76 void pmModelGroupAdd (pmModelGroup *model) 71 77 { -
trunk/psModules/src/objects/pmModelGroup.h
r14652 r15562 21 21 * @author EAM, IfA 22 22 * 23 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $24 * @date $Date: 2007- 08-24 00:11:02$23 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 24 * @date $Date: 2007-11-10 01:09:20 $ 25 25 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 26 26 */ … … 78 78 pmModelGroup *pmModelGroupAlloc (int nModels); 79 79 80 bool psMemCheckModelGroup(psPtr ptr); 81 80 82 // initialize the internal (static) model group with the default models 81 83 bool pmModelGroupInit (void); -
trunk/psModules/src/objects/pmModelUtils.c
r14938 r15562 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $8 * @date $Date: 2007- 09-21 00:04:30 $7 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-11-10 01:09:20 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 36 36 pmModel *pmModelFromPSF (pmModel *modelEXT, pmPSF *psf) 37 37 { 38 PS_ASSERT_PTR_NON_NULL(psf, NULL); 39 PS_ASSERT_PTR_NON_NULL(modelEXT, NULL); 40 38 41 // allocate a new pmModel to hold the PSF version 39 42 pmModel *modelPSF = pmModelAlloc (psf->type); … … 53 56 // instantiate a model for the PSF at this location with peak flux 54 57 // NOTE: psf and (Xo,Yo) are defined wrt chip coordinates 55 pmModel *pmModelFromPSFforXY (pmPSF *psf, float Xo, float Yo, float Io) {56 57 assert (psf);58 pmModel *pmModelFromPSFforXY (pmPSF *psf, float Xo, float Yo, float Io) 59 { 60 PS_ASSERT_PTR_NON_NULL(psf, NULL); 58 61 59 62 // allocate a new pmModel to hold the PSF version … … 75 78 // set this model to have the requested flux 76 79 bool pmModelSetFlux (pmModel *model, float flux) { 80 PS_ASSERT_PTR_NON_NULL(model, NULL); 81 PS_ASSERT_PTR_NON_NULL(model->params, NULL); 77 82 78 83 // set Io to be 1.0 -
trunk/psModules/src/objects/pmPSF.c
r15089 r15562 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.3 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2007- 09-29 00:15:32$8 * @version $Revision: 1.33 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-11-10 01:09:20 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 76 76 } 77 77 78 bool psMemCheckPSFOptions(psPtr ptr) 79 { 80 PS_ASSERT_PTR(ptr, false); 81 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmPSFOptionsFree); 82 } 83 78 84 /***************************************************************************** 79 85 pmPSFFree(psf): function to free a pmPSF structure … … 81 87 static void pmPSFFree (pmPSF *psf) 82 88 { 83 84 if (psf == NULL) 89 if (psf == NULL) { 85 90 return; 91 } 86 92 87 93 psFree (psf->ChiTrend); … … 98 104 pmPSFAlloc (type): allocate a pmPSF. 99 105 100 NOTE: PSF model parameters which are not modeled on an image are set to NULL in psf->params. 106 NOTE: PSF model parameters which are not modeled on an image are set to NULL 107 in psf->params. 101 108 102 109 These are normally: … … 109 116 pmPSF *pmPSFAlloc (pmPSFOptions *options) 110 117 { 118 PS_ASSERT_PTR_NON_NULL(options, NULL); 111 119 int Nparams; 112 120 … … 205 213 } 206 214 215 bool psMemCheckPSF(psPtr ptr) 216 { 217 PS_ASSERT_PTR(ptr, false); 218 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmPSFFree); 219 } 220 207 221 // the PSF models the \sigma_{xy} variation of the elliptical contour as a function of position in the image with a 208 222 // polynomial. an individual object has a contour of the form (x^2/2sx^2) + (y^2/2sy^2) + sxy*x*y … … 217 231 double pmPSF_SXYfromModel (psF32 *modelPar) 218 232 { 233 PS_ASSERT_PTR_NON_NULL(modelPar, NAN); 219 234 220 235 double SXX = modelPar[PM_PAR_SXX]; … … 229 244 double pmPSF_SXYtoModel (psF32 *fittedPar) 230 245 { 246 PS_ASSERT_PTR_NON_NULL(fittedPar, NAN); 231 247 232 248 double SXX = fittedPar[PM_PAR_SXX]; … … 247 263 bool pmPSF_FitToModel (psF32 *fittedPar, float minMinorAxis) 248 264 { 265 PS_ASSERT_PTR_NON_NULL(fittedPar, false); 266 249 267 psEllipsePol pol; 250 268 … … 272 290 psEllipsePol pmPSF_ModelToFit (psF32 *modelPar) 273 291 { 292 // XXX: must assert non-NULL input parameter 293 // PS_ASSERT_PTR_NON_NULL(modelPar, NAN); 294 274 295 psEllipseShape shape; 275 296 … … 289 310 psEllipseShape shape; 290 311 psEllipseAxes axes; 312 // XXX: must assert non-NULL input parameter 313 // PS_ASSERT_PTR_NON_NULL(modelPar, axes); 291 314 292 315 shape.sx = modelPar[PM_PAR_SXX] / M_SQRT2; … … 310 333 bool pmPSF_AxesToModel (psF32 *modelPar, psEllipseAxes axes) 311 334 { 335 PS_ASSERT_PTR_NON_NULL(modelPar, false); 336 312 337 if ((axes.major <= 0) || (axes.minor <= 0)) { 313 338 modelPar[PM_PAR_SXX] = 0.0; … … 374 399 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore, psMaskType maskVal, psMaskType mark) 375 400 { 401 PS_ASSERT_PTR_NON_NULL(readout, false); 402 PS_ASSERT_PTR_NON_NULL(readout->image, false); 376 403 377 404 // bool status; -
trunk/psModules/src/objects/pmPSF.h
r15016 r15562 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $9 * @date $Date: 2007- 09-25 22:05:05$8 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-11-10 01:09:20 $ 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 11 11 */ … … 87 87 * 88 88 */ 89 89 90 pmPSF *pmPSFAlloc (pmPSFOptions *options); 90 pmPSFOptions *pmPSFOptionsAlloc (); 91 bool psMemCheckPSF(psPtr ptr); 92 pmPSFOptions *pmPSFOptionsAlloc(); 93 bool psMemCheckPSFOptions(psPtr ptr); 91 94 92 95 double pmPSF_SXYfromModel (psF32 *modelPar); -
trunk/psModules/src/objects/pmPSF_IO.c
r15254 r15562 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.2 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-1 0-09 19:26:25$8 * @version $Revision: 1.28 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-11-10 01:09:20 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 50 50 bool pmPSFmodelCheckDataStatusForView (const pmFPAview *view, const pmFPAfile *file) 51 51 { 52 PS_ASSERT_PTR_NON_NULL(view, false); 53 PS_ASSERT_PTR_NON_NULL(file, false); 54 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 55 PS_ASSERT_PTR_NON_NULL(file->fpa->chips, false); 56 52 57 pmFPA *fpa = file->fpa; 53 58 … … 61 66 } 62 67 pmChip *chip = fpa->chips->data[view->chip]; 68 PS_ASSERT_PTR_NON_NULL(chip, false); 69 PS_ASSERT_PTR_NON_NULL(chip->cells, false); 63 70 64 71 if (view->cell == -1) { … … 75 82 76 83 bool pmPSFmodelCheckDataStatusForFPA (const pmFPA *fpa) { 84 85 PS_ASSERT_PTR_NON_NULL(fpa, false); 86 PS_ASSERT_PTR_NON_NULL(fpa->chips, false); 77 87 78 88 for (int i = 0; i < fpa->chips->n; i++) { … … 85 95 86 96 bool pmPSFmodelCheckDataStatusForChip (const pmChip *chip) { 97 PS_ASSERT_PTR_NON_NULL(chip, false); 87 98 88 99 bool status; … … 95 106 bool pmPSFmodelWriteForView (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 96 107 { 108 PS_ASSERT_PTR_NON_NULL(view, false); 109 PS_ASSERT_PTR_NON_NULL(file, false); 110 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 111 PS_ASSERT_PTR_NON_NULL(file->fpa->chips, false); 97 112 98 113 pmFPA *fpa = file->fpa; … … 126 141 bool pmPSFmodelWriteFPA (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 127 142 { 143 PS_ASSERT_PTR_NON_NULL(view, false); 144 PS_ASSERT_PTR_NON_NULL(fpa, false); 145 PS_ASSERT_PTR_NON_NULL(fpa->chips, false); 128 146 pmFPAview *thisView = pmFPAviewAlloc (view->nRows); 129 147 *thisView = *view; … … 145 163 bool pmPSFmodelWriteChip (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 146 164 { 165 PS_ASSERT_PTR_NON_NULL(view, false); 166 PS_ASSERT_PTR_NON_NULL(chip, false); 167 147 168 if (!pmPSFmodelWrite (chip->analysis, view, file, config)) { 148 169 psError(PS_ERR_IO, false, "Failed to write PSF for chip"); … … 162 183 bool pmPSFmodelWrite (psMetadata *analysis, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 163 184 { 185 PS_ASSERT_PTR_NON_NULL(view, false); 186 PS_ASSERT_PTR_NON_NULL(file, false); 187 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 164 188 bool status; 165 189 pmHDU *hdu; … … 450 474 451 475 // if this file needs to have a PHU written out, write one 452 bool pmPSFmodelWritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) { 453 476 bool pmPSFmodelWritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 477 { 478 PS_ASSERT_PTR_NON_NULL(view, false); 479 PS_ASSERT_PTR_NON_NULL(file, false); 480 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 454 481 // not needed if already written 455 482 if (file->wrote_phu) return true; … … 494 521 bool pmPSFmodelReadForView (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 495 522 { 523 PS_ASSERT_PTR_NON_NULL(view, false); 524 PS_ASSERT_PTR_NON_NULL(file, false); 525 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 496 526 497 527 pmFPA *fpa = file->fpa; … … 517 547 bool pmPSFmodelReadFPA (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 518 548 { 549 PS_ASSERT_PTR_NON_NULL(view, false); 550 PS_ASSERT_PTR_NON_NULL(file, false); 551 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 552 519 553 bool success = true; // Was everything successful? 520 554 for (int i = 0; i < fpa->chips->n; i++) { … … 528 562 bool pmPSFmodelReadChip (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 529 563 { 564 PS_ASSERT_PTR_NON_NULL(view, false); 565 PS_ASSERT_PTR_NON_NULL(file, false); 566 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 567 530 568 if (!pmPSFmodelRead (chip->analysis, view, file, config)) { 531 569 psError(PS_ERR_IO, false, "Failed to write PSF for chip"); … … 539 577 bool pmPSFmodelRead (psMetadata *analysis, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 540 578 { 579 PS_ASSERT_PTR_NON_NULL(view, false); 580 PS_ASSERT_PTR_NON_NULL(file, false); 581 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 582 541 583 bool status; 542 584 char *rule = NULL; … … 763 805 } 764 806 765 // create a psMetadata representation (human-readable) of a psf model766 807 // XXX pmPSF to/from Metadata functions were defined for 1.22 and earlier, but were dropped -
trunk/psModules/src/objects/pmPSFtry.c
r15254 r15562 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1. 49$ $Name: not supported by cvs2svn $8 * @date $Date: 2007-1 0-09 19:26:25$7 * @version $Revision: 1.50 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-11-10 01:09:20 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 81 81 } 82 82 83 bool psMemCheckPSFtry(psPtr ptr) 84 { 85 PS_ASSERT_PTR(ptr, false); 86 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmPSFtryFree); 87 } 88 89 83 90 // build a pmPSFtry for the given model: 84 91 // - fit each source with the free-floating model … … 249 256 bool pmPSFtryMetric (pmPSFtry *psfTry, float RADIUS) 250 257 { 258 PS_ASSERT_PTR_NON_NULL(psfTry, false); 259 PS_ASSERT_PTR_NON_NULL(psfTry->sources, false); 260 251 261 // the measured (aperture - fit) magnitudes (dA == psfTry->metric) 252 262 // depend on both the true ap-fit (dAo) and the bias in the sky measurement: … … 346 356 bool pmPSFFromPSFtry (pmPSFtry *psfTry) 347 357 { 358 PS_ASSERT_PTR_NON_NULL(psfTry, false); 359 PS_ASSERT_PTR_NON_NULL(psfTry->sources, false); 360 348 361 pmPSF *psf = psfTry->psf; 349 362 -
trunk/psModules/src/objects/pmPSFtry.h
r15016 r15562 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2007- 09-25 22:05:05$8 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-11-10 01:09:20 $ 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 11 11 */ … … 78 78 * 79 79 */ 80 80 81 pmPSFtry *pmPSFtryAlloc (psArray *sources, pmPSFOptions *options); 82 bool psMemCheckPSFtry(psPtr ptr); 81 83 82 84 /** pmPSFtryModel() -
trunk/psModules/src/objects/pmPeaks.c
r15039 r15562 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2007- 09-27 03:35:29$8 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-11-10 01:09:20 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 150 150 } 151 151 152 // XXX: Get rid of this: 152 153 bool pmPeakTest(const psPtr ptr) 153 154 { … … 155 156 } 156 157 158 bool psMemCheckPeak(psPtr ptr) 159 { 160 PS_ASSERT_PTR(ptr, false); 161 return ( psMemGetDeallocator(ptr) == (psFreeFunc) peakFree); 162 } 163 164 157 165 // psSort comparison function for peaks 166 // XXX: Add error-checking for NULL args 158 167 int pmPeaksCompareAscend (const void **a, const void **b) 159 168 { … … 177 186 178 187 // psSort comparison function for peaks 188 // XXX: Add error-checking for NULL args 179 189 int pmPeaksCompareDescend (const void **a, const void **b) 180 190 { -
trunk/psModules/src/objects/pmPeaks.h
r15039 r15562 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2007- 09-27 03:35:29$12 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2007-11-10 01:09:20 $ 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 15 15 */ … … 75 75 76 76 bool pmPeakTest(const psPtr ptr); 77 bool psMemCheckPeak(psPtr ptr); 77 78 78 79 /** pmPeaksInVector() -
trunk/psModules/src/objects/pmResiduals.c
r12949 r15562 4 4 * 5 5 * @author EAM, IfA 6 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $7 * @date $Date: 2007- 04-21 19:47:14$6 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-11-10 01:09:20 $ 8 8 * Copyright 2004 IfA, University of Hawaii 9 9 */ … … 51 51 return resid; 52 52 } 53 54 bool psMemCheckResiduals(psPtr ptr) 55 { 56 PS_ASSERT_PTR(ptr, false); 57 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmResidualsFree); 58 } 59 -
trunk/psModules/src/objects/pmResiduals.h
r12949 r15562 4 4 * 5 5 * @author EAM, IfA 6 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $7 * @date $Date: 2007- 04-21 19:47:14$6 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-11-10 01:09:20 $ 8 8 * Copyright 2004 IfA, University of Hawaii 9 9 */ … … 29 29 30 30 pmResiduals *pmResidualsAlloc (int xSize, int ySize, int xBin, int yBin); 31 bool psMemCheckResiduals(psPtr ptr); 31 32 32 33 /// @} -
trunk/psModules/src/objects/pmSource.c
r15232 r15562 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1.4 0$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-1 0-06 02:29:47$8 * @version $Revision: 1.41 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-11-10 01:09:20 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 77 77 } 78 78 79 bool psMemCheckSource(psPtr ptr) 80 { 81 PS_ASSERT_PTR(ptr, false); 82 return ( psMemGetDeallocator(ptr) == (psFreeFunc) sourceFree); 83 } 84 79 85 /****************************************************************************** 80 86 pmSourceAlloc(): Allocate the pmSource structure and initialize its members 81 87 to NULL. 82 88 *****************************************************************************/ 89 83 90 pmSource *pmSourceAlloc() 84 91 { … … 132 139 pmSource *pmSourceCopy(pmSource *in) 133 140 { 141 if (in == NULL) { 142 return(NULL); 143 } 134 144 // this copy is used to allow multiple fit attempts on the 135 145 // same object. the pixels, weight, and mask arrays all point to … … 139 149 140 150 // this is actually the same peak as the original, is this the correct way to handle this? 141 source->peak = pmPeakAlloc (in->peak->x, in->peak->y, in->peak->value, in->peak->type); 142 source->peak->xf = in->peak->xf; 143 source->peak->yf = in->peak->yf; 144 source->peak->flux = in->peak->flux; 145 source->peak->SN = in->peak->SN; 151 if (in->peak != NULL) { 152 source->peak = pmPeakAlloc (in->peak->x, in->peak->y, in->peak->value, in->peak->type); 153 source->peak->xf = in->peak->xf; 154 source->peak->yf = in->peak->yf; 155 source->peak->flux = in->peak->flux; 156 source->peak->SN = in->peak->SN; 157 } 146 158 147 159 // copy the values in the moments structure 148 source->moments = pmMomentsAlloc(); 149 *source->moments = *in->moments; 160 if (in->moments != NULL) { 161 source->moments = pmMomentsAlloc(); 162 *source->moments = *in->moments; 163 } 150 164 151 165 // These images are all views to the parent. 152 166 // We want a new view, but pointing at the same pixels. 153 source->pixels = psImageCopyView (NULL, in->pixels);154 source->weight = psImageCopyView (NULL, in->weight);155 source->maskView = psImageCopyView (NULL, in->maskView);167 source->pixels = psImageCopyView(NULL, in->pixels); 168 source->weight = psImageCopyView(NULL, in->weight); 169 source->maskView = psImageCopyView(NULL, in->maskView); 156 170 157 171 // the maskObj is a unique mask array; create a new mask image … … 173 187 psF32 Radius) 174 188 { 189 PS_ASSERT_PTR_NON_NULL(mySource, false); 190 PS_ASSERT_PTR_NON_NULL(readout, false); 191 PS_ASSERT_PTR_NON_NULL(readout->image, false); 192 PS_ASSERT_INT_POSITIVE(Radius, false); 193 175 194 psRegion srcRegion; 176 195 … … 200 219 psF32 Radius) 201 220 { 221 PS_ASSERT_PTR_NON_NULL(mySource, false); 222 PS_ASSERT_PTR_NON_NULL(readout, false); 223 PS_ASSERT_PTR_NON_NULL(readout->image, false); 224 PS_ASSERT_INT_POSITIVE(Radius, false); 225 202 226 bool extend; 203 227 psRegion newRegion; 204 205 if (Radius == 0)206 return false;207 228 208 229 // check to see if new region is completely contained within old region … … 814 835 815 836 // should we call pmSourceCacheModel if it does not exist? 816 bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, psMaskType maskVal, int dx, int dy) { 817 837 bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, 838 psMaskType maskVal, int dx, int dy) 839 { 840 PS_ASSERT_PTR_NON_NULL(source, false); 818 841 bool status; 819 842 … … 904 927 pmModel *pmSourceGetModel (bool *isPSF, const pmSource *source) 905 928 { 929 PS_ASSERT_PTR_NON_NULL(source, NULL); 906 930 907 931 pmModel *model; -
trunk/psModules/src/objects/pmSource.h
r15039 r15562 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $6 * @date $Date: 2007- 09-27 03:35:29$5 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-11-10 01:09:20 $ 7 7 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 8 8 */ … … 10 10 # ifndef PM_SOURCE_H 11 11 # define PM_SOURCE_H 12 13 # include "pmSourceExtendedPars.h" 12 14 13 15 /// @addtogroup Objects Object Detection / Analysis Functions … … 84 86 psRegion region; ///< area on image covered by selected pixels 85 87 float sky, skyErr; ///< The sky and its error at the center of the object 88 pmSourceExtendedPars *extpars; ///< extended source parameters 86 89 }; 87 90 … … 111 114 * 112 115 */ 116 117 bool psMemCheckSource(psPtr ptr); 118 113 119 pmSource *pmSourceCopy(pmSource *source); 114 120 … … 178 184 */ 179 185 pmPSFClump pmSourcePSFClump( 180 psArray *source, ///< The input pmSource 181 psMetadata *metadata ///< Contains classification parameters 182 ); 183 186 psArray *source, ///< The input pmSource 187 psMetadata *metadata ///< Contains classification parameters 188 ); 184 189 185 190 /** pmSourceRoughClass() … … 194 199 */ 195 200 bool pmSourceRoughClass( 196 psArray *source, ///< The input pmSource197 psMetadata *metadata, ///< Contains classification parameters198 pmPSFClump clump, ///< Statistics about the PSF clump201 psArray *source, ///< The input pmSource 202 psMetadata *metadata, ///< Contains classification parameters 203 pmPSFClump clump, ///< Statistics about the PSF clump 199 204 psMaskType maskSat ///< Mask value for saturated pixels 200 205 ); -
trunk/psModules/src/objects/pmSourceContour.c
r14938 r15562 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $9 * @date $Date: 2007- 09-21 00:09:05$8 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-11-10 01:09:20 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 220 220 psArray *pmSourceContour (psImage *image, int xc, int yc, float threshold) 221 221 { 222 PS_ASSERT_PTR_NON_NULL(image, NULL); 222 223 223 224 int xR, yR, x0, x1, x0s, x1s; -
trunk/psModules/src/objects/pmSourceFitSet.c
r15055 r15562 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2007- 09-28 00:39:41$8 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-11-10 01:09:20 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 79 79 } 80 80 81 bool psMemCheckSourceFitSetData(psPtr ptr) 82 { 83 PS_ASSERT_PTR(ptr, false); 84 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmSourceFitSetDataFree); 85 } 86 87 81 88 // this function is called with the full set of parameters and the beta values in a single vector 82 bool pmSourceFitSetCheckLimits (psMinConstraintMode mode, int nParam, float *params, float *betas) 83 { 84 assert (thisSet); 89 bool pmSourceFitSetCheckLimits (psMinConstraintMode mode, int nParam, float *params, 90 float *betas) 91 { 92 PS_ASSERT_PTR_NON_NULL(thisSet, false); 85 93 86 94 // nParam is the parameter in the full sequence. determine which single model this comes from … … 109 117 110 118 // merge parameters from FitSet models into single param and deriv vectors 111 bool pmSourceFitSetJoin (psVector *deriv, psVector *param, pmSourceFitSetData *set) { 112 113 assert (set); 119 bool pmSourceFitSetJoin (psVector *deriv, psVector *param, pmSourceFitSetData *set) 120 { 121 PS_ASSERT_PTR_NON_NULL(set, false); 122 PS_ASSERT_PTR_NON_NULL(param, false); 123 114 124 assert (set->paramSet->n == set->derivSet->n); 115 125 … … 138 148 // distribute parameters from single param and deriv vectors into FitSet models 139 149 bool pmSourceFitSetSplit (pmSourceFitSetData *set, const psVector *deriv, const psVector *param) { 140 141 assert (set); 150 PS_ASSERT_PTR_NON_NULL(set, false); 151 PS_ASSERT_PTR_NON_NULL(param, false); 152 142 153 assert (set->paramSet->n == set->derivSet->n); 143 154 … … 159 170 } 160 171 161 bool pmSourceFitSetValues (pmSourceFitSetData *set, const psVector *dparam, const psVector *param, pmSource *source, psMinimization *myMin, int nPix, bool fitStatus) { 162 172 bool pmSourceFitSetValues (pmSourceFitSetData *set, const psVector *dparam, 173 const psVector *param, pmSource *source, 174 psMinimization *myMin, int nPix, bool fitStatus) 175 { 176 PS_ASSERT_PTR_NON_NULL(set, false); 163 177 bool onPic = true; 164 165 assert (set);166 178 167 179 int n = 0; … … 203 215 psF32 pmSourceFitSetFunction(psVector *deriv, const psVector *param, const psVector *x) 204 216 { 217 PS_ASSERT_PTR_NON_NULL(thisSet, NAN); 205 218 float chisqSum = 0.0; 206 219 float chisqOne = 0.0; 207 208 assert (thisSet);209 220 pmSourceFitSetSplit (thisSet, deriv, param); 210 221 … … 225 236 226 237 // XXX allow the mode to be a function of the object (eg, S/N) 227 bool pmSourceFitSetMasks (psMinConstraint *constraint, pmSourceFitSetData *set, pmSourceFitMode mode) { 238 bool pmSourceFitSetMasks (psMinConstraint *constraint, pmSourceFitSetData *set, 239 pmSourceFitMode mode) 240 { 241 PS_ASSERT_PTR_NON_NULL(set, false); 242 PS_ASSERT_PTR_NON_NULL(constraint, false); 228 243 229 244 // unmask everyone -
trunk/psModules/src/objects/pmSourceFitSet.h
r15055 r15562 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $6 * @date $Date: 2007- 09-28 00:39:47$5 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-11-10 01:09:20 $ 7 7 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 8 8 */ … … 23 23 // initialize data for a group of object models 24 24 pmSourceFitSetData *pmSourceFitSetDataAlloc (psArray *modelSet); 25 bool psMemCheckSourceFitSetData(psPtr ptr); 25 26 26 27 // function used to set limits for a group of models -
trunk/psModules/src/objects/pmSourceIO.c
r15227 r15562 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.5 2$ $Name: not supported by cvs2svn $6 * @date $Date: 2007-1 0-05 22:46:34$5 * @version $Revision: 1.53 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-11-10 01:09:20 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 47 47 int pmSourceGetDophotType (pmSource *source) 48 48 { 49 PS_ASSERT_PTR_NON_NULL(source, -1); 50 49 51 switch (source->type) { 50 52 … … 74 76 bool pmSourceSetDophotType (pmSource *source, int type) 75 77 { 78 PS_ASSERT_PTR_NON_NULL(source, false); 79 76 80 if (type == 4) { 77 81 source->mode |= PM_SOURCE_MODE_FAIL; … … 106 110 bool pmFPAviewWriteObjects (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 107 111 { 112 PS_ASSERT_PTR_NON_NULL(view, false); 113 PS_ASSERT_PTR_NON_NULL(file, false); 114 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 108 115 109 116 pmFPA *fpa = file->fpa; … … 165 172 bool pmFPAWriteObjects (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 166 173 { 174 PS_ASSERT_PTR_NON_NULL(view, false); 175 PS_ASSERT_PTR_NON_NULL(fpa, false); 176 PS_ASSERT_PTR_NON_NULL(fpa->chips, false); 177 167 178 pmFPAview *thisView = pmFPAviewAlloc (view->nRows); 168 179 *thisView = *view; … … 184 195 bool pmChipWriteObjects (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 185 196 { 197 PS_ASSERT_PTR_NON_NULL(chip, false); 198 PS_ASSERT_PTR_NON_NULL(chip->cells, false); 199 PS_ASSERT_PTR_NON_NULL(view, false); 200 186 201 pmFPAview *thisView = pmFPAviewAlloc (view->nRows); 187 202 *thisView = *view; … … 203 218 bool pmCellWriteObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 204 219 { 220 PS_ASSERT_PTR_NON_NULL(cell, false); 221 PS_ASSERT_PTR_NON_NULL(cell->readouts, false); 222 PS_ASSERT_PTR_NON_NULL(view, false); 223 205 224 pmFPAview *thisView = pmFPAviewAlloc (view->nRows); 206 225 *thisView = *view; … … 222 241 bool pmReadoutWriteObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 223 242 { 243 PS_ASSERT_PTR_NON_NULL(readout, false); 244 PS_ASSERT_PTR_NON_NULL(view, false); 245 PS_ASSERT_PTR_NON_NULL(file, false); 246 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 224 247 225 248 bool status; 226 char *exttype;227 char *dataname;228 char *headname;229 249 pmHDU *hdu; 230 250 psMetadata *updates; 231 251 psMetadata *outhead; 252 253 char *exttype = NULL; 254 char *dataname = NULL; 255 char *xsrcname = NULL; 256 char *headname = NULL; 232 257 233 258 // XXX if sources is NULL, skip the cell or write out empty tables? … … 284 309 // get the current header 285 310 hdu = pmFPAviewThisHDU (view, file->fpa); 311 312 // determine the output table format 313 psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, "PSPHOT"); 314 if (!status) { 315 psError(PS_ERR_UNKNOWN, true, "missing recipe PSPHOT in config data"); 316 return false; 317 } 318 319 // if this is not TRUE, the output files only contain the psf measurements. 320 bool XSRC_OUTPUT = psMetadataLookupBool(&status, recipe, "SAVE.XSRC"); 286 321 287 322 // define the EXTNAME values for the different data segments: … … 312 347 } 313 348 dataname = pmFPAfileNameFromRule (rule, file, view); 349 350 if (XSRC_OUTPUT) { 351 // EXTNAME for extended source data table 352 rule = psMetadataLookupStr(&status, menu, "CMF.XSRC"); 353 if (!rule) { 354 psError(PS_ERR_UNKNOWN, true, "missing entry for CMF.XSRC in EXTNAME.RULES in camera.config"); 355 return false; 356 } 357 xsrcname = pmFPAfileNameFromRule (rule, file, view); 358 } 314 359 } 315 360 … … 350 395 outhead = psMetadataAlloc (); 351 396 352 // determine the output table format353 psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, "PSPHOT");354 if (!status) {355 psError(PS_ERR_UNKNOWN, true, "missing recipe PSPHOT in config data");356 return false;357 }358 397 exttype = psMemIncrRefCounter (psMetadataLookupStr(&status, recipe, "OUTPUT.FORMAT")); 359 398 if (!exttype) { … … 375 414 } 376 415 if (!strcmp (exttype, "PS1_DEV_1")) { 377 status = pmSourcesWrite_PS1_DEV_1 (file->fits, sources, file->header, outhead, dataname );416 status = pmSourcesWrite_PS1_DEV_1 (file->fits, sources, file->header, outhead, dataname, xsrcname); 378 417 } 379 380 418 if (!status) { 381 419 psError(PS_ERR_IO, false, "writing CMF data to %s with format %s\n", file->filename, exttype); … … 403 441 404 442 // if this file needs to have a PHU written out, write one 405 bool pmSource_CMF_WritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) { 443 bool pmSource_CMF_WritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 444 { 445 PS_ASSERT_PTR_NON_NULL(view, false); 446 PS_ASSERT_PTR_NON_NULL(file, false); 406 447 407 448 bool status; … … 512 553 bool pmFPAviewReadObjects (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 513 554 { 555 PS_ASSERT_PTR_NON_NULL(view, false); 556 PS_ASSERT_PTR_NON_NULL(file, false); 557 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 558 514 559 pmFPA *fpa = file->fpa; 515 560 … … 551 596 bool pmFPAReadObjects (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 552 597 { 598 PS_ASSERT_PTR_NON_NULL(view, false); 599 PS_ASSERT_PTR_NON_NULL(file, false); 600 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 601 PS_ASSERT_PTR_NON_NULL(file->fpa->chips, false); 602 553 603 pmFPAview *thisView = pmFPAviewAlloc (view->nRows); 554 604 *thisView = *view; … … 572 622 bool pmChipReadObjects (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 573 623 { 624 PS_ASSERT_PTR_NON_NULL(view, false); 625 PS_ASSERT_PTR_NON_NULL(chip, false); 626 PS_ASSERT_PTR_NON_NULL(chip->cells, false); 627 574 628 pmFPAview *thisView = pmFPAviewAlloc (view->nRows); 575 629 *thisView = *view; … … 596 650 bool pmCellReadObjects (pmCell *cell, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 597 651 { 652 PS_ASSERT_PTR_NON_NULL(view, false); 653 PS_ASSERT_PTR_NON_NULL(cell, false); 654 PS_ASSERT_PTR_NON_NULL(cell->readouts, false); 655 598 656 pmFPAview *thisView = pmFPAviewAlloc (view->nRows); 599 657 *thisView = *view; … … 637 695 bool pmReadoutReadObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 638 696 { 697 PS_ASSERT_PTR_NON_NULL(view, false); 698 PS_ASSERT_PTR_NON_NULL(file, false); 639 699 640 700 bool status; … … 774 834 bool pmFPAviewCheckDataStatusForSources (const pmFPAview *view, const pmFPAfile *file) 775 835 { 836 PS_ASSERT_PTR_NON_NULL(view, false); 837 PS_ASSERT_PTR_NON_NULL(file, false); 838 PS_ASSERT_PTR_NON_NULL(file->fpa, false); 839 776 840 pmFPA *fpa = file->fpa; 777 841 … … 811 875 } 812 876 813 bool pmFPACheckDataStatusForSources (const pmFPA *fpa) { 877 bool pmFPACheckDataStatusForSources (const pmFPA *fpa) 878 { 879 PS_ASSERT_PTR_NON_NULL(fpa, false); 880 PS_ASSERT_PTR_NON_NULL(fpa->chips, false); 814 881 815 882 for (int i = 0; i < fpa->chips->n; i++) { … … 821 888 } 822 889 823 bool pmChipCheckDataStatusForSources (const pmChip *chip) { 890 bool pmChipCheckDataStatusForSources (const pmChip *chip) 891 { 892 PS_ASSERT_PTR_NON_NULL(chip, false); 893 PS_ASSERT_PTR_NON_NULL(chip->cells, false); 824 894 825 895 for (int i = 0; i < chip->cells->n; i++) { … … 831 901 } 832 902 833 bool pmCellCheckDataStatusForSources (const pmCell *cell) { 903 bool pmCellCheckDataStatusForSources (const pmCell *cell) 904 { 905 PS_ASSERT_PTR_NON_NULL(cell, false); 906 PS_ASSERT_PTR_NON_NULL(cell->readouts, false); 834 907 835 908 for (int i = 0; i < cell->readouts->n; i++) { … … 841 914 } 842 915 843 bool pmReadoutCheckDataStatusForSources (const pmReadout *readout) { 916 bool pmReadoutCheckDataStatusForSources (const pmReadout *readout) 917 { 918 PS_ASSERT_PTR_NON_NULL(readout, false); 844 919 845 920 bool status; -
trunk/psModules/src/objects/pmSourceIO.h
r15039 r15562 4 4 * @author EAM, IfA; GLG, MHPCC 5 5 * 6 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $7 * @date $Date: 2007- 09-27 03:35:29$6 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-11-10 01:09:20 $ 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 9 9 * … … 26 26 bool pmSourcesWrite_SMPDATA (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname); 27 27 bool pmSourcesWrite_PS1_DEV_0 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname); 28 bool pmSourcesWrite_PS1_DEV_1 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname); 28 bool pmSourcesWrite_PS1_DEV_1 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, char *xsrcname); 29 bool pmSourcesWrite_PS1_DEV_1_XSRC (psFits *fits, psArray *sources, char *extname); 29 30 30 31 bool pmSource_CMF_WritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config); -
trunk/psModules/src/objects/pmSourceIO_CMP.c
r14938 r15562 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.3 1$ $Name: not supported by cvs2svn $6 * @date $Date: 2007- 09-21 00:09:05$5 * @version $Revision: 1.32 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-11-10 01:09:20 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 48 48 bool pmSourcesWriteCMP (psArray *sources, char *filename, psMetadata *header) 49 49 { 50 PS_ASSERT_PTR_NON_NULL(sources, false); 51 PS_ASSERT_PTR_NON_NULL(filename, false); 52 PS_ASSERT_PTR_NON_NULL(header, false); 50 53 51 54 int i, type; … … 58 61 // find config information for output header 59 62 float ZERO_POINT = psMetadataLookupF32 (&status, header, "ZERO_PT"); 60 if (!status) 63 if (!status) { 61 64 ZERO_POINT = 25.0; 65 } 62 66 63 67 // MEF elements have XTENSION, not SIMPLE: remove this (replace with SIMPLE) 64 68 psMetadataLookupStr (&status, header, "XTENSION"); 65 if (status) 69 if (status) { 66 70 psMetadataRemoveKey (header, "XTENSION"); 71 } 67 72 68 73 // create file, write-out header … … 148 153 psArray *pmSourcesReadCMP (char *filename, psMetadata *header) 149 154 { 155 PS_ASSERT_PTR_NON_NULL(filename, false); 156 PS_ASSERT_PTR_NON_NULL(header, false); 150 157 151 158 bool status; -
trunk/psModules/src/objects/pmSourceIO_OBJ.c
r14938 r15562 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $6 * @date $Date: 2007- 09-21 00:09:05$5 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-11-10 01:09:20 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 42 42 bool pmSourcesWriteOBJ (psArray *sources, char *filename) 43 43 { 44 PS_ASSERT_PTR_NON_NULL(sources, false); 45 PS_ASSERT_PTR_NON_NULL(filename, false); 44 46 45 47 int type; -
trunk/psModules/src/objects/pmSourceIO_PS1_DEV_0.c
r14938 r15562 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $6 * @date $Date: 2007- 09-21 00:09:05$5 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-11-10 01:09:20 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 46 46 // values derived in the DVO database. 47 47 // XXX how do I generate the source tables which I need to send to PSPS? 48 49 bool pmSourcesWrite_PS1_DEV_0 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname) 48 // XXX: input parameter imageHeader is never used. 49 bool pmSourcesWrite_PS1_DEV_0 (psFits *fits, psArray *sources, psMetadata *imageHeader, 50 psMetadata *tableHeader, char *extname) 50 51 { 52 PS_ASSERT_PTR_NON_NULL(fits, false); 53 PS_ASSERT_PTR_NON_NULL(sources, false); 54 PS_ASSERT_PTR_NON_NULL(extname, false); 51 55 52 56 psArray *table; … … 147 151 psArray *pmSourcesRead_PS1_DEV_0 (psFits *fits, psMetadata *header) 148 152 { 153 PS_ASSERT_PTR_NON_NULL(fits, false); 154 PS_ASSERT_PTR_NON_NULL(header, false); 149 155 150 156 bool status; -
trunk/psModules/src/objects/pmSourceIO_PS1_DEV_1.c
r15250 r15562 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $6 * @date $Date: 2007-1 0-09 03:10:05$5 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-11-10 01:09:20 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 47 47 // XXX how do I generate the source tables which I need to send to PSPS? 48 48 49 bool pmSourcesWrite_PS1_DEV_1 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname )49 bool pmSourcesWrite_PS1_DEV_1 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, char *xsrcname) 50 50 { 51 51 … … 57 57 psF32 xPos, yPos; 58 58 psF32 xErr, yErr; 59 60 // if we request XSRC output, add the XSRC name to this header 61 if (xsrcname) { 62 psMetadataAddStr (tableHeader, PS_LIST_TAIL, "XSRCNAME", PS_META_REPLACE, "name of XSRC table extension", xsrcname); 63 } 59 64 60 65 // let's write these out in S/N order … … 144 149 return false; 145 150 } 146 147 151 psFree (table); 152 153 if (xsrcname) { 154 pmSourcesWrite_PS1_DEV_1_XSRC (fits, sources, xsrcname); 155 } 156 148 157 return true; 149 158 } … … 165 174 } 166 175 assert (modelType > -1); 176 177 // XXX need to look up the XSRCNAME entries 167 178 168 179 // validate a single row of the table (must match SMP) … … 241 252 return sources; 242 253 } 254 255 bool pmSourcesWrite_PS1_DEV_1_XSRC (psFits *fits, psArray *sources, char *extname) 256 { 257 258 psArray *table; 259 psMetadata *row; 260 int i; 261 psF32 *PAR, *dPAR; 262 psEllipseAxes axes; 263 psF32 xPos, yPos; 264 psF32 xErr, yErr; 265 266 // create a header to hold the output data 267 psMetadata *outhead = psMetadataAlloc (); 268 269 // write the links to the image header 270 psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTNAME", PS_META_REPLACE, "xsrc table extension", extname); 271 272 // let's write these out in S/N order 273 sources = psArraySort (sources, pmSourceSortBySN); 274 275 table = psArrayAllocEmpty (sources->n); 276 277 // we write out all sources, regardless of quality. the source flags tell us the state 278 for (i = 0; i < sources->n; i++) { 279 pmSource *source = (pmSource *) sources->data[i]; 280 source->seq = i; 281 282 // skip source if it is not a ext sourc 283 284 // no difference between PSF and non-PSF model 285 // XXX the PSF output should report the value for the psf, not the ext, model 286 pmModel *model = source->modelEXT; 287 if (model == NULL) continue; 288 289 PAR = model->params->data.F32; 290 dPAR = model->dparams->data.F32; 291 xPos = PAR[PM_PAR_XPOS]; 292 yPos = PAR[PM_PAR_YPOS]; 293 xErr = dPAR[PM_PAR_XPOS]; 294 yErr = dPAR[PM_PAR_YPOS]; 295 296 axes = pmPSF_ModelToAxes (PAR, 20.0); 297 298 row = psMetadataAlloc (); 299 // XXX we are not writing out the mode (flags) or the type (psf, ext, etc) 300 psMetadataAdd (row, PS_LIST_TAIL, "IPP_IDET", PS_DATA_U32, "IPP detection identifier index", source->seq); 301 psMetadataAdd (row, PS_LIST_TAIL, "X_EXT", PS_DATA_F32, "PSF x coordinate", xPos); 302 psMetadataAdd (row, PS_LIST_TAIL, "Y_EXT", PS_DATA_F32, "PSF y coordinate", yPos); 303 psMetadataAdd (row, PS_LIST_TAIL, "X_EXT_SIG", PS_DATA_F32, "Sigma in PSF x coordinate", xErr); 304 psMetadataAdd (row, PS_LIST_TAIL, "Y_EXT_SIG", PS_DATA_F32, "Sigma in PSF y coordinate", yErr); 305 psMetadataAdd (row, PS_LIST_TAIL, "EXT_INST_MAG", PS_DATA_F32, "PSF fit instrumental magnitude", PS_MIN (99.0, source->extMag)); 306 // XXX need to calculate psfMag, psfMagErr, extMag, extMagErr... 307 psMetadataAdd (row, PS_LIST_TAIL, "EXT_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", PS_MIN (99.0, source->errMag)); 308 309 // XXX these should be major and minor, not 'x' and 'y' 310 psMetadataAdd (row, PS_LIST_TAIL, "EXT_WIDTH_X", PS_DATA_F32, "PSF width in x coordinate", axes.major); 311 psMetadataAdd (row, PS_LIST_TAIL, "EXT_WIDTH_Y", PS_DATA_F32, "PSF width in y coordinate", axes.minor); 312 psMetadataAdd (row, PS_LIST_TAIL, "EXT_THETA", PS_DATA_F32, "PSF orientation angle", axes.theta); 313 314 // other values that I need to report: 315 // R, Mag Petrosian, ..... 316 317 psArrayAdd (table, 100, row); 318 psFree (row); 319 } 320 321 if (table->n == 0) { 322 psFitsWriteBlank (fits, outhead, extname); 323 psFree (table); 324 return true; 325 } 326 327 psTrace ("pmFPAfile", 5, "writing ext data %s\n", extname); 328 if (!psFitsWriteTable (fits, outhead, table, extname)) { 329 psError(PS_ERR_IO, false, "writing ext data %s\n", extname); 330 psFree(table); 331 return false; 332 } 333 psFree (table); 334 335 return true; 336 } -
trunk/psModules/src/objects/pmSourceIO_RAW.c
r14938 r15562 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $6 * @date $Date: 2007- 09-21 00:09:05$5 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-11-10 01:09:20 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 44 44 { 45 45 46 PS_ASSERT_PTR_NON_NULL(sources, false); 47 PS_ASSERT_PTR_NON_NULL(filename, false); 48 46 49 char *name = (char *) psAlloc (strlen(filename) + 10); 47 50 … … 65 68 bool pmSourcesWritePSFs (psArray *sources, char *filename) 66 69 { 70 PS_ASSERT_PTR_NON_NULL(sources, false); 71 PS_ASSERT_PTR_NON_NULL(filename, false); 67 72 68 73 double dPos; … … 124 129 bool pmSourcesWriteEXTs (psArray *sources, char *filename, bool requireEXT) 125 130 { 131 PS_ASSERT_PTR_NON_NULL(sources, false); 132 PS_ASSERT_PTR_NON_NULL(filename, false); 126 133 127 134 double dPos; … … 184 191 bool pmSourcesWriteNULLs (psArray *sources, char *filename) 185 192 { 193 PS_ASSERT_PTR_NON_NULL(sources, false); 194 PS_ASSERT_PTR_NON_NULL(filename, false); 186 195 187 196 int i; … … 230 239 bool pmMomentsWriteText (psArray *sources, char *filename) 231 240 { 241 PS_ASSERT_PTR_NON_NULL(sources, false); 242 PS_ASSERT_PTR_NON_NULL(filename, false); 232 243 233 244 int i; -
trunk/psModules/src/objects/pmSourceIO_SMPDATA.c
r14938 r15562 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $6 * @date $Date: 2007- 09-21 00:09:05$5 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-11-10 01:09:20 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 42 42 // this format consists of a header derived from the image header 43 43 // followed by a zero-size matrix, followed by the table data 44 bool pmSourcesWrite_SMPDATA (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname) 44 // XXX: input parameter imageHeader is never used 45 bool pmSourcesWrite_SMPDATA (psFits *fits, psArray *sources, psMetadata *imageHeader, 46 psMetadata *tableHeader, char *extname) 45 47 { 48 PS_ASSERT_PTR_NON_NULL(fits, false); 49 PS_ASSERT_PTR_NON_NULL(sources, false); 50 PS_ASSERT_PTR_NON_NULL(extname, false); 46 51 47 52 psArray *table; … … 126 131 psArray *pmSourcesRead_SMPDATA (psFits *fits, psMetadata *header) 127 132 { 133 PS_ASSERT_PTR_NON_NULL(fits, false); 134 PS_ASSERT_PTR_NON_NULL(header, false); 128 135 129 136 bool status; -
trunk/psModules/src/objects/pmSourceIO_SX.c
r14938 r15562 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $6 * @date $Date: 2007- 09-21 00:09:05$5 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-11-10 01:09:20 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 42 42 bool pmSourcesWriteSX (psArray *sources, char *filename) 43 43 { 44 PS_ASSERT_PTR_NON_NULL(sources, false); 45 PS_ASSERT_PTR_NON_NULL(filename, false); 44 46 45 47 psF32 *PAR, *dPAR; -
trunk/psModules/src/objects/pmSourcePhotometry.c
r15107 r15562 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1.3 6$ $Name: not supported by cvs2svn $6 * @date $Date: 2007- 09-29 03:14:55$5 * @version $Revision: 1.37 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-11-10 01:09:20 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 39 39 bool pmSourceMagnitudesInit (psMetadata *config) 40 40 { 41 41 PS_ASSERT_PTR_NON_NULL(config, false); 42 42 bool status; 43 43 … … 64 64 65 65 // XXX masked region should be (optionally) elliptical 66 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psMaskType maskVal, psMaskType mark) 67 { 66 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, 67 psMaskType maskVal, psMaskType mark) 68 { 69 PS_ASSERT_PTR_NON_NULL(source, false); 70 PS_ASSERT_PTR_NON_NULL(psf, false); 68 71 69 72 int status = false; … … 269 272 bool pmSourcePhotometryModel (float *fitMag, pmModel *model) 270 273 { 274 PS_ASSERT_PTR_NON_NULL(fitMag, false); 275 if (model == NULL) { 276 return false; 277 } 271 278 272 279 float fitSum = 0; 273 280 *fitMag = NAN; 274 275 if (model == NULL) {276 return false;277 }278 281 279 282 // measure fitMag … … 289 292 290 293 // return source aperture magnitude 291 bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask, psMaskType maskVal) 292 { 294 bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask, 295 psMaskType maskVal) 296 { 297 PS_ASSERT_PTR_NON_NULL(apMag, false); 298 PS_ASSERT_PTR_NON_NULL(image, false); 299 PS_ASSERT_PTR_NON_NULL(mask, false); 300 PS_ASSERT_PTR_NON_NULL(model, false); 301 293 302 float apSum = 0; 294 303 float sky = 0; 295 304 *apMag = NAN; 296 297 if (model == NULL) {298 psError(PM_ERR_OBJECTS, true, "Model is NULL");299 return false;300 }301 305 302 306 if (DO_SKY) { … … 327 331 328 332 // return source aperture magnitude 329 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, psMaskType maskVal) 330 { 333 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, 334 psMaskType maskVal) 335 { 336 PS_ASSERT_PTR_NON_NULL(pixWeight, false); 337 PS_ASSERT_PTR_NON_NULL(image, false); 338 PS_ASSERT_PTR_NON_NULL(mask, false); 339 PS_ASSERT_PTR_NON_NULL(model, false); 340 331 341 float modelSum = 0; 332 342 float validSum = 0; … … 339 349 340 350 *pixWeight = 0.0; 341 342 if (model == NULL)343 return false;344 351 345 352 // we only care about the value of the object model, not the local sky … … 412 419 const bool unweighted_sum) // should the cross product be weighted? 413 420 { 421 PS_ASSERT_PTR_NON_NULL(Mi, NAN); 422 PS_ASSERT_PTR_NON_NULL(Mj, NAN); 414 423 415 424 int Xs, Xe, Ys, Ye; … … 475 484 const bool unweighted_sum) // should the cross product be weighted? 476 485 { 486 PS_ASSERT_PTR_NON_NULL(Mi, NAN); 487 PS_ASSERT_PTR_NON_NULL(Mj, NAN); 477 488 478 489 int Xs, Xe, Ys, Ye; … … 538 549 const bool unweighted_sum) // should the cross product be weighted? 539 550 { 551 PS_ASSERT_PTR_NON_NULL(Mi, NAN); 540 552 double flux = 0, wt = 0, factor = 0; 541 553 … … 587 599 # endif 588 600 589 bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight, psMaskType maskVal) 590 { 601 bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight, 602 psMaskType maskVal) 603 { 604 PS_ASSERT_PTR_NON_NULL(model, false); 605 PS_ASSERT_PTR_NON_NULL(image, false); 606 PS_ASSERT_PTR_NON_NULL(mask, false); 607 PS_ASSERT_PTR_NON_NULL(weight, false); 591 608 592 609 double dC = 0.0; … … 613 630 const bool unweighted_sum) // should the cross product be weighted? 614 631 { 632 PS_ASSERT_PTR_NON_NULL(Mi, NAN); 615 633 double flux = 0, wt = 0, factor = 0; 616 634 … … 662 680 const bool unweighted_sum) // should the cross product be weighted? 663 681 { 682 PS_ASSERT_PTR_NON_NULL(Mi, NAN); 683 PS_ASSERT_PTR_NON_NULL(Mj, NAN); 664 684 int Xs, Xe, Ys, Ye; 665 685 int xi, xj, yi, yj; … … 724 744 const bool unweighted_sum) // should the cross product be weighted? 725 745 { 726 746 PS_ASSERT_PTR_NON_NULL(Mi, NAN); 747 PS_ASSERT_PTR_NON_NULL(Mj, NAN); 727 748 int Xs, Xe, Ys, Ye; 728 749 int xi, xj, yi, yj; -
trunk/psModules/src/objects/pmSourcePlotApResid.c
r14938 r15562 4 4 * @author EAM, IfA 5 5 * 6 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $7 * @date $Date: 2007- 09-21 00:09:05$6 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-11-10 01:09:20 $ 8 8 * Copyright 2006 IfA, University of Hawaii 9 9 */ … … 40 40 # include <kapa.h> 41 41 42 // plot the sx, sy, sxy as vector field, 43 // plot the PSF measured sx, sy, sxy as vector field 44 // pull the sources from the config / file? 45 bool pmSourcePlotApResid (const pmFPAview *view, pmFPAfile *file, const pmConfig *config, pmSourcePlotLayout *layout) 42 // plot the sx, sy, sxy as vector field, 43 // plot the PSF measured sx, sy, sxy as vector field 44 // pull the sources from the config / file? 45 bool pmSourcePlotApResid (const pmFPAview *view, pmFPAfile *file, const pmConfig *config, 46 pmSourcePlotLayout *layout) 46 47 { 48 PS_ASSERT_PTR_NON_NULL(view, false); 49 PS_ASSERT_PTR_NON_NULL(file, false); 50 PS_ASSERT_PTR_NON_NULL(config, false); 51 PS_ASSERT_PTR_NON_NULL(layout, false); 47 52 48 53 Graphdata graphdata; … … 150 155 # else 151 156 152 bool pmSourcePlotApResid (const pmFPAview *view, pmFPAfile *file, const pmConfig *config, pmSourcePlotLayout *layout)157 bool pmSourcePlotApResid (const pmFPAview *view, pmFPAfile *file, const pmConfig *config, pmSourcePlotLayout *layout) 153 158 { 154 159 psLogMsg ("psphot", 3, "skipping ap-mag resid plot"); -
trunk/psModules/src/objects/pmSourcePlotMoments.c
r14938 r15562 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $8 * @date $Date: 2007- 09-21 00:09:05$7 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-11-10 01:09:20 $ 9 9 * 10 10 * Copyright 2006 IfA, University of Hawaii … … 41 41 // this variable is defined in psmodules.h if ohana-config is found 42 42 # if (HAVE_KAPA) 43 # include <kapa.h>43 # include <kapa.h> 44 44 45 // plot the sx, sy moments plane (faint and bright sources) 46 bool pmSourcePlotMoments (const pmFPAview *view, pmFPAfile *file, const pmConfig *config, pmSourcePlotLayout *layout) 45 // plot the sx, sy moments plane (faint and bright sources) 46 bool pmSourcePlotMoments (const pmFPAview *view, pmFPAfile *file, const pmConfig *config, 47 pmSourcePlotLayout *layout) 47 48 { 49 PS_ASSERT_PTR_NON_NULL(view, false); 50 PS_ASSERT_PTR_NON_NULL(file, false); 51 PS_ASSERT_PTR_NON_NULL(config, false); 52 PS_ASSERT_PTR_NON_NULL(layout, false); 48 53 49 54 Graphdata graphdata; -
trunk/psModules/src/objects/pmSourcePlotPSFModel.c
r14938 r15562 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $8 * @date $Date: 2007- 09-21 00:09:05$7 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-11-10 01:09:20 $ 9 9 * 10 10 * Copyright 2006 IfA, University of Hawaii … … 41 41 // this variable is defined in psmodules.h if ohana-config is found 42 42 # if (HAVE_KAPA) 43 # include <kapa.h> 44 45 // plot the sx, sy, sxy as vector field, 46 // plot the PSF measured sx, sy, sxy as vector field 47 // pull the sources from the config / file? 48 bool pmSourcePlotPSFModel (const pmFPAview *view, pmFPAfile *file, const pmConfig *config, pmSourcePlotLayout *layout) 43 # include <kapa.h> 44 45 // plot the sx, sy, sxy as vector field, 46 // plot the PSF measured sx, sy, sxy as vector field 47 // pull the sources from the config / file? 48 bool pmSourcePlotPSFModel (const pmFPAview *view, pmFPAfile *file, const pmConfig *config, 49 pmSourcePlotLayout *layout) 49 50 { 51 PS_ASSERT_PTR_NON_NULL(view, false); 52 PS_ASSERT_PTR_NON_NULL(file, false); 53 PS_ASSERT_PTR_NON_NULL(config, false); 54 PS_ASSERT_PTR_NON_NULL(layout, false); 50 55 51 56 Graphdata graphdata; -
trunk/psModules/src/objects/pmSourcePlots.c
r13214 r15562 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $8 * @date $Date: 2007- 05-04 00:54:09$7 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-11-10 01:09:20 $ 9 9 * 10 10 * Copyright 2006 IfA, University of Hawaii … … 36 36 PS_ASSERT_PTR_NON_NULL(view, false); 37 37 PS_ASSERT_PTR_NON_NULL(file, false); 38 PS_ASSERT_PTR_NON_NULL(config, false); 38 39 39 40 if ((view->readout != -1) || (view->cell != -1)) { … … 149 150 } 150 151 152 bool psMemCheckSourcePlotLayout(psPtr ptr) 153 { 154 PS_ASSERT_PTR(ptr, false); 155 return ( psMemGetDeallocator(ptr) == (psFreeFunc) pmSourcePlotLayoutFree); 156 } 157 158 151 159 /* we have three types of plots to produce (maybe more?) 152 160 * for each plot, we need to supply the following information: -
trunk/psModules/src/objects/pmSourcePlots.h
r13214 r15562 4 4 * @author EAM, IfA 5 5 * 6 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $7 * @date $Date: 2007- 05-04 00:54:09$6 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-11-10 01:09:20 $ 8 8 * Copyright 2006 Institute for Astronomy, University of Hawaii 9 9 */ … … 30 30 31 31 pmSourcePlotLayout *pmSourcePlotLayoutAlloc(); 32 bool psMemCheckSourcePlotLayout(psPtr ptr); 32 33 33 34 bool pmFPAviewWriteSourcePlot(const pmFPAview *view, pmFPAfile *file, const pmConfig *config); -
trunk/psModules/src/objects/pmSourceUtils.c
r14938 r15562 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2007- 09-21 00:09:05$8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-11-10 01:09:20 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 63 63 } 64 64 65 pmSource *pmSourceFromModel (pmModel *model, pmReadout *readout, float radius, pmSourceType type) { 65 pmSource *pmSourceFromModel (pmModel *model, pmReadout *readout, float radius, 66 pmSourceType type) 67 { 68 PS_ASSERT_PTR_NON_NULL(model, NULL); 69 PS_ASSERT_PTR_NON_NULL(readout, NULL); 66 70 67 71 pmSource *source = pmSourceAlloc (); -
trunk/psModules/src/objects/pmTrend2D.c
r15417 r15562 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-10-30 00:50:00 $ 7 * 5 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-11-10 01:09:20 $ 8 7 * Copyright 2004 Institute for Astronomy, University of Hawaii 9 8 * -
trunk/psModules/src/objects/pmTrend2D.h
r15000 r15562 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $8 * @date $Date: 2007- 09-24 21:27:58$7 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-11-10 01:09:20 $ 9 9 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 10 10 */ … … 34 34 pmTrend2D *pmTrend2DAlloc (pmTrend2DMode mode, psImage *image, int nXtrend, int nYtrend, psStats *stats); 35 35 36 bool psMemCheckTrend2D(psPtr ptr); 37 36 38 pmTrend2D *pmTrend2DNoImageAlloc (pmTrend2DMode mode, psImageBinning *binning, psStats *stats); 37 39 -
trunk/psastro/src/Makefile.am
r12806 r15562 33 33 psastroLuminosityFunction.c \ 34 34 psastroRefstarSubset.c \ 35 psastroEnforceChips.c \ 35 36 psastroMosaicAstrom.c \ 36 37 psastroMosaicGradients.c \ -
trunk/psastro/src/psastro.h
r15195 r15562 27 27 bool psastroDataSave (pmConfig *config); 28 28 bool psastroDefineFiles (pmConfig *config, pmFPAfile *input); 29 bool psastroDefineFile (pmConfig *config, pmFPA *input, char *filerule, char *argname, pmFPAfileType fileType, pmDetrendType detrendType); 29 30 bool psastroAnalysis (pmConfig *config); 30 31 … … 74 75 bool psastroDumpStars (psArray *stars, char *filename); 75 76 bool psastroDumpMatchedStars (char *filename, psArray *rawstars, psArray *refstars, psArray *match); 77 bool psastroDumpGradients (psArray *gradients, char *filename); 76 78 77 79 bool psastroMosaicSetAstrom_tmp (pmFPA *fpa); 78 80 int psastroSortByMag (const void *a, const void *b); 79 81 82 bool psastroEnforceChips (pmConfig *config, pmFPA *fpa, psMetadata *recipe); 83 84 psArray *psastroReadGetstarCatalog (psFits *fits); 85 psArray *psastroReadGetstar_PS1_DEV_0 (psFits *fits); 86 80 87 # endif /* PSASTRO_H */ -
trunk/psastro/src/psastroAnalysis.c
r15245 r15562 16 16 return true; 17 17 } 18 19 // XXX test retrun20 // return true;21 18 22 19 // load the reference stars overlapping the data stars -
trunk/psastro/src/psastroArguments.c
r12992 r15562 36 36 psMetadataAddStr (config->arguments, PS_LIST_TAIL, "CHIP_SELECTIONS", PS_META_REPLACE, "", argv[N]); 37 37 psArgumentRemove (N, &argc, argv); 38 } 39 40 // apply the chip correction based on the reference astrometry? 41 if ((N = psArgumentGet (argc, argv, "-fixchips"))) { 42 psArgumentRemove (N, &argc, argv); 43 psMetadataAddBool (config->arguments, PS_LIST_TAIL, "PSASTRO.FIX.CHIPS", PS_META_REPLACE, "", true); 44 } 45 // define the reference astrometry file 46 status = pmConfigFileSetsMD (config->arguments, &argc, argv, "REF.ASTROM", "-refastrom", "-refastromlist"); 47 if (status) { 48 // if supplied, assume -fixchips is desired 49 psMetadataAddBool (config->arguments, PS_LIST_TAIL, "PSASTRO.FIX.CHIPS", PS_META_REPLACE, "", true); 38 50 } 39 51 -
trunk/psastro/src/psastroDefineFiles.c
r14212 r15562 4 4 5 5 // these calls bind the I/O handle to the specified fpa 6 pmFPAfile *output = NULL;6 bool status; 7 7 8 output = pmFPAfileDefineOutput (config, input->fpa, "PSASTRO.OUTPUT"); 8 // select the current recipe 9 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSASTRO_RECIPE); 10 if (!recipe) { 11 psError(PSASTRO_ERR_CONFIG, false, "Can't find PSASTRO recipe!\n"); 12 return false; 13 } 14 15 pmFPAfile *output = pmFPAfileDefineOutput (config, input->fpa, "PSASTRO.OUTPUT"); 9 16 if (!output) { 10 17 psError(PSASTRO_ERR_CONFIG, false, "Failed to build FPA from PSASTRO.INPUT"); … … 12 19 } 13 20 output->save = true; 21 22 bool fixChips = psMetadataLookupBool (&status, recipe, "PSASTRO.FIX.CHIPS"); 23 24 if (fixChips) { 25 if (!psastroDefineFile (config, input->fpa, "PSASTRO.REF.ASTROM", "REF.ASTROM", PM_FPA_FILE_ASTROM, PM_DETREND_TYPE_ASTROM)) { 26 psError (PS_ERR_IO, false, "Can't find a reference astrometry file"); 27 return NULL; 28 } 29 } 14 30 15 31 # if (0) … … 25 41 return true; 26 42 } 43 44 bool psastroDefineFile (pmConfig *config, pmFPA *input, char *filerule, char *argname, pmFPAfileType fileType, pmDetrendType detrendType) { 45 46 bool status; 47 pmFPAfile *file; 48 49 // look for the file on the argument list 50 file = pmFPAfileDefineFromArgs (&status, config, filerule, argname); 51 if (!status) { 52 psError (PS_ERR_UNKNOWN, false, "failed to load find definition"); 53 return false; 54 } 55 if (file) { 56 if (file->type != fileType) { 57 psError(PS_ERR_IO, true, "%s is not of type %s", filerule, pmFPAfileStringFromType (fileType)); 58 return false; 59 } 60 return true; 61 } 62 63 // look for the file in the camera config table 64 file = pmFPAfileDefineFromConf (&status, config, filerule); 65 if (!status) { 66 psError (PS_ERR_UNKNOWN, false, "failed to load find definition"); 67 return false; 68 } 69 if (file) { 70 if (file->type != fileType) { 71 psError(PS_ERR_IO, true, "%s is not of type %s", filerule, pmFPAfileStringFromType (fileType)); 72 return false; 73 } 74 return true; 75 } 76 77 // look for the file to be loaded from the detrend database 78 file = pmFPAfileDefineFromDetDB (&status, config, filerule, input, detrendType); 79 if (!status) { 80 psError (PS_ERR_UNKNOWN, false, "failed to load file definition"); 81 return false; 82 } 83 if (file) { 84 if (file->type != fileType) { 85 psError(PS_ERR_IO, true, "%s is not of type %s", filerule, pmFPAfileStringFromType (fileType)); 86 return false; 87 } 88 return true; 89 } 90 return false; 91 } 92 -
trunk/psastro/src/psastroDemoDump.c
r15199 r15562 173 173 return true; 174 174 } 175 176 // this function is used for test purposes (-trace psastro.dump 1) 177 bool psastroDumpGradients (psArray *gradients, char *filename) { 178 179 FILE *f = fopen (filename, "w"); 180 181 for (int i = 0; i < gradients->n; i++) { 182 pmAstromGradient *gradient = gradients->data[i]; 183 184 // write out the refstar data 185 fprintf (f, "%d %f %f %f %f %f %f\n", i, 186 gradient->FP.x, gradient->FP.y, 187 gradient->dTPdL.x, gradient->dTPdL.y, 188 gradient->dTPdM.x, gradient->dTPdM.y); 189 } 190 191 fclose (f); 192 return true; 193 } 194 -
trunk/psastro/src/psastroLoadRefstars.c
r15538 r15562 15 15 float DECmin = DEG_RAD*psMetadataLookupF32(NULL, recipe, "DEC_MIN"); 16 16 float DECmax = DEG_RAD*psMetadataLookupF32(NULL, recipe, "DEC_MAX"); 17 // float MAGmax = psMetadataLookupF32(NULL, recipe, "MAG_MAX");18 17 19 18 // XXX CATDIR needs to look up abstracted name from psastro.config … … 25 24 char *getstarCommand = psStringCopy(psMetadataLookupStr(NULL, recipe, "DVO.GETSTAR")); 26 25 PS_ASSERT (getstarCommand, NULL); 26 27 char *outformat = psMetadataLookupStr(NULL, recipe, "DVO.GETSTAR.OUTFORMAT"); 28 PS_ASSERT (outformat, NULL); 29 30 char *photcode = psMetadataLookupStr(NULL, recipe, "DVO.GETSTAR.PHOTCODE"); 31 PS_ASSERT (photcode, NULL); 32 33 float MAGmax = psMetadataLookupF32(NULL, recipe, "DVO.GETSTAR.MAG.MAX"); 27 34 28 35 // issue the following command: … … 39 46 psTimerStart ("psastro"); 40 47 41 // use fork to add timeout capability48 // supply a known output format (for CATALOG output) so the code below knows what to read 42 49 if (ELIXIR_MODE) { 43 psStringAppend (&getstarCommand, " -D CAT FORMAT elixir");50 psStringAppend (&getstarCommand, " -D CATMODE mef -D CATFORMAT elixir"); 44 51 } else { 45 psStringAppend (&getstarCommand, " -D CAT FORMAT panstarrs");52 psStringAppend (&getstarCommand, " -D CATMODE mef -D CATFORMAT panstarrs"); 46 53 } 47 54 … … 52 59 psFree(CATDIR); 53 60 54 // psStringAppend (&getstarCommand, " -D CATMODE mef -maglim %f -region %f %f %f %f -o %s", MAGmax, RAmin, DECmin, RAmax, DECmax, tempFile); 55 // XXX TEST : no magnitude limit 56 // XXX need to specify the desired photometry system 57 psStringAppend (&getstarCommand, " -D CATMODE mef -region %f %f %f %f -o %s", RAmin, DECmin, RAmax, DECmax, tempFile); 61 // supply the max magnitude, the output format, and the photcode 62 psStringAppend (&getstarCommand, " -maglim %f -format %s -photcode %s", MAGmax, outformat, photcode); 63 64 // add region and output filename 65 psStringAppend (&getstarCommand, " -region %f %f %f %f -o %s", RAmin, DECmin, RAmax, DECmax, tempFile); 58 66 psTrace ("psastro", 3, "%s\n", getstarCommand); 59 67 60 68 // XXX use psPipe: catch stderr, stdout, allow for Nsec timeout... 69 // use fork to add timeout capability 61 70 status = system (getstarCommand); 62 71 if (status) { … … 71 80 psFits *fits = psFitsOpen (tempFile, "r"); 72 81 82 psTimerStart ("psastro"); 83 84 psArray *refstars = NULL; 85 if (!strcmp (outformat, "CATALOG")) { 86 refstars = psastroReadGetstarCatalog (fits); 87 } 88 if (!strcmp (outformat, "PS1_DEV_0")) { 89 refstars = psastroReadGetstar_PS1_DEV_0 (fits); 90 } 91 if (refstars == NULL) { 92 psError(PSASTRO_ERR_REFSTARS, true, "error reading reference data\n"); 93 return NULL; 94 } 95 psLogMsg ("psastro", 3, "loaded %ld reference stars : %f sec\n", refstars->n, psTimerMark ("psastro")); 96 97 psTrace ("psastro", 3, "loaded %ld reference stars from (%10.6f,%10.6f) - (%10.6f,%10.6f)\n", 98 refstars->n, RAmin, DECmin, RAmax, DECmax); 99 100 psFitsClose (fits); 101 unlink (tempFile); 102 103 // dump or plot the available refstars 104 if (psTraceGetLevel("psastro.dump") > 0) { 105 psastroDumpRefstars (refstars, "refstars.dat"); 106 } 107 108 if (psTraceGetLevel("psastro.plot") > 0) { 109 psastroPlotRefstars (refstars, recipe); 110 } 111 112 return refstars; 113 } 114 115 psArray *psastroReadGetstarCatalog (psFits *fits) { 116 117 bool status; 118 73 119 if (ELIXIR_MODE) { 74 120 psFitsMoveExtName (fits, "DVO_AVERAGE_ELIXIR"); … … 77 123 } 78 124 79 psTimerStart ("psastro");80 125 long numSources = psFitsTableSize(fits); // Number of sources in table 81 126 … … 102 147 psFree (row); 103 148 } 104 psLogMsg ("psastro", 3, "loaded %ld reference stars : %f sec\n", refstars->n, psTimerMark ("psastro"));105 106 psTrace ("psastro", 3, "loaded %ld reference stars from (%10.6f,%10.6f) - (%10.6f,%10.6f)\n",107 refstars->n, RAmin, DECmin, RAmax, DECmax);108 109 psFitsClose (fits);110 unlink (tempFile);111 112 // dump or plot the available refstars113 if (psTraceGetLevel("psastro.dump") > 0) {114 psastroDumpRefstars (refstars, "refstars.dat");115 }116 117 if (psTraceGetLevel("psastro.plot") > 0) {118 psastroPlotRefstars (refstars, recipe);119 }120 121 149 return refstars; 122 150 } 151 152 psArray *psastroReadGetstar_PS1_DEV_0 (psFits *fits) { 153 154 bool status; 155 156 psFitsMoveExtName (fits, "GETSTAR_PS1_DEV_0"); 157 158 long numSources = psFitsTableSize(fits); // Number of sources in table 159 160 // convert the Average table to the pmAstromObj entries 161 psArray *refstars = psArrayAllocEmpty (numSources); 162 for (int i = 0; i < numSources; i++) { 163 pmAstromObj *ref = pmAstromObjAlloc (); 164 165 psMetadata *row = psFitsReadTableRow(fits, i); // Table row 166 167 ref->sky->r = RAD_DEG*psMetadataLookupF32 (&status, row, "RA"); 168 ref->sky->d = RAD_DEG*psMetadataLookupF32 (&status, row, "DEC"); 169 ref->Mag = psMetadataLookupS32 (&status, row, "MAG"); 170 171 psArrayAdd (refstars, 100, ref); 172 psFree (ref); 173 psFree (row); 174 } 175 return refstars; 176 } -
trunk/psastro/src/psastroMosaicAstrom.c
r15260 r15562 21 21 pmFPA *fpa = input->fpa; 22 22 23 // XXX before we do object matches, we need to fix failed chips 24 // compare chips with supplied mosaic model 25 // adjust significant outliers to match model 23 // before we do object matches, we need to (optionally) fix failed chips. We compare chips with 24 // the supplied mosaic model. Adjust significant outliers to match model. 25 if (!psastroEnforceChips (config, fpa, recipe)) { 26 psError(PSASTRO_ERR_UNKNOWN, false, "failed to align problematic chips"); 27 return false; 28 } 26 29 27 30 // given the existing per-chip astrometry, determine matches between raw and ref stars -
trunk/psastro/src/psastroMosaicGradients.c
r15258 r15562 1 1 # include "psastroInternal.h" 2 static int nPass = 0; 2 3 3 4 bool psastroMosaicGradients (pmFPA *fpa, psMetadata *recipe) { … … 50 51 } 51 52 53 // if desired, dump the gradients to a file 54 if (psTraceGetLevel("psastro.dump") > 0) { 55 char name[80]; 56 sprintf (name, "gradients.%d.dat", nPass); 57 psastroDumpGradients (gradients, name); 58 nPass ++; 59 } 60 52 61 // allocate mosaic-level polynomial transformation and set masks needed by DVO 53 62 int order = psMetadataLookupF32 (&status, recipe, "PSASTRO.MOSAIC.ORDER"); -
trunk/psastro/src/psastroMosaicOneChip.c
r15259 r15562 55 55 return false; 56 56 } 57 58 psLogMsg ("psastro", PS_LOG_DETAIL, "mosaic fit chip order %d", order); 57 59 58 60 // create output toFPA; set masks appropriate to the Elixir DVO astrometry format if we are -
trunk/psastro/src/psastroMosaicSetMatch.c
r12806 r15562 15 15 if (!status) { 16 16 psError(PS_ERR_IO, false, "Failed to lookup matching radius: %s", radiusWord); 17 return NULL;17 return false; 18 18 } 19 20 if (RADIUS <= 0.0) { 21 if (iteration == 0) { 22 psError(PS_ERR_IO, false, "Invalid match radius for first iteration: %s", radiusWord); 23 return false; 24 } 25 psWarning ("skipping match for iteration %d\n", iteration); 26 return true; 27 } 19 28 20 29 // this loop selects the matched stars for all chips -
trunk/psphot/src/Makefile.am
r15040 r15562 47 47 psphotModelWithPSF.c \ 48 48 psphotExtendedSources.c \ 49 psphotRadialProfile.c \ 49 50 psphotPetrosian.c \ 50 51 psphotIsophotal.c \ -
trunk/psphot/src/psphot.h
r15040 r15562 116 116 psKernel *psphotKernelFromPSF (pmSource *source, int nPix); 117 117 118 bool psphotRadialProfile (pmSource *source, psMetadata *recipe, psMaskType maskVal); 118 119 bool psphotPetrosian (pmSource *source, psMetadata *recipe, psMaskType maskVal); 119 120 bool psphotIsophotal (pmSource *source, psMetadata *recipe, psMaskType maskVal); -
trunk/psphot/src/psphotAnnuli.c
r13983 r15562 3 3 bool psphotAnnuli (pmSource *source, psMetadata *recipe, psMaskType maskVal) { 4 4 5 psLogMsg ("psphot", PS_LOG_INFO, "not implemented\n"); 5 assert (source->extpars); 6 assert (source->extpars->profile); 7 assert (source->extpars->profile->radius); 8 assert (source->extpars->profile->flux); 9 10 bool status; 11 12 psVector *radius = source->extpars->profile->radius; 13 psVector *weight = source->extpars->profile->weight; 14 psVector *flux = source->extpars->profile->flux; 15 16 // XXX how do I define the radii? we can put a vector in the recipe... 17 // radialBins defines the bounds or start and stop (we can skip some that way... 18 psVector *radialBinsLower = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.LOWER"); 19 psVector *radialBinsUpper = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.UPPER"); 20 assert (radialBinsLower->n == radialBinsUpper->n); 21 22 psVector *fluxValues = psVectorAlloc (radialBinsLower->n, PS_TYPE_F32); 23 psVector *fluxSquare = psVectorAlloc (radialBinsLower->n, PS_TYPE_F32); 24 psVector *fluxWeight = psVectorAlloc (radialBinsLower->n, PS_TYPE_F32); 25 psVector *pixelCount = psVectorAlloc (radialBinsLower->n, PS_TYPE_F32); 26 psVectorInit (fluxValues, 0.0); 27 psVectorInit (fluxSquare, 0.0); 28 psVectorInit (fluxWeight, 0.0); 29 psVectorInit (pixelCount, 0.0); 30 31 // XXX this code assumes the radii are in pixels. convert from arcsec with plate scale 32 // XXX assume the annulii above are not overlapping? much faster... 33 // XXX this might be must faster in the reverse order: loop over annulii and use disection to 34 // skip to the start of the annulus. 35 for (int i = 0; i < flux->n; i++) { 36 for (int j = 0; j < radialBinsLower->n; j++) { 37 if (radius->data.F32[i] < radialBinsLower->data.F32[j]) continue; 38 if (radius->data.F32[i] > radialBinsUpper->data.F32[j]) continue; 39 fluxValues->data.F32[j] += flux->data.F32[i]; 40 fluxSquare->data.F32[j] += PS_SQR(flux->data.F32[i]); 41 fluxWeight->data.F32[j] += weight->data.F32[i]; 42 pixelCount->data.F32[j] += 1.0; 43 } 44 } 45 46 for (int j = 0; j < radialBinsLower->n; j++) { 47 fluxValues->data.F32[j] /= pixelCount->data.F32[j]; 48 fluxSquare->data.F32[j] /= pixelCount->data.F32[j]; 49 fluxSquare->data.F32[j] -= PS_SQR(fluxValues->data.F32[j]); 50 } 51 52 source->extpars->annuli = pmSourceAnnuliAlloc (); 53 source->extpars->annuli->flux = fluxValues; 54 source->extpars->annuli->fluxErr = fluxWeight; 55 source->extpars->annuli->fluxVar = fluxSquare; 56 6 57 return true; 58 } 7 59 8 } -
trunk/psphot/src/psphotExtendedSources.c
r13983 r15562 66 66 return false; 67 67 } else { 68 // XXX why am I caching the model? 68 69 pmSourceCacheModel (source, maskVal); // XXX put this in the source model function? 69 70 psTrace ("psphot", 5, "psf-convolved model for source at %7.1f, %7.1f", source->moments->x, source->moments->y); 70 71 Npsf ++; 72 } 73 74 // all of these below require the radial profile 75 // XXX push this as a test and call in each of the functions below? 76 // XXX this constructs a pmSourceExtendedParameters element 77 if (doPetrosian || doIsophotal || doAnnuli || doKron) { 78 if (!psphotRadialProfile (source, recipe, maskVal)) { 79 psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate radial profile"); 80 return false; 81 } 71 82 } 72 83 -
trunk/psphot/src/psphotIsophotal.c
r13983 r15562 3 3 bool psphotIsophotal (pmSource *source, psMetadata *recipe, psMaskType maskVal) { 4 4 5 psLogMsg ("psphot", PS_LOG_INFO, "not implemented\n"); 5 assert (source->extpars); 6 assert (source->extpars->profile); 7 assert (source->extpars->profile->radius); 8 assert (source->extpars->profile->flux); 9 10 bool status; 11 12 psVector *radius = source->extpars->profile->radius; 13 psVector *flux = source->extpars->profile->flux; 14 15 // flux at which to measure isophotal parameters 16 // XXX cache this? 17 float ISOPHOT_FLUX = psMetadataLookupF32 (&status, recipe, "ISOPHOTAL_FLUX"); 18 19 // find the first bin below the flux level and the last above the level 20 // XXX can this be done faster with disection? 21 // XXX do I need to worry about crazy outliers? 22 // XXX should i be smoothing or fitting the curve? 23 int firstBelow = -1; 24 int lastAbove = -1; 25 for (int i = 0; i < flux->n; i++) { 26 if (flux->data.F32[i] > ISOPHOT_FLUX) lastAbove = i; 27 if ((firstBelow < 0) && (flux->data.F32[i] < ISOPHOT_FLUX)) firstBelow = i; 28 } 29 30 // need to examine pixels in this vicinity 31 float isophotalFluxFirst = 0; 32 float isophotalFluxLast = 0; 33 for (int i = 0; i <= PS_MAX(firstBelow, lastAbove); i++) { 34 if (i <= firstBelow) { 35 isophotalFluxFirst += flux->data.F32[i]; 36 } 37 if (i <= lastAbove) { 38 isophotalFluxLast += flux->data.F32[i]; 39 } 40 } 41 float isophotalFlux = 0.5*(isophotalFluxLast + isophotalFluxFirst); 42 float isophotalFluxErr = 0.5*fabs(isophotalFluxLast - isophotalFluxFirst); 43 44 float isophotalRad = 0.5*(radius->data.F32[firstBelow] + radius->data.F32[lastAbove]); 45 float isophotalRadErr = 0.5*fabs(radius->data.F32[firstBelow] - radius->data.F32[lastAbove]); 46 47 if (!source->extpars->isophot) { 48 source->extpars->isophot = pmSourceIsophotalValuesAlloc (); 49 } 50 51 // these are uncalibrated: instrumental mags and pixel units 52 source->extpars->isophot->mag = -2.5*log10(isophotalFlux); 53 source->extpars->isophot->magErr = isophotalFluxErr / isophotalFlux; 54 55 source->extpars->isophot->rad = isophotalRad; 56 source->extpars->isophot->radErr = isophotalRadErr; 57 6 58 return true; 7 59 -
trunk/psphot/src/psphotMakeResiduals.c
r14967 r15562 28 28 29 29 float nSigma = psMetadataLookupF32(&status, recipe, "PSF.RESIDUALS.NSIGMA"); 30 PS_ASSERT (status, false); 31 32 float pixelSN = psMetadataLookupF32(&status, recipe, "PSF.RESIDUALS.PIX.SN"); 30 33 PS_ASSERT (status, false); 31 34 … … 194 197 resid->Rx->data.F32[oy][ox] = resid->Ry->data.F32[oy][ox] = 0.0; 195 198 //resid->weight->data.F32[oy][ox] = fluxStats->sampleStdev; 199 200 if (resid->Ro->data.F32[oy][ox] < pixelSN*fluxStats->sampleStdev) { 201 resid->mask->data.U8[oy][ox] = 1; 202 } 203 196 204 } else { 197 205 assert (SPATIAL_ORDER == 1); … … 227 235 resid->Rx->data.F32[oy][ox] = B->data.F64[1]; 228 236 resid->Ry->data.F32[oy][ox] = B->data.F64[2]; 237 238 float dRo = sqrt(A->data.F32[0][0]); 239 if (resid->Ro->data.F32[oy][ox] < pixelSN*dRo) { 240 resid->mask->data.U8[oy][ox] = 1; 241 } 229 242 //resid->weight->data.F32[oy][ox] = XXX; 230 243 } -
trunk/psphot/src/psphotPetrosian.c
r13983 r15562 3 3 bool psphotPetrosian (pmSource *source, psMetadata *recipe, psMaskType maskVal) { 4 4 5 psLogMsg ("psphot", PS_LOG_INFO, "not implemented\n"); 5 bool status; 6 7 assert (source->extpars); 8 assert (source->extpars->profile); 9 assert (source->extpars->profile->radius); 10 assert (source->extpars->profile->flux); 11 12 psVector *radius = source->extpars->profile->radius; 13 psVector *flux = source->extpars->profile->flux; 14 15 // flux at which to measure isophotal parameters 16 // XXX cache this? 17 float PETROSIAN_R0 = psMetadataLookupF32 (&status, recipe, "PETROSIAN_R0"); 18 float PETROSIAN_RF = psMetadataLookupF32 (&status, recipe, "PETROSIAN_FLUX_RATIO"); 19 20 // first find flux at R0 21 int firstBelow = -1; 22 int lastAbove = -1; 23 for (int i = 0; i < radius->n; i++) { 24 if (radius->data.F32[i] > PETROSIAN_R0) lastAbove = i; 25 if ((firstBelow < 0) && (flux->data.F32[i] < PETROSIAN_R0)) firstBelow = i; 26 } 27 28 // average flux in this range 29 float fluxR0 = 0.0; 30 int fluxRn = 0; 31 for (int i = PS_MIN(firstBelow, lastAbove); i <= PS_MAX(firstBelow, lastAbove); i++) { 32 fluxR0 += flux->data.F32[i]; 33 fluxRn ++; 34 } 35 fluxR0 /= (float)(fluxRn); 36 37 // target flux for petrosian radius 38 float fluxRP = fluxR0 * PETROSIAN_RF; 39 40 // find the first bin below the flux level and the last above the level 41 // XXX can this be done faster with disection? 42 // XXX do I need to worry about crazy outliers? 43 // XXX should i be smoothing or fitting the curve? 44 firstBelow = -1; 45 lastAbove = -1; 46 for (int i = 0; i < flux->n; i++) { 47 if (flux->data.F32[i] > fluxRP) lastAbove = i; 48 if ((firstBelow < 0) && (flux->data.F32[i] < fluxRP)) firstBelow = i; 49 } 50 51 // need to examine pixels in this vicinity 52 float fluxFirst = 0; 53 float fluxLast = 0; 54 for (int i = 0; i <= PS_MAX(firstBelow, lastAbove); i++) { 55 if (i <= firstBelow) { 56 fluxFirst += flux->data.F32[i]; 57 } 58 if (i <= lastAbove) { 59 fluxLast += flux->data.F32[i]; 60 } 61 } 62 float fluxRPSum = 0.5*(fluxLast + fluxFirst); 63 float fluxRPSumErr = 0.5*fabs(fluxLast - fluxFirst); 64 // XXX need to use the weight appropriately here... 65 66 float rad = 0.5*(radius->data.F32[firstBelow] + radius->data.F32[lastAbove]); 67 float radErr = 0.5*fabs(radius->data.F32[firstBelow] - radius->data.F32[lastAbove]); 68 69 if (!source->extpars->petrosian) { 70 source->extpars->petrosian = pmSourcePetrosianValuesAlloc (); 71 } 72 73 // these are uncalibrated: instrumental mags and pixel units 74 source->extpars->petrosian->mag = -2.5*log10(fluxRPSum); 75 source->extpars->petrosian->magErr = fluxRPSumErr / fluxRPSum; 76 77 source->extpars->petrosian->rad = rad; 78 source->extpars->petrosian->radErr = radErr; 79 6 80 return true; 7 81 -
trunk/psphot/src/psphotRadialProfile.c
r15357 r15562 5 5 // allocate pmSourceExtendedParameters, if not already defined 6 6 if (!source->extpars) { 7 source->extpars = pmSourceExtendedPar ametersAlloc ();7 source->extpars = pmSourceExtendedParsAlloc (); 8 8 } 9 9 10 10 if (!source->extpars->profile) { 11 source->extpars->profile = pmSourceRadialProfile ();11 source->extpars->profile = pmSourceRadialProfileAlloc (); 12 12 } 13 13 … … 19 19 psVector *radius = source->extpars->profile->radius; 20 20 psVector *flux = source->extpars->profile->flux; 21 psVector *weight = source->extpars->profile-> radius;21 psVector *weight = source->extpars->profile->weight; 22 22 23 23 // XXX use the extended source model here for Xo, Yo? … … 40 40 flux->n = n; 41 41 42 SortVectorsByRadius (radius, flux, weight); 42 // XXX need to sort here 43 // SortVectorsByRadius (radius, flux, weight); 43 44 44 45 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
