IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12973


Ignore:
Timestamp:
Apr 23, 2007, 3:05:14 PM (19 years ago)
Author:
Paul Price
Message:

Adding binning

Location:
trunk/ppSim/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSim/src/ppSimArguments.c

    r12971 r12973  
    171171        usage(arguments, config);
    172172    }
    173     psMetadataAddS32(config->arguments, PS_LIST_TAIL, "-bin", 0, "Binning in x and y", bin);
     173    psMetadataAddS32(config->arguments, PS_LIST_TAIL, "BINNING", 0, "Binning in x and y", bin);
    174174
    175175    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Name of the output image",
  • trunk/ppSim/src/ppSimLoop.c

    r12939 r12973  
    1919                             int cell0, // Cell offset
    2020                             int cellParity, // Cell parity
     21                             int binning, // Binning factor
    2122                             int chip0, // Chip offset
    2223                             int chipParity // Chip parity
    2324    )
    2425{
    25     return (chip0 + chipParity * (cell0 + cellParity * pos));
     26    return (chip0 + binning * chipParity * (cell0 + cellParity * pos));
    2627}
    2728
     
    3031                             int cell0, // Cell offset
    3132                             int cellParity, // Cell parity
     33                             int binning, // Binning factor
    3234                             int chip0, // Chip offset
    3335                             int chipParity // Chip parity
    3436    )
    3537{
    36     return ((pos - chip0) * chipParity - cell0) * cellParity;
     38    return ((pos - chip0) * chipParity - cell0) * cellParity / binning;
    3739}
    3840
     
    9597
    9698        // "Left", "Right", "Bottom" and "Top" don't take into account the parity
    97         int cellLeft = cell2fpa(0, x0Cell, xParityCell, x0Chip, xParityChip);
    98         int cellRight = cell2fpa(xSize, x0Cell, xParityCell, x0Chip, xParityChip);
    99         int cellBottom = cell2fpa(0, y0Cell, yParityCell, y0Chip, yParityChip);
    100         int cellTop = cell2fpa(ySize, y0Cell, yParityCell, y0Chip, yParityChip);
     99        int cellLeft = cell2fpa(0, x0Cell, xParityCell, 1, x0Chip, xParityChip);
     100        int cellRight = cell2fpa(xSize, x0Cell, xParityCell, 1, x0Chip, xParityChip);
     101        int cellBottom = cell2fpa(0, y0Cell, yParityCell, 1, y0Chip, yParityChip);
     102        int cellTop = cell2fpa(ySize, y0Cell, yParityCell, 1, y0Chip, yParityChip);
    101103
    102104        COMPARE(cellLeft, xMin, xMax);
     
    262264    float starsMag = psMetadataLookupF32(NULL, config->arguments, "STARS.MAG"); // Star brightest magnitude
    263265    float starsDensity = psMetadataLookupF32(NULL, config->arguments, "STARS.DENSITY"); // Density of fakes
     266    int binning = psMetadataLookupS32(NULL, config->arguments, "BINNING"); // Binning in x and y
    264267
    265268    float expTime = psMetadataLookupF32(NULL, config->arguments, "EXPTIME"); // Exposure time
     
    439442
    440443            // Size, position and orientation of cell
    441             int numCols = psMetadataLookupS32(NULL, cell->concepts, "CELL.XSIZE");
    442             int numRows = psMetadataLookupS32(NULL, cell->concepts, "CELL.YSIZE");
     444            int numCols = psMetadataLookupS32(NULL, cell->concepts, "CELL.XSIZE") / binning;
     445            int numRows = psMetadataLookupS32(NULL, cell->concepts, "CELL.YSIZE") / binning;
    443446            int x0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.X0");
    444447            int y0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0");
     
    547550                    rowBias->data.F32[y] = psPolynomial1DEval(biasPoly, (float)(y + biasOffset) /
    548551                                                              (float)numRows - 0.5) + biasLevel;
    549                     float yFPA = cell2fpa(y, y0Cell, yParityCell, y0Chip, yParityChip) * 2.0 /
     552                    float yFPA = cell2fpa(y, y0Cell, yParityCell, binning, y0Chip, yParityChip) * 2.0 /
    550553                        (bounds->y1 - bounds->y0); // Relative y position in FPA
    551554
    552555                    for (int x = 0; x < numCols; x++) {
    553                         float xFPA = cell2fpa(x, x0Cell, xParityCell, x0Chip, xParityChip) * 2.0 /
     556                        float xFPA = cell2fpa(x, x0Cell, xParityCell, binning, x0Chip, xParityChip) * 2.0 /
    554557                            (bounds->x1 - bounds->x0); // Relative x position in FPA
    555558
     
    602605                    for (long j = 0; j < ra->n; j++) {
    603606                        // Position on the cell and peak flux
    604                         float x = fpa2cell(ra->data.F32[j], x0Cell, xParityCell, x0Chip, xParityChip);
    605                         float y = fpa2cell(dec->data.F32[j], y0Cell, yParityCell, y0Chip, yParityChip);
     607                        float x = fpa2cell(ra->data.F32[j], x0Cell, xParityCell, binning,
     608                                           x0Chip, xParityChip);
     609                        float y = fpa2cell(dec->data.F32[j], y0Cell, yParityCell, binning,
     610                                           y0Chip, yParityChip);
    606611                        float flux = mag->data.F32[j];
    607612                        star(signal, variance, x, y, flux, roughNoise, seeing, expCorr);
     
    641646            psMetadataAddF32(cell->concepts, PS_LIST_TAIL, "CELL.DARKTIME", PS_META_REPLACE,
    642647                             "Dark time (sec)", expTime);
     648            psMetadataAddS32(cell->concepts, PS_LIST_TAIL, "CELL.XBIN", PS_META_REPLACE,
     649                             "Binning in x", binning);
     650            psMetadataAddS32(cell->concepts, PS_LIST_TAIL, "CELL.YBIN", PS_META_REPLACE,
     651                             "Binning in y", binning);
    643652
    644653            if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
Note: See TracChangeset for help on using the changeset viewer.