IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 13, 2008, 4:56:38 PM (18 years ago)
Author:
eugene
Message:

substantial work on argument handling to support externally supplied images

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080511/ppSim/src/ppSimLoop.c

    r17630 r17672  
    11#include "ppSim.h"
     2
     3# define ESCAPE(CODE,MSG) { \
     4  psError(CODE, false, MSG); \
     5  psFree (rng); \
     6  return false; }
    27
    38bool ppSimLoop(pmConfig *config)
     
    813    pmFPAfile *file = psMetadataLookupPtr(NULL, config->files, OUTPUT_FILE); // Output file
    914    assert(file);
     15
    1016    pmFPA *fpa = file->fpa;             // FPA for file
    1117    assert(fpa);
    1218
    13     ppSimType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); // Type of image to simulate
     19    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSIM_RECIPE); // Recipe
    1420
    1521    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); // Random number generator
    1622
    17     int binning = psMetadataLookupS32(NULL, config->arguments, "BINNING"); // Binning in x and y
    18 
    19     // Load forced-photometry positions
    20     if (type == PPSIM_TYPE_OBJECT) {
    21       psArray *spots = ppSimLoadSpots (fpa, config);
    22     }
    23 
    24     // Load catalogue stars
     23    char *typeStr = psMetadataLookupStr(NULL, recipe, "IMAGE.TYPE"); // Type of image to simulate
     24    ppSimType type = ppSimTypeFromString (typeStr); // Type of image to simulate
     25    int binning = psMetadataLookupS32(NULL, recipe, "BINNING"); // Binning in x and y
     26
    2527    psArray *stars = psArrayAllocEmpty (1);
    26     if (type == PPSIM_TYPE_OBJECT) {
    27         ppSimLoadStars (stars, fpa, config);
    28     }
    29 
    30     // Add random stars
    31     if (type == PPSIM_TYPE_OBJECT) {
    32         ppSimMakeStars (stars, fpa, config, rng);
    33     }
    34 
    35     // Add random galaxies
    3628    psArray *galaxies = psArrayAllocEmpty (1);
    3729    if (type == PPSIM_TYPE_OBJECT) {
    38         ppSimMakeGalaxies (galaxies, fpa, config, rng);
     30        // Load forced-photometry positions
     31        if (!ppSimLoadSpots (fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load forced-photometry spots");
     32
     33        // Load catalogue stars
     34        if (!ppSimLoadStars (stars, fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load catalog stars");
     35
     36        // Add random stars
     37        if (!ppSimMakeStars (stars, fpa, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "failed to make random stars");
     38
     39        // Add random galaxies
     40        if (!ppSimMakeGalaxies (galaxies, fpa, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "failed to make random galaxies");
    3941    }
    4042
     
    176178        }
    177179
    178         ppSimMosaicChip(config, blankMask, view, "PPSIM.CHIP", "PPSIM.OUTPUT");
    179 
    180180        // we perform photometry on the readouts of this chip in the output
    181181        ppSimPhotom (config, view);
Note: See TracChangeset for help on using the changeset viewer.