Changeset 30268
- Timestamp:
- Jan 12, 2011, 9:33:20 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20101205/ppSim/src
- Files:
-
- 3 edited
-
ppSimArguments.c (modified) (3 diffs)
-
ppSimCreate.c (modified) (2 diffs)
-
ppSimSetPSF.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20101205/ppSim/src/ppSimArguments.c
r29011 r30268 49 49 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp", 0, "Photometric zero point", NAN); 50 50 psMetadataAddF32(arguments, PS_LIST_TAIL, "-seeing", 0, "Seeing FWHM (arcsec)", NAN); 51 psMetadataAddF32(arguments, PS_LIST_TAIL, "-seeing-max", 0, "Seeing FWHM (arcsec) at end of ramp", NAN); 52 psMetadataAddBool(arguments, PS_LIST_TAIL, "-seeing-ramp", 0, "Use a seeing ramp", false); 51 53 psMetadataAddF32(arguments, PS_LIST_TAIL, "-starslum", 0, "Fake star luminosity function slope", NAN); 52 54 psMetadataAddF32(arguments, PS_LIST_TAIL, "-starsmag", 0, "Brightest magnitude for fake stars", NAN); … … 130 132 // 'seeing' is not required: we can load a psf-model instead; but if not, it is allowed 131 133 ppSimArgToRecipeF32(&status, options, "SEEING", arguments, "-seeing"); // seeing (FWHM in arcsec) 134 ppSimArgToRecipeF32(&status, options, "SEEING.MAX", arguments, "-seeing-max"); // seeing (FWHM in arcsec) 135 ppSimArgToRecipeBool(&status, options, "SEEING.RAMP", arguments, "-seeing-ramp"); // seeing (FWHM in arcsec) 132 136 133 137 // 'scale' is not required: we can use the WCS instead; but if not, it is allowed … … 227 231 psMetadataAddF32(options, PS_LIST_TAIL, "PA", 0, "Boresight position angle (radians)",pa * M_PI / 180.0); 228 232 233 if (psMetadataLookupBool(NULL, arguments, "-seeing-ramp")) { 234 float seeingMax = psMetadataLookupF32(NULL, arguments, "-seeing-max"); // seeing at ramp end 235 psMetadataAddF32(options, PS_LIST_TAIL, "SEEING.MAX", 0, "Seeing FWHM (arcsec)", seeingMax); 236 psMetadataAddBool(options, PS_LIST_TAIL, "SEEING.RAMP", 0, "use seeing ramp", true); 237 } 238 229 239 ppSimArgToRecipeF32(&status, options, "ZEROPOINT", arguments, "-zp"); // Zero point 230 240 } -
branches/eam_branches/ipp-20101205/ppSim/src/ppSimCreate.c
r30151 r30268 103 103 psMetadataAddF32(recipe, PS_LIST_TAIL, "SEEING", PS_META_REPLACE, "Seeing SIGMA (pixels)", seeing / 2.0 / sqrt(2.0 * log(2.0)) / scale); 104 104 105 float seeingMax = psMetadataLookupF32(&status, recipe, "SEEING.MAX"); 106 psMetadataAddF32(recipe, PS_LIST_TAIL, "SEEING.MAX", PS_META_REPLACE, "Seeing SIGMA (pixels)", seeingMax / 2.0 / sqrt(2.0 * log(2.0)) / scale); 107 105 108 // if we have been supplied an input image, but no ra & dec, use the input image values 106 109 if (input) { … … 211 214 } 212 215 } 216 // XXX this is a hack, but I don't have a better way at the moment: assumes a single cell per chip 217 if (nx) { 218 psMetadataAddS32(chip->concepts, PS_LIST_TAIL, "CHIP.XSIZE", PS_META_REPLACE, "", nx); 219 } else { 220 nx = psMetadataLookupF32(&status, cell->concepts, "CELL.XSIZE"); 221 psMetadataAddS32(chip->concepts, PS_LIST_TAIL, "CHIP.XSIZE", PS_META_REPLACE, "", nx); 222 } 223 if (ny) { 224 psMetadataAddS32(chip->concepts, PS_LIST_TAIL, "CHIP.YSIZE", PS_META_REPLACE, "", ny); 225 } else { 226 ny = psMetadataLookupF32(&status, cell->concepts, "CELL.YSIZE"); 227 psMetadataAddS32(chip->concepts, PS_LIST_TAIL, "CHIP.YSIZE", PS_META_REPLACE, "", ny); 228 } 213 229 } 214 230 } -
branches/eam_branches/ipp-20101205/ppSim/src/ppSimSetPSF.c
r26900 r30268 23 23 float theta = psMetadataLookupF32(&status, recipe, "PSF.THETA"); // Seeing SIGMA (pixels) 24 24 25 float seeingMax = psMetadataLookupF32(&status, recipe, "SEEING.MAX"); // Seeing SIGMA (pixels) 26 bool seeingRamp = psMetadataLookupBool(&status, recipe, "SEEING.RAMP"); // Seeing SIGMA (pixels) 27 25 28 char *psfModelName = psMetadataLookupStr(&status, recipe, "PSF.MODEL"); // Name of PSF model 26 29 if (psfModelName == NULL) { … … 39 42 int xSize = psMetadataLookupS32(NULL, chip->concepts, "CHIP.XSIZE"); 40 43 int ySize = psMetadataLookupS32(NULL, chip->concepts, "CHIP.YSIZE"); 41 xSize = 1000;42 ySize = 1000;43 44 44 // no spatial variation 45 options->psfTrendMode = PM_TREND_POLY_ORD; 46 options->psfTrendNx = 0; 47 options->psfTrendNy = 0; 48 options->psfFieldNx = xSize; 49 options->psfFieldNy = ySize; 45 if (seeingRamp) { 46 psEllipseAxes axes; 47 psEllipsePol pol; 48 psEllipsePol polMax; 50 49 51 // generate the psf 52 psf = pmPSFAlloc (options); 50 // try spatial variation 51 options->psfTrendMode = PM_TREND_POLY_ORD; 52 options->psfTrendNx = 1; 53 options->psfTrendNy = 1; 54 options->psfFieldNx = xSize; 55 options->psfFieldNy = ySize; 53 56 54 psEllipseAxes axes; 55 psEllipsePol pol;57 // generate the psf 58 psf = pmPSFAlloc (options); 56 59 57 // supply the semi-major axis (these are SIGMA values in PIXELS)58 axes.major = seeing;59 axes.minor = aRatio * seeing;60 axes.theta = theta * PS_RAD_DEG;60 // supply the semi-major axis (these are SIGMA values in PIXELS) 61 axes.major = seeing; 62 axes.minor = aRatio * seeing; 63 axes.theta = theta * PS_RAD_DEG; 61 64 62 pol = psEllipseAxesToPol (axes);65 pol = psEllipseAxesToPol (axes); 63 66 64 param = psf->params->data[PM_PAR_E0]; 65 param->poly->coeff[0][0] = pol.e0; 67 axes.major = seeingMax; 68 axes.minor = aRatio * seeingMax; 69 polMax = psEllipseAxesToPol (axes); 66 70 67 param = psf->params->data[PM_PAR_E1]; 68 param->poly->coeff[0][0] = pol.e1; 71 param = psf->params->data[PM_PAR_E0]; 72 param->poly->coeff[0][0] = pol.e0; 73 param->poly->coeff[1][0] = (polMax.e0 - pol.e0) / xSize; 74 param->poly->coeff[0][1] = (polMax.e0 - pol.e0) / ySize; 69 75 70 param = psf->params->data[PM_PAR_E2]; 71 param->poly->coeff[0][0] = pol.e2; 76 param = psf->params->data[PM_PAR_E1]; 77 param->poly->coeff[0][0] = pol.e1; 78 param->poly->coeff[1][0] = 0.0; 79 param->poly->coeff[0][1] = 0.0; 72 80 73 if (!strcasecmp (psfModelName, "PS_MODEL_QGAUSS")) { 74 param = psf->params->data[PM_PAR_7];75 param->poly->coeff[0][0] = 1.0;76 } 81 param = psf->params->data[PM_PAR_E2]; 82 param->poly->coeff[0][0] = pol.e2; 83 param->poly->coeff[1][0] = 0.0; 84 param->poly->coeff[0][1] = 0.0; 77 85 78 if (!strcasecmp (psfModelName, "PS_MODEL_RGAUSS")) { 79 param = psf->params->data[PM_PAR_7]; 80 param->poly->coeff[0][0] = 1.0; 86 if (!strcasecmp (psfModelName, "PS_MODEL_QGAUSS")) { 87 param = psf->params->data[PM_PAR_7]; 88 param->poly->coeff[0][0] = 1.0; 89 param->poly->coeff[1][0] = 0.0; 90 param->poly->coeff[0][1] = 0.0; 91 } 92 93 if (!strcasecmp (psfModelName, "PS_MODEL_RGAUSS")) { 94 param = psf->params->data[PM_PAR_7]; 95 param->poly->coeff[0][0] = 1.0; 96 param->poly->coeff[1][0] = 0.0; 97 param->poly->coeff[0][1] = 0.0; 98 } 99 100 } else { 101 psEllipseAxes axes; 102 psEllipsePol pol; 103 104 // no spatial variation 105 options->psfTrendMode = PM_TREND_POLY_ORD; 106 options->psfTrendNx = 0; 107 options->psfTrendNy = 0; 108 options->psfFieldNx = xSize; 109 options->psfFieldNy = ySize; 110 111 // generate the psf 112 psf = pmPSFAlloc (options); 113 114 // supply the semi-major axis (these are SIGMA values in PIXELS) 115 axes.major = seeing; 116 axes.minor = aRatio * seeing; 117 axes.theta = theta * PS_RAD_DEG; 118 119 pol = psEllipseAxesToPol (axes); 120 121 param = psf->params->data[PM_PAR_E0]; 122 param->poly->coeff[0][0] = pol.e0; 123 124 param = psf->params->data[PM_PAR_E1]; 125 param->poly->coeff[0][0] = pol.e1; 126 127 param = psf->params->data[PM_PAR_E2]; 128 param->poly->coeff[0][0] = pol.e2; 129 130 if (!strcasecmp (psfModelName, "PS_MODEL_QGAUSS")) { 131 param = psf->params->data[PM_PAR_7]; 132 param->poly->coeff[0][0] = 1.0; 133 } 134 135 if (!strcasecmp (psfModelName, "PS_MODEL_RGAUSS")) { 136 param = psf->params->data[PM_PAR_7]; 137 param->poly->coeff[0][0] = 1.0; 138 } 81 139 } 82 140
Note:
See TracChangeset
for help on using the changeset viewer.
