Changeset 6873 for trunk/psModules/src/objects/pmPSF.c
- Timestamp:
- Apr 17, 2006, 8:10:08 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmPSF.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmPSF.c
r6511 r6873 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2006-0 3-04 01:01:33$8 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-04-17 18:10:08 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 19 19 #include <pslib.h> 20 #include "pmObjects.h" 20 #include "pmHDU.h" 21 #include "pmFPA.h" 22 #include "pmPeaks.h" 23 #include "pmMoments.h" 24 #include "pmModel.h" 25 #include "pmSource.h" 26 #include "pmGrowthCurve.h" 21 27 #include "pmPSF.h" 22 28 #include "pmModelGroup.h" … … 57 63 return; 58 64 65 psFree (psf->ApTrend); 66 psFree (psf->growth); 59 67 psFree (psf->params); 60 68 return; … … 69 77 X-center 70 78 Y-center 71 ???: Sky background value?72 ???: Zo?79 Sky background value 80 Object Normalization 73 81 *****************************************************************************/ 74 pmPSF *pmPSFAlloc (pmModelType type )82 pmPSF *pmPSFAlloc (pmModelType type, bool poissonErrors) 75 83 { 76 84 int Nparams; … … 83 91 psf->dApResid = 0.0; 84 92 psf->skyBias = 0.0; 93 psf->skySat = 0.0; 94 psf->poissonErrors = poissonErrors; 95 96 // the ApTrend components are (x, y, r2rflux, flux) 97 psf->ApTrend = psPolynomial4DAlloc (PS_POLYNOMIAL_ORD, 2, 2, 1, 1); 98 pmPSF_MaskApTrend (psf, PM_PSF_SKYBIAS); 99 100 if (psf->poissonErrors) { 101 psf->ChiTrend = psPolynomial1DAlloc (PS_POLYNOMIAL_ORD, 1); 102 } else { 103 psf->ChiTrend = psPolynomial1DAlloc (PS_POLYNOMIAL_ORD, 2); 104 } 105 106 // don't define a growth curve : user needs to choose radius bins 107 psf->growth = NULL; 85 108 86 109 Nparams = pmModelParameterCount (type); … … 94 117 for (int i = 0; i < psf->params->n; i++) { 95 118 // XXX EAM : make this a user-defined value? 96 psf->params->data[i] = psPolynomial2DAlloc( 1, 1, PS_POLYNOMIAL_ORD);119 psf->params->data[i] = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, 1, 1); 97 120 } 98 121 … … 174 197 175 198 /***************************************************************************** 176 pmModelFromPSF (*model FLT, *psf): use the model position parameters to199 pmModelFromPSF (*modelEXT, *psf): use the model position parameters to 177 200 construct a realization of the PSF model at the object coordinates 178 201 *****************************************************************************/ 179 pmModel *pmModelFromPSF (pmModel *model FLT, pmPSF *psf)180 { 181 182 // need to define the relationship between the model FLT and modelPSF ?202 pmModel *pmModelFromPSF (pmModel *modelEXT, pmPSF *psf) 203 { 204 205 // need to define the relationship between the modelEXT and modelPSF ? 183 206 184 207 // find function used to set the model parameters … … 189 212 190 213 // set model parameters for this source based on PSF information 191 modelFromPSFFunc (modelPSF, model FLT, psf);214 modelFromPSFFunc (modelPSF, modelEXT, psf); 192 215 193 216 return (modelPSF); 194 217 } 218 219 // zero and mask out all terms: 220 static bool maskAllTerms (psPolynomial4D *trend) 221 { 222 223 for (int i = 0; i < trend->nX + 1; i++) { 224 for (int j = 0; j < trend->nY + 1; j++) { 225 for (int k = 0; k < trend->nZ + 1; k++) { 226 for (int m = 0; m < trend->nT + 1; m++) { 227 trend->mask[i][j][k][m] = 1; // mask coeff 228 trend->coeff[i][j][k][m] = 0; // zero coeff 229 } 230 } 231 } 232 } 233 return true; 234 } 235 236 /*********************************************** 237 * this function masks the psf.ApTrend polynomial 238 * to enable the specific subset of the coefficients 239 **********************************************/ 240 bool pmPSF_MaskApTrend (pmPSF *psf, pmPSF_ApTrendOptions option) 241 { 242 243 switch (option) { 244 case PM_PSF_NONE: 245 maskAllTerms (psf->ApTrend); 246 return true; 247 248 case PM_PSF_CONSTANT: 249 maskAllTerms (psf->ApTrend); 250 psf->ApTrend->mask[0][0][0][0] = 0; // unmask constant 251 return true; 252 253 case PM_PSF_SKYBIAS: 254 maskAllTerms (psf->ApTrend); 255 psf->ApTrend->mask[0][0][0][0] = 0; // unmask constant 256 psf->ApTrend->mask[0][0][1][0] = 0; // unmask skybias 257 return true; 258 259 case PM_PSF_SKYSAT: 260 maskAllTerms (psf->ApTrend); 261 psf->ApTrend->mask[0][0][0][0] = 0; // unmask constant 262 psf->ApTrend->mask[0][0][1][0] = 0; // unmask skybias 263 psf->ApTrend->mask[0][0][0][1] = 0; // unmask skybias 264 return true; 265 266 case PM_PSF_XY_LIN: 267 maskAllTerms (psf->ApTrend); 268 psf->ApTrend->mask[0][0][0][0] = 0; // unmask constant 269 psf->ApTrend->mask[1][0][0][0] = 0; // unmask x 270 psf->ApTrend->mask[0][1][0][0] = 0; // unmask y 271 return true; 272 273 case PM_PSF_XY_QUAD: 274 maskAllTerms (psf->ApTrend); 275 psf->ApTrend->mask[0][0][0][0] = 0; // unmask constant 276 psf->ApTrend->mask[1][0][0][0] = 0; // unmask x 277 psf->ApTrend->mask[2][0][0][0] = 0; // unmask x^2 278 psf->ApTrend->mask[1][1][0][0] = 0; // unmask x y 279 psf->ApTrend->mask[0][1][0][0] = 0; // unmask y 280 psf->ApTrend->mask[0][2][0][0] = 0; // unmask y^2 281 return true; 282 283 case PM_PSF_SKY_XY_LIN: 284 maskAllTerms (psf->ApTrend); 285 psf->ApTrend->mask[0][0][0][0] = 0; // unmask constant 286 psf->ApTrend->mask[1][0][0][0] = 0; // unmask x 287 psf->ApTrend->mask[0][1][0][0] = 0; // unmask y 288 psf->ApTrend->mask[0][0][1][0] = 0; // unmask skybias 289 return true; 290 291 case PM_PSF_SKYSAT_XY_LIN: 292 maskAllTerms (psf->ApTrend); 293 psf->ApTrend->mask[0][0][0][0] = 0; // unmask constant 294 psf->ApTrend->mask[1][0][0][0] = 0; // unmask x 295 psf->ApTrend->mask[0][1][0][0] = 0; // unmask y 296 psf->ApTrend->mask[0][0][1][0] = 0; // unmask skybias 297 psf->ApTrend->mask[0][0][0][1] = 0; // unmask skysat 298 return true; 299 300 case PM_PSF_ALL: 301 default: 302 maskAllTerms (psf->ApTrend); 303 psf->ApTrend->mask[0][0][0][0] = 0; // unmask constant 304 psf->ApTrend->mask[0][0][1][0] = 0; // unmask skybias 305 psf->ApTrend->mask[0][0][0][1] = 0; // unmask skysat 306 307 psf->ApTrend->mask[1][0][0][0] = 0; // unmask x 308 psf->ApTrend->mask[2][0][0][0] = 0; // unmask x^2 309 psf->ApTrend->mask[1][1][0][0] = 0; // unmask x y 310 psf->ApTrend->mask[0][1][0][0] = 0; // unmask y 311 psf->ApTrend->mask[0][2][0][0] = 0; // unmask y^2 312 return true; 313 } 314 return false; 315 }
Note:
See TracChangeset
for help on using the changeset viewer.
