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/ppSimSequenceFlat.c

    r19315 r25069  
    11# include "ppSimSequence.h"
    22
    3 bool ppSimSequenceFlat (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *ppSimCommand, const char *injectCommand) {
     3bool ppSimSequenceFlat (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;
     
    1212
    1313    if (filters->n != exptimes->n) {
    14         psLogMsg ("ppSimSequence", PS_LOG_WARN, "mis-match in filter and exptime lists");
    15         exit (1);
     14            psLogMsg ("ppSimSequence", PS_LOG_WARN, "mis-match in filter and exptime lists");
     15            exit (1);
    1616    }
    1717
     
    2424    for (int i = 0; i < filters->n; i++) {
    2525           
    26         // loop over the filters & exposure times
    27         for (int j = 0; j < nSetup; j++) {
    28            
    29             // define the output filename
    30             psString filename = NULL;
    31             if (path) {
    32                 psStringAppend (&filename, "%s/%s.%03d.%03d", path, basename, nSeq, nImage);
    33             } else {
    34                 psStringAppend (&filename, "%s.%03d.%03d", basename, nSeq, nImage);
     26            // loop over the filters & exposure times
     27            for (int j = 0; j < nSetup; j++) {
     28               
     29                // define the output filename
     30                psString filename = NULL;
     31                if (path) {
     32                        psStringAppend (&filename, "%s/%s.%03d.%03d", path, basename, nSeq, nImage);
     33                } else {
     34                        psStringAppend (&filename, "%s.%03d.%03d", basename, nSeq, nImage);
     35                }
     36
     37                // define the ppSim comand
     38                psString command = NULL;
     39
     40                psStringAppend (&command, "%s -type FLAT", ppSimCommand);
     41
     42                psStringAppend (&command, " -filter %s", (char *) filters->data[i]);
     43                psStringAppend (&command, " -exptime %f", exptimes->data.F32[i]);
     44
     45                psStringAppend (&command, " %s", filename);
     46
     47                fprintf (simfile, "%s\n", command);
     48                psFree (command);
     49
     50                        // define the inject command
     51                // path should be dirname/filename
     52                        // for SIMTEST camera nebulous insertion append .fits
     53                        // SIMMOSAIC nebulous insertions are appended with ChipXX.fits
     54                        // non-nebulous insertions use *.fits
     55                        const char *neb = "neb";
     56
     57                        if (strncmp (path, neb, 3) == 0) {
     58                                if (strcmp (camera, "SIMTEST") == 0) {
     59                                        command = psStringCopy (injectCommand);
     60                                        psStringAppend (&command, " %s.fits", filename);
     61                                        fprintf (inject, "%s\n", command);
     62                                       
     63                                } else if (strcmp (camera, "SIMMOSAIC") == 0) {
     64                                        for (int i = 0; i < 2; i++) {
     65                                                for (int j = 0; j < 2; j++) {
     66                                                        command = psStringCopy (injectCommand);
     67                                                psStringAppend (&command, " %s.Chip%d%d.fits", filename, i, j);
     68                                                        fprintf (inject, "%s\n", command);
     69                                                command = NULL;
     70                                                }
     71                                        }
     72                                           
     73                } else {
     74                    psLogMsg ("ppSimSequence", PS_LOG_WARN, "unsupported camera type for nebulous insertion");
     75                    exit (1);
     76                }
     77               
     78            } else {
     79                command = psStringCopy (injectCommand);
     80                psStringAppend (&command, " %s*.fits",    filename);
     81                fprintf (inject, "%s\n", command);
     82            }
     83       
     84                        psFree (command);
     85            psFree (filename);
     86            nImage ++;
    3587            }
    36 
    37             // define the ppSim comand
    38             psString command = NULL;
    39 
    40             psStringAppend (&command, "%s -type FLAT", ppSimCommand);
    41 
    42             psStringAppend (&command, " -filter %s", (char *) filters->data[i]);
    43             psStringAppend (&command, " -exptime %f", exptimes->data.F32[i]);
    44 
    45             psStringAppend (&command, " %s", filename);
    46 
    47             fprintf (simfile, "%s\n", command);
    48             psFree (command);
    49 
    50             // define the inject command
    51             // path should be dirname/filename
    52             command = psStringCopy (injectCommand);
    53             psStringAppend (&command, " %s*.fits",    filename);
    54             fprintf (inject, "%s\n", command);
    55             psFree (command);
    56             psFree (filename);
    57 
    58             nImage ++;
    59         }
    6088    }
    6189    return true;
Note: See TracChangeset for help on using the changeset viewer.