IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 13, 2009, 4:08:06 PM (17 years ago)
Author:
giebink
Message:

Support for simtests using nebulous for SIMTEST and SIMMOSAIC cameras.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/simtest_nebulous_branches/ppSim/src/ppSimSequenceBias.c

    r19315 r25069  
    11# include "ppSimSequence.h"
    22
    3 bool ppSimSequenceBias (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *ppSimCommand, const char *injectCommand) {
     3bool ppSimSequenceBias (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *ppSimCommand, const char *injectCommand, const char *camera) {
    44
    55    bool status, setLevel, setRange;
     
    1414    int nImage = 0;
    1515    for (int i = 0; i < nImages; i++) {
    16            
    17         // define the output filename
    18         psString filename = NULL;
    19         if (path) {
    20             psStringAppend (&filename, "%s/%s.%03d.%03d", path, basename, nSeq, nImage);
    21         } else {
    22             psStringAppend (&filename, "%s.%03d.%03d", basename, nSeq, nImage);
    23         }
     16               
     17            // define the output filename
     18            psString filename = NULL;
     19            if (path) {
     20                psStringAppend (&filename, "%s/%s.%03d.%03d", path, basename, nSeq, nImage);
     21            } else {
     22                psStringAppend (&filename, "%s.%03d.%03d", basename, nSeq, nImage);
     23            }
    2424
    25         // define the ppSim command
    26         psString command = NULL;
     25            // define the ppSim command
     26            psString command = NULL;
    2727
    28         psStringAppend (&command, "%s -type BIAS", ppSimCommand);
     28            psStringAppend (&command, "%s -type BIAS", ppSimCommand);
    2929
    30         if (setLevel) psStringAppend (&command, " -biaslevel %f", level);
    31         if (setRange) psStringAppend (&command, " -biasrange %f", range);
    32      
    33         psStringAppend (&command, " %s", filename);
     30            if (setLevel) psStringAppend (&command, " -biaslevel %f", level);
     31            if (setRange) psStringAppend (&command, " -biasrange %f", range);
     32         
     33            psStringAppend (&command, " %s", filename);
    3434
    35         fprintf (simfile, "%s\n", command);
    36         psFree (command);
     35            fprintf (simfile, "%s\n", command);
     36            psFree (command);
     37                               
     38        // define the inject command
     39                // path should be dirname/filename
     40                // for SIMTEST camera nebulous insertion append .fits
     41                // SIMMOSAIC nebulous insertions are appended with ChipXX.fits
     42                // non-nebulous insertions use *.fits
     43                const char *neb = "neb";
     44
     45                if (strncmp (path, neb, 3) == 0) {
    3746                           
    38         // define the inject command
    39         // path should be dirname/filename
    40         command = psStringCopy (injectCommand);
    41         psStringAppend (&command, " %s*.fits",    filename);
    42         fprintf (inject, "%s\n", command);
    43         psFree (command);
    44         psFree (filename);
     47            if (strcmp (camera, "SIMTEST") == 0) {
     48                command = psStringCopy (injectCommand);
     49                psStringAppend (&command, " %s.fits", filename);
     50                fprintf (inject, "%s\n", command);
     51                                   
     52            } else if (strcmp (camera, "SIMMOSAIC") == 0) {
     53                for (int i = 0; i < 2; i++) {
     54                    for (int j = 0; j < 2; j++) {
     55                        command = psStringCopy (injectCommand);
     56                                    psStringAppend (&command, " %s.Chip%d%d.fits", filename, i, j);
     57                                    fprintf (inject, "%s\n", command);
     58                                        command = NULL;
     59                                        }
     60                }
     61                                       
     62            } else {
     63                psLogMsg ("ppSimSequence", PS_LOG_WARN, "unsupported camera type for nebulous insertion");
     64                                exit (1);
     65            }
     66           
     67        } else {
     68            command = psStringCopy (injectCommand);
     69            psStringAppend (&command, " %s*.fits",    filename);
     70            fprintf (inject, "%s\n", command);
     71        }
    4572
    46         nImage ++;
     73        psFree (command);
     74        psFree (filename);
     75        nImage ++;
    4776    }
    4877    return true;
Note: See TracChangeset for help on using the changeset viewer.