IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 9, 2007, 6:03:19 PM (19 years ago)
Author:
eugene
Message:

splitting ppSimLoop into a number of stand-alone functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSim/src/ppSim.h

    r12996 r14463  
    11#ifndef PP_SIM_H
    22#define PP_SIM_H
     3
     4#ifdef HAVE_CONFIG_H
     5#include <config.h>
     6#endif
     7
     8#include <stdio.h>
     9#include <strings.h>
     10#include <pslib.h>
     11#include <psmodules.h>
     12#include <psastro.h>
    313
    414#define PPSIM_RECIPE "PPSIM"
    515#define OUTPUT_FILE "PPSIM.OUTPUT"
    616
     17// Compare a value with minimum and maximum values, replacing where required.
     18#define COMPARE(VALUE,MIN,MAX) { \
     19        if (VALUE < MIN) { MIN = VALUE; } \
     20        if (VALUE > MAX) { MAX = VALUE; } \
     21    }
     22
     23// Return cell position, given an FPA position; calculations are all done in pixel units
     24#define PPSIM_FPA_TO_CELL(pos, cell0, cellParity, binning, chip0, chipParity) \
     25    (((pos) - (chip0))*(chipParity) - (cell0))*(cellParity) / (binning)
    726
    827
     28// Return FPA position, given a cell position; calculations are all done in pixel units
     29#define PPSIM_CELL_TO_FPA(pos, cell0, cellParity, binning, chip0, chipParity) \
     30    ((chip0) + (binning)*(chipParity)*((cell0) + (cellParity)*(pos)))
    931
    1032// Type of image to simulate
     
    1638} ppSimType;
    1739
     40typedef struct {
     41    double ra;
     42    double dec;
     43    float mag;
     44    float x;
     45    float y;
     46    float flux;
     47    float peak;
     48} ppSimStar;
     49
     50
     51ppSimStar *ppSimStarAlloc ();
    1852
    1953/// Parse command-line arguments
    2054void ppSimArguments(int argc, char *argv[], ///< Command-line arguments
    21                     pmConfig *config ///< Configuration
    22     );
     55                    pmConfig *config ///< Configuration
     56                    );
    2357
    2458/// Create output file
     
    2660/// Returns a borrowed pointer to the FPA file.
    2761pmFPAfile *ppSimCreate(pmConfig *config ///< Configuration
    28     );
     62                       );
     63
     64// Return bounds of a chip, based on the concepts
     65psRegion *ppSimChipBounds(const pmChip *chip, // Chip for which to determine size
     66                          pmFPAview *view // View for chip
     67                          );
     68
     69// Return bounds of an FPA, based on the concepts
     70psRegion *ppSimFPABounds(const pmFPA *fpa       // FPA for which to determine size
     71                         );
    2972
    3073/// Loop over the output file, generating simulated data
    3174psExit ppSimLoop(pmConfig *config ///< Configuration
    32     );
     75                );
    3376
     77// Add a star into the signal and variance images
     78bool ppSimInsertStar(psImage *signal,       // Signal image, to which to add star
     79                     psImage *variance,     // Variance image, to which to add star
     80                     float x0, float y0,    // Position of star
     81                     float peak,            // Peak flux of star
     82                     float noise,           // Rough noise estimate
     83                     float seeing,          // Seeing for star
     84                     const psImage *correction // Exposure correction as a function of position
     85                     );
    3486
     87psArray *ppSimLoadStars (pmFPA *fpa, pmConfig *config);
     88bool ppSimMakeStars(psArray *stars, pmFPA *fpa, pmConfig *config, const psRandom *rng);
     89
     90psVector *ppSimMakeBiassec (pmCell *cell, pmConfig *config);
     91psVector *ppSimMakeBias (psImage *signal, psImage *variance, pmCell *cell, pmConfig *config, const psRandom *rng) ;
     92bool ppSimMakeDark (psImage *signal, psImage *variance, pmConfig *config);
     93bool ppSimMakeSky (psImage *signal, psImage *variance, psImage *expCorr, ppSimType type, pmConfig *config, pmFPA *fpa, pmChip *chip, pmCell *cell);
     94bool ppSimInsertStars (psImage *signal, psImage *variance, psImage *expCorr, psArray *stars, pmConfig *config, pmChip *chip, pmCell *cell);
     95
     96bool ppSimInitHeader(pmConfig *config,
     97                     pmFPA *fpa,
     98                     pmChip *chip,
     99                     pmCell *cell);
     100
     101bool ppSimSaturate(psImage *image,      // Image to apply saturation
     102                   const pmConfig *config,                     
     103                   const pmCell *cell); // Saturation level
     104
     105bool ppSimUpdateConceptsFPA (pmFPA *fpa, pmConfig *config);
     106bool ppSimUpdateConceptsCell (pmCell *cell, pmConfig *config);
     107
     108bool ppSimAddOverscan (pmReadout *readout, pmConfig *config, psVector *biasCols, psVector *biasRows, psRandom *rng);
     109
     110psImage *ppSimAddNoise(psImage *signal, // Signal image, modified and returned
     111                       const psImage *variance, // Variance image
     112                       const pmConfig *config,                 
     113                       const pmCell *cell,
     114                       const psRandom *rng // Random number generator
     115                       );
    35116
    36117#endif
Note: See TracChangeset for help on using the changeset viewer.