IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 43068


Ignore:
Timestamp:
Jul 3, 2026, 3:08:04 PM (4 weeks ago)
Author:
eugene
Message:

add -mjd-obs; add chip & cell names to output test file; more trace verbosity; fix chebyshev scales for bias variations

Location:
branches/eam_branches/ipp-pstamp-20260421/ppSim/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-pstamp-20260421/ppSim/src/ppSimArguments.c

    r34261 r43068  
    4848    psMetadataAddF32(arguments,  PS_LIST_TAIL, "-scale", 0, "Plate scale (arcsec/pixel)", NAN);
    4949    psMetadataAddF32(arguments,  PS_LIST_TAIL, "-zp", 0, "Photometric zero point", NAN);
     50    psMetadataAddF32(arguments,  PS_LIST_TAIL, "-mjd-obs", 0, "MJD of observation", NAN);
    5051    psMetadataAddF32(arguments,  PS_LIST_TAIL, "-seeing", 0, "Seeing FWHM (arcsec)", NAN);
    5152    psMetadataAddF32(arguments,  PS_LIST_TAIL, "-seeing-max", 0, "Seeing FWHM (arcsec) at end of ramp", NAN);
     
    203204    ppSimArgToRecipeS32(&status,  options, "BINNING",       arguments, "-bin");
    204205
     206    // add MJD of observation if defined
     207    ppSimArgToRecipeF32(&status,  options, "MJD.OBS",       arguments, "-mjd-obs"); // time/date of observation
     208
    205209    ppSimArgToRecipeS32(&status,  config->arguments, "NX.CELL", arguments, "-nx");
    206210    ppSimArgToRecipeS32(&status,  config->arguments, "NY.CELL", arguments, "-ny");
  • branches/eam_branches/ipp-pstamp-20260421/ppSim/src/ppSimInsertStars.c

    r41397 r43068  
    3131    float nSigmaLim = psMetadataLookupF32(NULL, recipe, "STARS.SIGMA.LIM"); // significance of faintest stars
    3232
     33    char *chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); //
     34    char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); //
     35
    3336    float readnoise = psMetadataLookupF32(NULL, cell->concepts, "CELL.READNOISE");// CCD read noise, e
    3437    if (isnan(readnoise)) {
     
    6265    assert (psf);
    6366
     67    // EAM : I think this dX,dY double-counts the offset applied to xChip,yChip in pmSourceFromModel
    6468    int dX = PM_CELL_TO_CHIP (0.0, x0Cell, xParityCell, binning);
    6569    int dY = PM_CELL_TO_CHIP (0.0, y0Cell, yParityCell, binning);
     70    dX = 0; dY = 0;
    6671
    6772    psArray *sources = psArrayAllocEmpty (stars->n);
     
    7075    char outname[1024];
    7176    char *outroot = psMetadataLookupStr(&mdok, config->arguments, "OUTPUT");
    72     sprintf (outname, "%s.dat", outroot);
     77    sprintf (outname, "%s.%s.%s.dat", outroot, chipName, cellName);
    7378
    7479    FILE *outfile = fopen (outname, "w");
     
    8186    for (long i = 0; i < stars->n; i++) {
    8287        ppSimStar *star = stars->data[i];
    83         psTrace("ppSim", 10, "Inserting star at %.1f,%.1f --> %.2f\n", star->x, star->y, star->flux);
    84 
    8588        // star->x,y are in fpa coordinates
    8689
     
    9295        float xCell = PM_CHIP_TO_CELL(xChip, x0Cell, xParityCell, binning);
    9396        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);
    9499
    95100        // XXX Note, the below does not put the edges of stars on the readout if they fall slightly off
     
    105110
    106111        // 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
    107113        pmModel *model = pmModelFromPSFforXY (psf, xChip, yChip, 1.0);
    108114        pmModelSetFlux (model, flux);
  • branches/eam_branches/ipp-pstamp-20260421/ppSim/src/ppSimLoadStars.c

    r41397 r43068  
    3737    psFree(bounds);
    3838
    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));
    4341    psMetadataAdd(astroRecipe, PS_LIST_TAIL, "DEC_MIN", PS_DATA_F32 | PS_META_REPLACE, "", dec0 - radius);
    4442    psMetadataAdd(astroRecipe, PS_LIST_TAIL, "DEC_MAX", PS_DATA_F32 | PS_META_REPLACE, "", dec0 + radius);
     
    8381        stars->data[oldSize + i] = star;
    8482
    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);
    8684    }
    8785    stars->n = oldSize + refStars->n;
  • branches/eam_branches/ipp-pstamp-20260421/ppSim/src/ppSimMakeBias.c

    r21365 r43068  
    1616    float biasLevel = psMetadataLookupF32(NULL, recipe, "BIAS.LEVEL"); // Bias level
    1717    float biasRange = psMetadataLookupF32(NULL, recipe, "BIAS.RANGE"); // Bias range
    18     int biasOrder  = psMetadataLookupS32(NULL, recipe, "BIAS.ORDER"); // Bias order
     18    int   biasOrder = psMetadataLookupS32(NULL, recipe, "BIAS.ORDER"); // Bias order
    1919
    2020    float readnoise = psMetadataLookupF32(NULL, cell->concepts, "CELL.READNOISE");// CCD read noise, e
     
    4040        biasPoly->coeff[j] = biasRange * psRandomGaussian(rng);
    4141    }
     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
    4246
    4347    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
    4550
    4651    for (int y = 0; y < numRows; y++) {
    4752        // 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;
    5057
    5158        for (int x = 0; x < numCols; x++) {
     
    6269}
    6370
     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  
    2323    float IQmin = psMetadataLookupF32 (&status, sequence, "IQ_MIN");
    2424    float IQmax = psMetadataLookupF32 (&status, sequence, "IQ_MAX");
     25
     26    float MJDmin = psMetadataLookupF32 (&status, sequence, "MJD_MIN");
     27    float MJDmax = psMetadataLookupF32 (&status, sequence, "MJD_MAX");
    2528
    2629    if (filters->n != exptimes->n) {
     
    101104                            double frnd = psRandomUniform(rng);
    102105                            float seeing = IQmin + (IQmax - IQmin)*frnd;
    103                          
    104106                            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);
    105111
    106112                            psStringAppend (&command, " %s", filename);
  • branches/eam_branches/ipp-pstamp-20260421/ppSim/src/ppSimUtils.c

    r43042 r43068  
    134134    float zeropoint = psMetadataLookupF32(NULL, recipe, "ZEROPOINT"); // Detector Temperature
    135135
     136    float MJDobs    = psMetadataLookupF32(NULL, recipe, "MJD.OBS"); // observation MJD
     137
    136138    const char *filter = psMetadataLookupStr(NULL, recipe, "FILTER"); // Filter name
    137139    if (!filter) {
     
    156158    psMetadataAddF32(fpa->concepts, PS_LIST_TAIL, "FPA.ZP",        PS_META_REPLACE, "Zero Point", zeropoint);
    157159
    158     // test time
    159     psTime *obstime = psTimeFromMJD (55440.0);
     160    // set time of the observation
     161    psTime *obstime = isfinite(MJDobs) ? psTimeFromMJD (MJDobs) : psTimeFromMJD (60000.0);
    160162    psMetadataAddTime(fpa->concepts, PS_LIST_TAIL, "FPA.TIME", PS_META_REPLACE, "sample time", obstime);
    161163
Note: See TracChangeset for help on using the changeset viewer.