Changeset 43068
- Timestamp:
- Jul 3, 2026, 3:08:04 PM (4 weeks ago)
- Location:
- branches/eam_branches/ipp-pstamp-20260421/ppSim/src
- Files:
-
- 6 edited
-
ppSimArguments.c (modified) (2 diffs)
-
ppSimInsertStars.c (modified) (6 diffs)
-
ppSimLoadStars.c (modified) (2 diffs)
-
ppSimMakeBias.c (modified) (3 diffs)
-
ppSimSequenceObject.c (modified) (2 diffs)
-
ppSimUtils.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pstamp-20260421/ppSim/src/ppSimArguments.c
r34261 r43068 48 48 psMetadataAddF32(arguments, PS_LIST_TAIL, "-scale", 0, "Plate scale (arcsec/pixel)", NAN); 49 49 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp", 0, "Photometric zero point", NAN); 50 psMetadataAddF32(arguments, PS_LIST_TAIL, "-mjd-obs", 0, "MJD of observation", NAN); 50 51 psMetadataAddF32(arguments, PS_LIST_TAIL, "-seeing", 0, "Seeing FWHM (arcsec)", NAN); 51 52 psMetadataAddF32(arguments, PS_LIST_TAIL, "-seeing-max", 0, "Seeing FWHM (arcsec) at end of ramp", NAN); … … 203 204 ppSimArgToRecipeS32(&status, options, "BINNING", arguments, "-bin"); 204 205 206 // add MJD of observation if defined 207 ppSimArgToRecipeF32(&status, options, "MJD.OBS", arguments, "-mjd-obs"); // time/date of observation 208 205 209 ppSimArgToRecipeS32(&status, config->arguments, "NX.CELL", arguments, "-nx"); 206 210 ppSimArgToRecipeS32(&status, config->arguments, "NY.CELL", arguments, "-ny"); -
branches/eam_branches/ipp-pstamp-20260421/ppSim/src/ppSimInsertStars.c
r41397 r43068 31 31 float nSigmaLim = psMetadataLookupF32(NULL, recipe, "STARS.SIGMA.LIM"); // significance of faintest stars 32 32 33 char *chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); // 34 char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); // 35 33 36 float readnoise = psMetadataLookupF32(NULL, cell->concepts, "CELL.READNOISE");// CCD read noise, e 34 37 if (isnan(readnoise)) { … … 62 65 assert (psf); 63 66 67 // EAM : I think this dX,dY double-counts the offset applied to xChip,yChip in pmSourceFromModel 64 68 int dX = PM_CELL_TO_CHIP (0.0, x0Cell, xParityCell, binning); 65 69 int dY = PM_CELL_TO_CHIP (0.0, y0Cell, yParityCell, binning); 70 dX = 0; dY = 0; 66 71 67 72 psArray *sources = psArrayAllocEmpty (stars->n); … … 70 75 char outname[1024]; 71 76 char *outroot = psMetadataLookupStr(&mdok, config->arguments, "OUTPUT"); 72 sprintf (outname, "%s. dat", outroot);77 sprintf (outname, "%s.%s.%s.dat", outroot, chipName, cellName); 73 78 74 79 FILE *outfile = fopen (outname, "w"); … … 81 86 for (long i = 0; i < stars->n; i++) { 82 87 ppSimStar *star = stars->data[i]; 83 psTrace("ppSim", 10, "Inserting star at %.1f,%.1f --> %.2f\n", star->x, star->y, star->flux);84 85 88 // star->x,y are in fpa coordinates 86 89 … … 92 95 float xCell = PM_CHIP_TO_CELL(xChip, x0Cell, xParityCell, binning); 93 96 float yCell = PM_CHIP_TO_CELL(yChip, y0Cell, yParityCell, binning); 97 98 psTrace("ppSim", 10, "Inserting star at %.1f %.1f --> %.2f : %.1f %.1f : %.1f %.1f\n", star->x, star->y, star->flux, xChip, yChip, xCell, yCell); 94 99 95 100 // XXX Note, the below does not put the edges of stars on the readout if they fall slightly off … … 105 110 106 111 // instantiate a model for the PSF at this location, set desired flux 112 // EAM : we use xChip,yChip here, corrected to xCell,yCell in pmSourceFromModel 107 113 pmModel *model = pmModelFromPSFforXY (psf, xChip, yChip, 1.0); 108 114 pmModelSetFlux (model, flux); -
branches/eam_branches/ipp-pstamp-20260421/ppSim/src/ppSimLoadStars.c
r41397 r43068 37 37 psFree(bounds); 38 38 39 psMetadataAdd(astroRecipe, PS_LIST_TAIL, "RA_MIN", PS_DATA_F32 | PS_META_REPLACE, "", 40 ra0 - radius / cos(dec0)); 41 psMetadataAdd(astroRecipe, PS_LIST_TAIL, "RA_MAX", PS_DATA_F32 | PS_META_REPLACE, "", 42 ra0 + radius / cos(dec0)); 39 psMetadataAdd(astroRecipe, PS_LIST_TAIL, "RA_MIN", PS_DATA_F32 | PS_META_REPLACE, "", ra0 - radius / cos(dec0)); 40 psMetadataAdd(astroRecipe, PS_LIST_TAIL, "RA_MAX", PS_DATA_F32 | PS_META_REPLACE, "", ra0 + radius / cos(dec0)); 43 41 psMetadataAdd(astroRecipe, PS_LIST_TAIL, "DEC_MIN", PS_DATA_F32 | PS_META_REPLACE, "", dec0 - radius); 44 42 psMetadataAdd(astroRecipe, PS_LIST_TAIL, "DEC_MAX", PS_DATA_F32 | PS_META_REPLACE, "", dec0 + radius); … … 83 81 stars->data[oldSize + i] = star; 84 82 85 psTrace("ppSim", 10, "Adding catalogue star: % .1f,%.1f --> %.2f\n", star->x, star->y, star->flux);83 psTrace("ppSim", 10, "Adding catalogue star: %10.6f %10.6f : %.1f %.1f --> %.2f\n", star->ra, star->dec, star->x, star->y, star->flux); 86 84 } 87 85 stars->n = oldSize + refStars->n; -
branches/eam_branches/ipp-pstamp-20260421/ppSim/src/ppSimMakeBias.c
r21365 r43068 16 16 float biasLevel = psMetadataLookupF32(NULL, recipe, "BIAS.LEVEL"); // Bias level 17 17 float biasRange = psMetadataLookupF32(NULL, recipe, "BIAS.RANGE"); // Bias range 18 int biasOrder= psMetadataLookupS32(NULL, recipe, "BIAS.ORDER"); // Bias order18 int biasOrder = psMetadataLookupS32(NULL, recipe, "BIAS.ORDER"); // Bias order 19 19 20 20 float readnoise = psMetadataLookupF32(NULL, cell->concepts, "CELL.READNOISE");// CCD read noise, e … … 40 40 biasPoly->coeff[j] = biasRange * psRandomGaussian(rng); 41 41 } 42 // polynomial is evaluated for the range 0 - numRows 43 biasPoly->scale[0] = +2.0 / numRows; 44 biasPoly->zero[0] = -1.0; 45 // 0 -> -1, numRows -> 1.0 42 46 43 47 psVector *biasRows = psVectorAlloc(numRows, PS_TYPE_F32); // Bias value, per row 44 int biasOffset = 0.5 * numRows * psRandomUniform(rng); // Offset to prevent common pattern 48 49 // ??? int biasOffset = 0.5 * numRows * psRandomUniform(rng); // Offset to prevent common pattern 45 50 46 51 for (int y = 0; y < numRows; y++) { 47 52 // Adjust bias level for this row 48 biasRows->data.F32[y] = psPolynomial1DEval(biasPoly, (float)(y + biasOffset) / 49 (float)numRows - 0.5) + biasLevel; 53 biasRows->data.F32[y] = psPolynomial1DEval(biasPoly, y) + biasLevel; 54 55 // old version: 56 // biasRows->data.F32[y] = psPolynomial1DEval(biasPoly, (float)(y + biasOffset) / (float)numRows - 0.5) + biasLevel; 50 57 51 58 for (int x = 0; x < numCols; x++) { … … 62 69 } 63 70 71 /* This function introduces a polynomial variation in the bias signal as 72 a function of the row number. 73 74 BIAS.LEVEL : pedestal value for the bias 75 BIAS.RANGE : max amplitude of the bias variation 76 BIAS.ORDER : order of the Chebyshev polynomial in the y-dir 77 78 */ 79 -
branches/eam_branches/ipp-pstamp-20260421/ppSim/src/ppSimSequenceObject.c
r42385 r43068 23 23 float IQmin = psMetadataLookupF32 (&status, sequence, "IQ_MIN"); 24 24 float IQmax = psMetadataLookupF32 (&status, sequence, "IQ_MAX"); 25 26 float MJDmin = psMetadataLookupF32 (&status, sequence, "MJD_MIN"); 27 float MJDmax = psMetadataLookupF32 (&status, sequence, "MJD_MAX"); 25 28 26 29 if (filters->n != exptimes->n) { … … 101 104 double frnd = psRandomUniform(rng); 102 105 float seeing = IQmin + (IQmax - IQmin)*frnd; 103 104 106 psStringAppend (&command, " -seeing %f", seeing); 107 108 double dtime = (MJDmax - MJDmin)*psRandomUniform(rng); 109 float MJDobs = MJDmin + dtime; 110 psStringAppend (&command, " -mjd-obs %f", MJDobs); 105 111 106 112 psStringAppend (&command, " %s", filename); -
branches/eam_branches/ipp-pstamp-20260421/ppSim/src/ppSimUtils.c
r43042 r43068 134 134 float zeropoint = psMetadataLookupF32(NULL, recipe, "ZEROPOINT"); // Detector Temperature 135 135 136 float MJDobs = psMetadataLookupF32(NULL, recipe, "MJD.OBS"); // observation MJD 137 136 138 const char *filter = psMetadataLookupStr(NULL, recipe, "FILTER"); // Filter name 137 139 if (!filter) { … … 156 158 psMetadataAddF32(fpa->concepts, PS_LIST_TAIL, "FPA.ZP", PS_META_REPLACE, "Zero Point", zeropoint); 157 159 158 // test time159 psTime *obstime = psTimeFromMJD (55440.0);160 // set time of the observation 161 psTime *obstime = isfinite(MJDobs) ? psTimeFromMJD (MJDobs) : psTimeFromMJD (60000.0); 160 162 psMetadataAddTime(fpa->concepts, PS_LIST_TAIL, "FPA.TIME", PS_META_REPLACE, "sample time", obstime); 161 163
Note:
See TracChangeset
for help on using the changeset viewer.
