IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23259 for trunk/ppSim


Ignore:
Timestamp:
Mar 10, 2009, 4:53:42 PM (17 years ago)
Author:
Paul Price
Message:

Changing API for psRandomAlloc() to make it easier to be deterministic. psRandomAlloc() now takes only a single argument, which is the generator type (only PS_RANDOM_TAUS is currently supported; others could easily be added). The seed used by the generator is set by psRandomSeed(). This allows us to use the same seed for the random number generator over multiple calls, which means that we can be deterministic by setting the seed. The old API for psRandomAlloc() is available using psRandomAllocSpecific(). Added to the configuration setup in psModules to include recording the random seed, and setting if desired. Updated all our products to use this API. Some fixes and updates to the configuration run-time information dumping. ppImage now dumps the configuration at the end, allowing the list of files in the run-time information to be set.

Location:
trunk/ppSim/src
Files:
3 edited

Legend:

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

    r20910 r23259  
    7474    }
    7575
    76     psRandom *pseudoRNG = psRandomAlloc(PS_RANDOM_TAUS, seed); // Pseudo-random number generator
     76    psRandom *pseudoRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, seed); // Pseudo-random number generator
    7777
    7878    psImage *image = readout->image;    // Image of interest
  • trunk/ppSim/src/ppSimLoop.c

    r21365 r23259  
    2525    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSIM_RECIPE); // Recipe
    2626
    27     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); // Random number generator
     27    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS); // Random number generator
    2828
    2929    char *typeStr = psMetadataLookupStr(NULL, recipe, "IMAGE.TYPE"); // Type of image to simulate
  • trunk/ppSim/src/ppSimSequence.c

    r19315 r23259  
    133133    if (ppsim_recipe) psStringAppend (&ppSimCommand, " -recipe PPSIM %s", ppsim_recipe);
    134134
    135     unsigned long seed = psMetadataLookupS32 (&status, config, "RND_SEED");
    136     if (!status) seed = 0;
    137     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, seed);
     135    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS);
    138136
    139137    psMetadataItem *item = psMetadataLookup (config, "SEQUENCE");
    140138    if (item == NULL) {
    141139        psLogMsg ("ppSimSequence", PS_LOG_WARN, "missing SEQUENCE description");
    142         exit (1);
     140        exit (PS_EXIT_CONFIG_ERROR);
    143141    }
    144142
     
    170168        }
    171169
    172         // determine the camera for the sequence and define the ppSim command
    173         if (camera == NULL) {
    174             camera = psMetadataLookupStr (&status, sequence, "CAMERA");
    175         }
    176 
    177         psString injectCommandReal = NULL;
    178         psString ppSimCommandReal = NULL;
    179 
    180         psStringAppend (&injectCommandReal, "%s --camera %s", injectCommand, camera);
    181         psStringAppend (&ppSimCommandReal, "%s -camera %s", ppSimCommand, camera);
     170        // determine the camera for the sequence and define the ppSim command
     171        if (camera == NULL) {
     172            camera = psMetadataLookupStr (&status, sequence, "CAMERA");
     173        }
     174
     175        psString injectCommandReal = NULL;
     176        psString ppSimCommandReal = NULL;
     177
     178        psStringAppend (&injectCommandReal, "%s --camera %s", injectCommand, camera);
     179        psStringAppend (&ppSimCommandReal, "%s -camera %s", ppSimCommand, camera);
    182180
    183181        if (!strcasecmp (type, "BIAS")) {
Note: See TracChangeset for help on using the changeset viewer.