Changeset 5049
- Timestamp:
- Sep 13, 2005, 4:06:55 PM (21 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 17 edited
-
pmObjects_EAM.c (modified) (13 diffs)
-
pmObjects_EAM.h (modified) (2 diffs)
-
pmPeaksSigmaLimit.c (modified) (1 diff)
-
psImageData.c (modified) (2 diffs)
-
psLibUtils.h (modified) (1 diff)
-
psMinimize.c (modified) (15 diffs)
-
psphot.c (modified) (2 diffs)
-
psphot.h (modified) (2 diffs)
-
psphotApplyPSF.c (modified) (2 diffs)
-
psphotArguments.c (modified) (4 diffs)
-
psphotDefinePixels.c (modified) (2 diffs)
-
psphotFitGalaxies.c (modified) (2 diffs)
-
psphotImageStats.c (modified) (1 diff)
-
psphotOutput.c (modified) (6 diffs)
-
psphotSetup.c (modified) (3 diffs)
-
psphotSourceStats.c (modified) (2 diffs)
-
psphotSubtractPSF.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/pmObjects_EAM.c
r5048 r5049 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-09-14 0 1:35:20$8 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-09-14 02:06:55 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 102 102 psFree(tmp->peak); 103 103 psFree(tmp->pixels); 104 psFree(tmp-> noise);104 psFree(tmp->weight); 105 105 psFree(tmp->mask); 106 106 psFree(tmp->moments); … … 118 118 tmp->peak = NULL; 119 119 tmp->pixels = NULL; 120 tmp-> noise= NULL;120 tmp->weight = NULL; 121 121 tmp->mask = NULL; 122 122 tmp->moments = NULL; … … 662 662 pmSource->peak 663 663 pmSource->pixels 664 pmSource-> noise664 pmSource->weight 665 665 pmSource->mask 666 666 … … 678 678 // PS_PTR_CHECK_NULL(source->peak, NULL); 679 679 // PS_PTR_CHECK_NULL(source->pixels, NULL); 680 // PS_PTR_CHECK_NULL(source-> noise, NULL);680 // PS_PTR_CHECK_NULL(source->weight, NULL); 681 681 PS_FLOAT_COMPARE(0.0, radius, NULL); 682 682 … … 736 736 // XXX EAM : check for valid S/N in pixel 737 737 // XXX EAM : should this limit be user-defined? 738 if (pDiff / sqrt(source-> noise->data.F32[row][col]) < 1) continue;738 if (pDiff / sqrt(source->weight->data.F32[row][col]) < 1) continue; 739 739 740 740 Sum += pDiff; … … 1461 1461 PS_ASSERT_PTR_NON_NULL(source->pixels, false); 1462 1462 PS_ASSERT_PTR_NON_NULL(source->mask, false); 1463 PS_ASSERT_PTR_NON_NULL(source-> noise, false);1463 PS_ASSERT_PTR_NON_NULL(source->weight, false); 1464 1464 psBool fitStatus = true; 1465 1465 psBool onPic = true; 1466 1466 psBool rc = true; 1467 1467 1468 // XXX EAM : is it necessary for the mask & noiseto exist? the1468 // XXX EAM : is it necessary for the mask & weight to exist? the 1469 1469 // tests below could be conditions (!NULL) 1470 1470 … … 1508 1508 x->data[tmpCnt] = (psPtr *) coord; 1509 1509 y->data.F32[tmpCnt] = source->pixels->data.F32[i][j]; 1510 yErr->data.F32[tmpCnt] = sqrt (source-> noise->data.F32[i][j]);1510 yErr->data.F32[tmpCnt] = sqrt (source->weight->data.F32[i][j]); 1511 1511 // XXX EAM : note the wasted effort: we carry dY^2, take sqrt(), then 1512 1512 // the minimization function calculates sq() … … 1576 1576 } 1577 1577 1578 // XXX EAM : new version with parameter range limits and noiseenhancement1578 // XXX EAM : new version with parameter range limits and weight enhancement 1579 1579 bool pmSourceFitModel (pmSource *source, 1580 1580 pmModel *model, … … 1586 1586 PS_ASSERT_PTR_NON_NULL(source->pixels, false); 1587 1587 PS_ASSERT_PTR_NON_NULL(source->mask, false); 1588 PS_ASSERT_PTR_NON_NULL(source-> noise, false);1589 1590 // XXX EAM : is it necessary for the mask & noiseto exist? the1588 PS_ASSERT_PTR_NON_NULL(source->weight, false); 1589 1590 // XXX EAM : is it necessary for the mask & weight to exist? the 1591 1591 // tests below could be conditions (!NULL) 1592 1592 … … 1602 1602 pmModelFunc modelFunc = pmModelFunc_GetFunction (model->type); 1603 1603 1604 // XXX EAM : I need to use the sky value to constrain the noisemodel1604 // XXX EAM : I need to use the sky value to constrain the weight model 1605 1605 int nParams = PSF ? params->n - 4 : params->n; 1606 1606 psF32 So = params->data.F32[0]; … … 1641 1641 ymodel = modelFunc (NULL, model->params, coord); 1642 1642 1643 // this test enhances the noisebased on deviation from the model flux1643 // this test enhances the weight based on deviation from the model flux 1644 1644 Ro = 1.0 + fabs (y->data.F32[tmpCnt] - ymodel) / sqrt(PS_SQR(ymodel - So) + PS_SQR(So)); 1645 1645 1646 // XXX EAM : note the wasted effort: we carry dY^2, take sqrt(), then 1647 // the minimization function calculates sq(). 1648 // should psMinimizeLMChi2 take dY^2? 1649 yErr->data.F32[tmpCnt] = sqrt (source->noise->data.F32[i][j] * Ro); 1646 // psMinimizeLMChi2_EAM takes wt = 1/dY^2 1647 if (source->weight->data.F32[i][j] == 0) { 1648 yErr->data.F32[tmpCnt] = 0.0; 1649 } else { 1650 yErr->data.F32[tmpCnt] = 1.0 / (source->weight->data.F32[i][j] * Ro); 1651 } 1650 1652 tmpCnt++; 1651 1653 } … … 1708 1710 if (paramMask != NULL) { 1709 1711 psVector *delta = psVectorAlloc (params->n, PS_TYPE_F64); 1710 psMinimizeGaussNewtonDelta (delta, params, NULL, x, y, yErr, modelFunc);1712 psMinimizeGaussNewtonDelta_EAM (delta, params, NULL, x, y, yErr, modelFunc); 1711 1713 for (int i = 0; i < dparams->n; i++) { 1712 1714 if (!paramMask->data.U8[i]) continue; -
trunk/psphot/src/pmObjects_EAM.h
r5048 r5049 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $8 * @date $Date: 2005-09-14 0 1:35:20$7 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-09-14 02:06:55 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 156 156 pmPeak *peak; ///< Description of peak pixel. 157 157 psImage *pixels; ///< Rectangular region including object pixels. 158 psImage * noise; ///< Mask which marks pixels associated with objects.158 psImage *weight; ///< Image variance. 159 159 psImage *mask; ///< Mask which marks pixels associated with objects. 160 160 pmMoments *moments; ///< Basic moments measure for the object. -
trunk/psphot/src/pmPeaksSigmaLimit.c
r4954 r5049 1 1 # include "psphot.h" 2 2 3 psArray *pmPeaksSigmaLimit ( psImageData*imdata, psMetadata *config, psStats *sky)3 psArray *pmPeaksSigmaLimit (eamReadout *imdata, psMetadata *config, psStats *sky) 4 4 { 5 5 bool status = false; -
trunk/psphot/src/psImageData.c
r4954 r5049 1 1 # include "psphot.h" 2 2 3 static void psImageDataFree (psImageData*imdata) {3 static void eamReadoutFree (eamReadout *imdata) { 4 4 5 5 if (imdata == NULL) return; … … 7 7 psFree (imdata->image); 8 8 psFree (imdata->header); 9 psFree (imdata-> noise);9 psFree (imdata->weight); 10 10 psFree (imdata->mask); 11 11 return; 12 12 } 13 13 14 psImageData *psImageDataAlloc (psImage *image, psImage *noise, psImage *mask, psMetadata *header) {14 eamReadout *eamReadoutAlloc (psImage *image, psImage *weight, psImage *mask, psMetadata *header) { 15 15 16 psImageData *imdata = psAlloc(sizeof(psImageData));16 eamReadout *imdata = psAlloc(sizeof(eamReadout)); 17 17 imdata->image = image; 18 18 imdata->header = header; 19 imdata-> noise = noise;19 imdata->weight = weight; 20 20 imdata->mask = mask; 21 21 22 psMemSetDeallocator(imdata, (psFreeFunc) psImageDataFree);22 psMemSetDeallocator(imdata, (psFreeFunc) eamReadoutFree); 23 23 return (imdata); 24 24 } -
trunk/psphot/src/psLibUtils.h
r5048 r5049 23 23 const psVector *yErr, 24 24 psMinimizeLMChi2Func func); 25 26 bool psMinimizeGaussNewtonDelta_EAM (psVector *delta, 27 const psVector *params, 28 const psVector *paramMask, 29 const psArray *x, 30 const psVector *y, 31 const psVector *yErr, 32 psMinimizeLMChi2Func func); 25 33 26 34 // minimize -
trunk/psphot/src/psMinimize.c
r5048 r5049 3 3 4 4 // XXX EAM : this file contains my alternate implementations of psMinimizeLMChi2 5 6 5 // XXX EAM this implementation of MinLM includes limits on params & dparams 6 7 7 psBool psMinimizeLMChi2_EAM(psMinimization *min, 8 8 psImage *covar, … … 11 11 const psArray *x, 12 12 const psVector *y, 13 const psVector *y Err,13 const psVector *yWt, 14 14 psMinimizeLMChi2Func func) 15 15 { … … 60 60 // the user provides the error or NULL. we need to convert 61 61 // to appropriate weights 62 dy = psVectorAlloc (y->n, PS_TYPE_F32); 63 if (yErr != NULL) { 64 for (int i = 0; i < dy->n; i++) { 65 if (yErr->data.F32[i] == 0.0) { 66 dy->data.F32[i] = 1.0; 67 // mask this? bad pixel, obviously... 68 } else { 69 dy->data.F32[i] = 1.0 / PS_SQR (yErr->data.F32[i]); 70 } 71 } 62 if (yWt != NULL) { 63 dy = (psVector *) yWt; 72 64 } else { 73 for (int i = 0; i < dy->n; i++) { 74 dy->data.F32[i] = 1.0; 75 } 65 dy = psVectorAlloc (y->n, PS_TYPE_F32); 66 psVectorInit (dy, 1.0); 67 // for (int i = 0; i < dy->n; i++) { 68 // dy->data.F32[i] = 1.0; 69 // } 76 70 } 77 71 … … 82 76 return (false); 83 77 } 84 # ifndef PS_NO_TRACE78 # ifndef PS_NO_TRACE 85 79 // dump some useful info if trace is defined 86 80 if (psTraceGetLevel (".psLib.dataManip.psMinimizeLMChi2") >= 5) { … … 92 86 p_psVectorPrintRow (psTraceGetDestination(), Params, "params guess"); 93 87 } 94 # endif /* PS_NO_TRACE */88 # endif /* PS_NO_TRACE */ 95 89 96 90 // iterate until the tolerance is reached, or give up … … 103 97 psF64 dLinear = p_psMinLM_dLinear (Beta, beta, lambda); 104 98 105 # ifndef PS_NO_TRACE99 # ifndef PS_NO_TRACE 106 100 // dump some useful info if trace is defined 107 101 if (psTraceGetLevel (".psLib.dataManip.psMinimizeLMChi2") >= 5) { … … 113 107 p_psVectorPrintRow (psTraceGetDestination(), Params, "params guess"); 114 108 } 115 # endif /* PS_NO_TRACE */109 # endif /* PS_NO_TRACE */ 116 110 117 111 // calculate Chisq for new guess, update Alpha & Beta … … 125 119 126 120 psTrace (".psLib.dataManip.psMinimizeLMChi2", 4, "last chisq: %f, new chisq %f, delta: %f, rho: %f\n", min->value, Chisq, min->lastDelta, rho); 127 # ifndef PS_NO_TRACE121 # ifndef PS_NO_TRACE 128 122 // dump some useful info if trace is defined 129 123 if (psTraceGetLevel (".psLib.dataManip.psMinimizeLMChi2") >= 5) { … … 132 126 p_psVectorPrint (psTraceGetDestination(), Params, "params guess"); 133 127 } 134 # endif /* PS_NO_TRACE */128 # endif /* PS_NO_TRACE */ 135 129 136 130 /* if (Chisq < min->value) { */ … … 151 145 // construct & return the covariance matrix (if requested) 152 146 if (covar != NULL) { 153 p_psMinLM_GuessABP_EAM (covar, Beta, Params, alpha, beta, params, paramMask, beta_lim, param_min, param_max, 0.0);147 p_psMinLM_GuessABP_EAM (covar, Beta, Params, alpha, beta, params, paramMask, beta_lim, param_min, param_max, 0.0); 154 148 } 155 149 … … 160 154 psFree (Beta); 161 155 psFree (Params); 162 psFree (dy); 156 if (yWt == NULL) { 157 psFree (dy); 158 } 163 159 164 160 if (min->iter == min->maxIter) { 165 return (false);161 return (false); 166 162 } 167 163 return (true); … … 182 178 { 183 179 184 # define USE_LU_DECOMP 1185 # if (USE_LU_DECOMP)180 # define USE_LU_DECOMP 1 181 # if (USE_LU_DECOMP) 186 182 psVector *LUv = NULL; 187 183 psImage *LUm = NULL; … … 205 201 Alpha = psMatrixInvert (Alpha, A, &det); 206 202 207 # else203 # else 208 204 // gauss-jordan version 209 205 psTrace (".psLib.dataManip.psMinLM_GuessABP", 5, "using Gauss-J version"); … … 218 214 219 215 psGaussJordan (Alpha, Beta); 220 # endif216 # endif 221 217 222 218 // apply Beta to get new Params values … … 241 237 } 242 238 243 # if (USE_LU_DECOMP)239 # if (USE_LU_DECOMP) 244 240 psFree (A); 245 241 psFree (LUm); 246 242 psFree (LUv); 247 # endif243 # endif 248 244 249 245 return true; 250 246 } 251 247 248 bool psMinimizeGaussNewtonDelta_EAM (psVector *delta, 249 const psVector *params, 250 const psVector *paramMask, 251 const psArray *x, 252 const psVector *y, 253 const psVector *yWt, 254 psMinimizeLMChi2Func func) 255 { 256 257 // allocate internal arrays (current vs Guess) 258 psImage *alpha = psImageAlloc (params->n, params->n, PS_TYPE_F64); 259 psImage *Alpha = psImageAlloc (params->n, params->n, PS_TYPE_F64); 260 psVector *beta = psVectorAlloc (params->n, PS_TYPE_F64); 261 psVector *Params = psVectorAlloc (params->n, PS_TYPE_F64); 262 psVector *dy = NULL; 263 264 // the user provides the error or NULL. we need to convert 265 // to appropriate weights 266 if (yWt != NULL) { 267 dy = (psVector *) yWt; 268 } else { 269 dy = psVectorAlloc (y->n, PS_TYPE_F32); 270 psVectorInit (dy, 1.0); 271 // for (int i = 0; i < dy->n; i++) { 272 // dy->data.F32[i] = 1.0; 273 // } 274 } 275 276 p_psMinLM_SetABX (alpha, beta, params, paramMask, x, y, dy, func); 277 p_psMinLM_GuessABP (Alpha, delta, Params, alpha, beta, params, paramMask, 0.0); 278 279 psFree (alpha); 280 psFree (Alpha); 281 psFree (beta); 282 psFree (Params); 283 if (yWt == NULL) { 284 psFree (dy); 285 } 286 return (true); 287 } 288 289 -
trunk/psphot/src/psphot.c
r4946 r5049 4 4 5 5 psMetadata *config = NULL; 6 psImageData*imdata = NULL;6 eamReadout *imdata = NULL; 7 7 psArray *sources = NULL; 8 8 psArray *peaks = NULL; … … 14 14 15 15 // load input data (image and config) 16 // create or load mask and noiseimages16 // create or load mask and weight images 17 17 // we have memory leaks here -- may be from psMetadata 18 18 imdata = psphotSetup (config); -
trunk/psphot/src/psphot.h
r4977 r5049 13 13 psImage *image; 14 14 psImage *mask; 15 psImage * noise;15 psImage *weight; 16 16 psMetadata *header; 17 } psImageData;17 } eamReadout; 18 18 19 19 // top-level psphot functions 20 20 psMetadata *psphotArguments (int *argc, char **argv); 21 psImageData*psphotSetup (psMetadata *config);22 psStats *psphotImageStats ( psImageData*imdata, psMetadata *config);23 psArray *pmPeaksSigmaLimit ( psImageData*imdata, psMetadata *config, psStats *sky);24 psArray *psphotSourceStats ( psImageData*imdata, psMetadata *config, psArray *allpeaks);21 eamReadout *psphotSetup (psMetadata *config); 22 psStats *psphotImageStats (eamReadout *imdata, psMetadata *config); 23 psArray *pmPeaksSigmaLimit (eamReadout *imdata, psMetadata *config, psStats *sky); 24 psArray *psphotSourceStats (eamReadout *imdata, psMetadata *config, psArray *allpeaks); 25 25 pmPSF *psphotChoosePSF (psMetadata *config, psArray *sources, psStats *sky); 26 bool psphotApplyPSF ( psImageData*imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky);27 bool psphotFitGalaxies ( psImageData*imdata, psMetadata *config, psArray *sources, psStats *skyStats);28 void psphotOutput ( psImageData*imdata, psMetadata *config, psArray *sources);26 bool psphotApplyPSF (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky); 27 bool psphotFitGalaxies (eamReadout *imdata, psMetadata *config, psArray *sources, psStats *skyStats); 28 void psphotOutput (eamReadout *imdata, psMetadata *config, psArray *sources); 29 29 30 30 bool psphotMarkPSF (pmSource *source, float shapeNsigma, float minSN, float maxChi, float SATURATE); … … 32 32 int psphotSortBySN (const void **a, const void **b); 33 33 int psphotSaveImage (psMetadata *header, psImage *image, char *filename); 34 bool psphotDefinePixels (pmSource *mySource, const psImageData*imdata, psF32 x, psF32 y, psF32 Radius);34 bool psphotDefinePixels (pmSource *mySource, const eamReadout *imdata, psF32 x, psF32 y, psF32 Radius); 35 35 36 // psImageDatafunctions37 psImageData *psImageDataAlloc (psImage *image, psImage *noise, psImage *mask, psMetadata *header);36 // eamReadout functions 37 eamReadout *eamReadoutAlloc (psImage *image, psImage *noise, psImage *mask, psMetadata *header); 38 38 39 39 // output functions 40 bool pmSourcesWriteText ( psImageData*imdata, char *filename, psArray *sources);41 bool pmSourcesWriteOBJ ( psImageData*imdata, char *filename, psArray *sources);42 bool pmSourcesWriteCMP ( psImageData*imdata, char *filename, psArray *sources);43 bool pmSourcesWriteCMF ( psImageData*imdata, char *filename, psArray *sources);44 bool pmSourcesWriteSX ( psImageData*imdata, char *filename, psArray *sources);40 bool pmSourcesWriteText (eamReadout *imdata, char *filename, psArray *sources); 41 bool pmSourcesWriteOBJ (eamReadout *imdata, char *filename, psArray *sources); 42 bool pmSourcesWriteCMP (eamReadout *imdata, char *filename, psArray *sources); 43 bool pmSourcesWriteCMF (eamReadout *imdata, char *filename, psArray *sources); 44 bool pmSourcesWriteSX (eamReadout *imdata, char *filename, psArray *sources); 45 45 int pmSourcesDophotType (pmSource *source); 46 46 bool pmPeaksWriteText (psArray *sources, char *filename); -
trunk/psphot/src/psphotApplyPSF.c
r5048 r5049 5 5 // run this function to a specific flux limit? 6 6 7 bool psphotApplyPSF ( psImageData*imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky)7 bool psphotApplyPSF (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky) 8 8 { 9 9 bool status; … … 61 61 // XXX EAM : a better test would examine the source pixels 62 62 if (model->radius > OUTER_RADIUS) { 63 // (re)-allocate image, noise, mask arrays for each peak (square of radius OUTER)63 // (re)-allocate image, weight, mask arrays for each peak (square of radius OUTER) 64 64 psphotDefinePixels (source, imdata, x, y, model->radius); 65 65 } -
trunk/psphot/src/psphotArguments.c
r4977 r5049 22 22 } 23 23 24 // optional noiseimage - add to config25 char * noise= NULL;26 if ((N = psArgumentGet (*argc, argv, "- noise"))) {24 // optional weight image - add to config 25 char *weight = NULL; 26 if ((N = psArgumentGet (*argc, argv, "-weight"))) { 27 27 psArgumentRemove (N, argc, argv); 28 noise= psStringCopy (argv[N]);28 weight = psStringCopy (argv[N]); 29 29 psArgumentRemove (N, argc, argv); 30 30 } … … 46 46 fprintf (stderr, "loaded config...\n"); 47 47 48 // identify input image & optional noise& mask images48 // identify input image & optional weight & mask images 49 49 // command-line entries override config-file entries 50 50 psMetadataAdd (config, PS_LIST_HEAD, "IMAGE", mode, "", argv[1]); … … 54 54 psMetadataAdd (config, PS_LIST_HEAD, "MASK_IMAGE", mode, "", mask); 55 55 } 56 if ( noise!= NULL) {57 psMetadataAdd (config, PS_LIST_HEAD, " NOISE_IMAGE", mode, "", noise);56 if (weight != NULL) { 57 psMetadataAdd (config, PS_LIST_HEAD, "WEIGHT_IMAGE", mode, "", weight); 58 58 } 59 59 if (resid != NULL) { … … 68 68 fprintf (stderr, "options: \n"); 69 69 fprintf (stderr, " -mask (filename)\n"); 70 fprintf (stderr, " - noise(filename)\n");70 fprintf (stderr, " -weight (filename)\n"); 71 71 fprintf (stderr, " -resid (filename)\n"); 72 72 exit (2); -
trunk/psphot/src/psphotDefinePixels.c
r4977 r5049 2 2 3 3 bool psphotDefinePixels(pmSource *mySource, 4 const psImageData*imdata,4 const eamReadout *imdata, 5 5 psF32 x, 6 6 psF32 y, … … 14 14 15 15 mySource->pixels = psImageSubset(imdata->image, srcRegion); 16 mySource-> noise = psImageSubset(imdata->noise, srcRegion);16 mySource->weight = psImageSubset(imdata->weight, srcRegion); 17 17 mySource->mask = psImageSubset(imdata->mask, srcRegion); 18 18 -
trunk/psphot/src/psphotFitGalaxies.c
r5048 r5049 1 1 # include "psphot.h" 2 2 3 bool psphotFitGalaxies ( psImageData*imdata, psMetadata *config, psArray *sources, psStats *skyStats)3 bool psphotFitGalaxies (eamReadout *imdata, psMetadata *config, psArray *sources, psStats *skyStats) 4 4 { 5 5 bool status, goodfit; … … 69 69 // XXX EAM : a better test would examine the source pixels 70 70 if (model->radius > OUTER_RADIUS) { 71 // (re)-allocate image, noise, mask arrays for each peak (square of radius OUTER)71 // (re)-allocate image, weight, mask arrays for each peak (square of radius OUTER) 72 72 psphotDefinePixels (source, imdata, x, y, model->radius); 73 73 } -
trunk/psphot/src/psphotImageStats.c
r4946 r5049 1 1 # include "psphot.h" 2 2 3 psStats *psphotImageStats ( psImageData*imdata, psMetadata *config)3 psStats *psphotImageStats (eamReadout *imdata, psMetadata *config) 4 4 { 5 5 psStats *stats = NULL; -
trunk/psphot/src/psphotOutput.c
r5048 r5049 2 2 3 3 // output functions: we have several fixed modes (sx, obj, cmp) 4 void psphotOutput ( psImageData*imdata, psMetadata *config, psArray *sources) {4 void psphotOutput (eamReadout *imdata, psMetadata *config, psArray *sources) { 5 5 6 6 bool status; … … 47 47 } 48 48 49 bool pmSourcesWriteText ( psImageData*imdata, char *filename, psArray *sources) {49 bool pmSourcesWriteText (eamReadout *imdata, char *filename, psArray *sources) { 50 50 51 51 char *name = (char *) psAlloc (strlen(filename) + 10); … … 68 68 69 69 // dophot-style output list with fixed line width 70 bool pmSourcesWriteOBJ ( psImageData*imdata, char *filename, psArray *sources) {70 bool pmSourcesWriteOBJ (eamReadout *imdata, char *filename, psArray *sources) { 71 71 72 72 int i, type, status; … … 159 159 160 160 // elixir/sextractor-style output list with fixed line width 161 bool pmSourcesWriteSX ( psImageData*imdata, char *filename, psArray *sources) {161 bool pmSourcesWriteSX (eamReadout *imdata, char *filename, psArray *sources) { 162 162 163 163 int i, status, flags; … … 257 257 258 258 // elixir-style pseudo FITS table (header + ascii list) 259 bool pmSourcesWriteCMP ( psImageData*imdata, char *filename, psArray *sources) {259 bool pmSourcesWriteCMP (eamReadout *imdata, char *filename, psArray *sources) { 260 260 261 261 int i, type, status; … … 360 360 361 361 // elixir-style FITS table output (header + table in 1st extension) 362 bool pmSourcesWriteCMF ( psImageData*imdata, char *filename, psArray *sources) {362 bool pmSourcesWriteCMF (eamReadout *imdata, char *filename, psArray *sources) { 363 363 364 364 // write imdata->header to file -
trunk/psphot/src/psphotSetup.c
r4954 r5049 5 5 // apply X/Y border info 6 6 // apply the SATURATE mask? 7 // load or construct the noise7 // load or construct the weight 8 8 9 psImageData*psphotSetup (psMetadata *config)9 eamReadout *psphotSetup (psMetadata *config) 10 10 { 11 11 psMetadata *header = NULL; 12 12 psImage *image = NULL; 13 psImage * noise= NULL;13 psImage *weight = NULL; 14 14 psImage *mask = NULL; 15 15 psRegion region = {0,0,0,0}; // a region representing the entire array … … 39 39 psMetadataAdd (config, PS_LIST_TAIL, "GAIN", PS_META_F32 | PS_META_REPLACE, "gain value used", GAIN); 40 40 41 // load the noise image if it is supplied, otherwise build from input 42 char *noiseName = psMetadataLookupPtr (&status, config, "NOISE"); 41 // load the weight image if it is supplied, otherwise build from input 42 // by 'weight' we really mean variance image 43 char *weightName = psMetadataLookupPtr (&status, config, "WEIGHT"); 43 44 if (status == true) { 44 file = psFitsAlloc ( noiseName);45 noise= psFitsReadImage (NULL, file, region, 0);45 file = psFitsAlloc (weightName); 46 weight = psFitsReadImage (NULL, file, region, 0); 46 47 psFree (file); 47 // psFree ( noiseName); XXX - see psFree (input)48 // psFree (weightName); XXX - see psFree (input) 48 49 } else { 49 // build the noiseimage from the input image, RDNOISE, and GAIN50 noise= psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);50 // build the weight image from the input image, RDNOISE, and GAIN 51 weight = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32); 51 52 for (int iy = 0; iy < image->numRows; iy++) { 52 53 for (int ix = 0; ix < image->numCols; ix++) { 53 noise->data.F32[iy][ix] = image->data.F32[iy][ix] / GAIN + PS_SQR(RDNOISE/GAIN);54 weight->data.F32[iy][ix] = image->data.F32[iy][ix] / GAIN + PS_SQR(RDNOISE/GAIN); 54 55 } 55 56 } … … 92 93 93 94 // save the image data & return it 94 psImageData *imdata = psImageDataAlloc(image, noise, mask, header);95 eamReadout *imdata = eamReadoutAlloc(image, weight, mask, header); 95 96 return (imdata); 96 97 } -
trunk/psphot/src/psphotSourceStats.c
r5048 r5049 1 1 # include "psphot.h" 2 2 3 psArray *psphotSourceStats ( psImageData*imdata, psMetadata *config, psArray *peaks)3 psArray *psphotSourceStats (eamReadout *imdata, psMetadata *config, psArray *peaks) 4 4 { 5 5 bool status = false; … … 22 22 source->peak = (pmPeak *)psMemCopy(peaks->data[i]); 23 23 24 // allocate image, noise, mask arrays for each peak (square of radius OUTER)24 // allocate image, weight, mask arrays for each peak (square of radius OUTER) 25 25 // XXX EAM : this has 12 leaks (v.5) 26 26 psphotDefinePixels (source, imdata, source->peak->x, source->peak->y, OUTER); -
trunk/psphot/src/psphotSubtractPSF.c
r5048 r5049 31 31 model->params->data.F32[0] = sky; 32 32 33 // XXX EAM : amplify the noisematrix a la dophot?33 // XXX EAM : amplify the weight matrix a la dophot? 34 34 35 35 return (true);
Note:
See TracChangeset
for help on using the changeset viewer.
