IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25069


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.

Location:
branches/simtest_nebulous_branches/ppSim/src
Files:
6 edited

Legend:

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

    r23259 r25069  
    180180
    181181        if (!strcasecmp (type, "BIAS")) {
    182             ppSimSequenceBias (simfile, inject, sequence, i, rng, path, basename, ppSimCommandReal, injectCommandReal);
     182            ppSimSequenceBias (simfile, inject, sequence, i, rng, path, basename, ppSimCommandReal, injectCommandReal, camera);
    183183            continue;
    184184        }
    185185        if (!strcasecmp (type, "DARK")) {
    186             ppSimSequenceDark (simfile, inject, sequence, i, rng, path, basename, ppSimCommandReal, injectCommandReal);
     186            ppSimSequenceDark (simfile, inject, sequence, i, rng, path, basename, ppSimCommandReal, injectCommandReal, camera);
    187187            continue;
    188188        }
    189189        if (!strcasecmp (type, "FLAT")) {
    190             ppSimSequenceFlat (simfile, inject, sequence, i, rng, path, basename, ppSimCommandReal, injectCommandReal);
     190            ppSimSequenceFlat (simfile, inject, sequence, i, rng, path, basename, ppSimCommandReal, injectCommandReal, camera);
    191191            continue;
    192192        }
    193193        if (!strcasecmp (type, "OBJECT")) {
    194             ppSimSequenceObject (simfile, inject, sequence, i, rng, path, basename, ppSimCommandReal, injectCommandReal);
     194            ppSimSequenceObject (simfile, inject, sequence, i, rng, path, basename, ppSimCommandReal, injectCommandReal, camera);
    195195            continue;
    196196        }
  • branches/simtest_nebulous_branches/ppSim/src/ppSimSequence.h

    r19315 r25069  
    1212#include <psastro.h>
    1313
    14 bool ppSimSequenceBias   (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *ppSimCommand, const char *injectCommand);
    15 bool ppSimSequenceDark   (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *ppSimCommand, const char *injectCommand);
    16 bool ppSimSequenceFlat   (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *ppSimCommand, const char *injectCommand);
    17 bool ppSimSequenceObject (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *ppSimCommand, const char *injectCommand);
     14bool 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);
     15bool ppSimSequenceDark   (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);
     16bool 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);
     17bool ppSimSequenceObject (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);
    1818
    1919#endif
  • 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;
  • branches/simtest_nebulous_branches/ppSim/src/ppSimSequenceDark.c

    r19315 r25069  
    11# include "ppSimSequence.h"
    22
    3 bool ppSimSequenceDark (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *ppSimCommand, const char *injectCommand) {
     3bool ppSimSequenceDark (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, setRate;
     
    99    min = psMetadataLookupF32 (&status, sequence, "DARK.MIN");
    1010    if (status) {
    11         max = psMetadataLookupF32 (&status, sequence, "DARK.MAX");
    12         setRate = true;
     11                max = psMetadataLookupF32 (&status, sequence, "DARK.MAX");
     12                setRate = true;
    1313    }
    1414
     
    2222    for (int i = 0; i < nImages->n; i++) {
    2323           
    24         float exptime = exptimes->data.F32[i];
    25         float n = nImages->data.S32[i];
     24                float exptime = exptimes->data.F32[i];
     25                float n = nImages->data.S32[i];
    2626
    27         for (int j = 0; j < n; j++) {
     27            for (int j = 0; j < n; j++) {
    2828
    29             // XXX need to add 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             }
     29                // XXX need to add 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                }
    3636
    37             // define the ppSim command
    38             psString command = NULL;
     37                // define the ppSim command
     38                psString command = NULL;
    3939
    40             psStringAppend (&command, "%s -type DARK", ppSimCommand);
    41      
    42             if (setRate) {
    43                 double frnd = psRandomUniform(rng);
    44                 float rate = min + (max - min)*frnd;
    45                 psStringAppend (&command, " -darkrate %f", rate);
    46             }
     40                psStringAppend (&command, "%s -type DARK", ppSimCommand);
     41         
     42                if (setRate) {
     43                                double frnd = psRandomUniform(rng);
     44                                float rate = min + (max - min)*frnd;
     45                                psStringAppend (&command, " -darkrate %f", rate);
     46                }
    4747
    48             psStringAppend (&command, " -exptime %f", exptime);
     48                psStringAppend (&command, " -exptime %f", exptime);
    4949
    50             psStringAppend (&command, " %s", filename);
     50                psStringAppend (&command, " %s", filename);
    5151
    52             fprintf (simfile, "%s\n", command);
    53             psFree (command);
    54                            
    55             // define the inject command
    56             // path should be dirname/filename
    57             command = psStringCopy (injectCommand);
    58             psStringAppend (&command, " %s*.fits",    filename);
    59             fprintf (inject, "%s\n", command);
    60             psFree (command);
    61             psFree (filename);
     52                fprintf (simfile, "%s\n", command);
     53                psFree (command);
     54                               
     55                // define the inject command
     56                    // path should be dirname/filename
     57                    // for SIMTEST camera nebulous insertion append .fits
     58                    // SIMMOSAIC nebulous insertions are appended with ChipXX.fits
     59                    // non-nebulous insertions use *.fits
     60                    const char *neb = "neb";
    6261
    63             nImage ++;
    64         }
     62                    if (strncmp (path, neb, 3) == 0) {
     63                               
     64                if (strcmp (camera, "SIMTEST") == 0) {
     65                    command = psStringCopy (injectCommand);
     66                    psStringAppend (&command, " %s.fits", filename);
     67                    fprintf (inject, "%s\n", command);
     68                                       
     69                } else if (strcmp (camera, "SIMMOSAIC") == 0) {
     70                    for (int i = 0; i < 2; i++) {
     71                        for (int j = 0; j < 2; j++) {
     72                            command = psStringCopy (injectCommand);
     73                                        psStringAppend (&command, " %s.Chip%d%d.fits", filename, i, j);
     74                                        fprintf (inject, "%s\n", command);
     75                                            command = NULL;
     76                                            }
     77                    }
     78                                           
     79                } else {
     80                    psLogMsg ("ppSimSequence", PS_LOG_WARN, "unsupported camera type for nebulous insertion");
     81                    exit (1);
     82                }
     83               
     84            } else {
     85                command = psStringCopy (injectCommand);
     86                psStringAppend (&command, " %s*.fits",    filename);
     87                fprintf (inject, "%s\n", command);
     88            }
     89
     90            psFree (command);
     91            psFree (filename);
     92            nImage ++;
     93        }
    6594    }
    6695    return true;
  • 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;
  • branches/simtest_nebulous_branches/ppSim/src/ppSimSequenceObject.c

    r24099 r25069  
    11# include "ppSimSequence.h"
    22
    3 bool ppSimSequenceObject (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *ppSimCommand, const char *injectCommand) {
     3bool ppSimSequenceObject (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;
     
    2525
    2626    if (filters->n != exptimes->n) {
    27         psLogMsg ("ppSimSequence", PS_LOG_WARN, "mis-match in filter and exptime lists");
    28         exit (1);
     27            psLogMsg ("ppSimSequence", PS_LOG_WARN, "mis-match in filter and exptime lists");
     28            exit (1);
    2929    }
    3030
     
    3434    // loop over the filters & exposure times
    3535    for (int i = 0; i < filters->n; i++) {
    36            
    37         // offset parameters
    38         float dR = psMetadataLookupF32 (&status, sequence, "OFFSET.RA");
    39         float dD = psMetadataLookupF32 (&status, sequence, "OFFSET.DEC");
    40  
    41         int nR = psMetadataLookupS32 (&status, sequence, "OFFSET.NR");
    42         int nD = psMetadataLookupS32 (&status, sequence, "OFFSET.ND");
    43  
    44         // loop over the offset sequence
    45         for (int iR = 0; iR < nR; iR++) {
    46             for (int iD = 0; iD < nD; iD++) {
     36               
     37            // offset parameters
     38            float dR = psMetadataLookupF32 (&status, sequence, "OFFSET.RA");
     39            float dD = psMetadataLookupF32 (&status, sequence, "OFFSET.DEC");
     40     
     41            int nR = psMetadataLookupS32 (&status, sequence, "OFFSET.NR");
     42            int nD = psMetadataLookupS32 (&status, sequence, "OFFSET.ND");
     43     
     44            // loop over the offset sequence
     45            for (int iR = 0; iR < nR; iR++) {
     46                for (int iD = 0; iD < nD; iD++) {
    4747
    48                 // RA & DEC in degrees XXX (should be radians...)
    49                 // offsets are in arcseconds
    50                 float R = Ro + dR*(iR - 0.5*nR + 0.5) / cos (RAD_DEG*Do) / 3600.0;
    51                 float D = Do + dD*(iD - 0.5*nD + 0.5) / 3600.0;
    52      
    53                 // dither parameters
    54                 float dr = psMetadataLookupF32 (&status, sequence, "DITHER.RA");
    55                 float dd = psMetadataLookupF32 (&status, sequence, "DITHER.DEC");
    56  
    57                 int nr = psMetadataLookupS32 (&status, sequence, "DITHER.NR");
    58                 int nd = psMetadataLookupS32 (&status, sequence, "DITHER.ND");
    59  
    60                 // loop over the dither sequence
    61                 for (int ir = 0; ir < nr; ir++) {
    62                     for (int id = 0; id < nd; id++) {
     48                        // RA & DEC in degrees XXX (should be radians...)
     49                        // offsets are in arcseconds
     50                        float R = Ro + dR*(iR - 0.5*nR + 0.5) / cos (RAD_DEG*Do) / 3600.0;
     51                        float D = Do + dD*(iD - 0.5*nD + 0.5) / 3600.0;
     52             
     53                        // dither parameters
     54                        float dr = psMetadataLookupF32 (&status, sequence, "DITHER.RA");
     55                        float dd = psMetadataLookupF32 (&status, sequence, "DITHER.DEC");
     56         
     57                        int nr = psMetadataLookupS32 (&status, sequence, "DITHER.NR");
     58                        int nd = psMetadataLookupS32 (&status, sequence, "DITHER.ND");
     59         
     60                        // loop over the dither sequence
     61                        for (int ir = 0; ir < nr; ir++) {
     62                            for (int id = 0; id < nd; id++) {
    6363
    64                         // ra, dec in degrees; offsets in arcsec
    65                         float ra = R + dr*(ir - 0.5*nr + 0.5) / cos (RAD_DEG*D) / 3600.0;
    66                         float dec = D + dd*(id - 0.5*nd + 0.5) / 3600.0;
    67          
    68                         // rotation sequence parameters
    69                         float pos_min   = psMetadataLookupF32 (&status, sequence, "POS_MIN");
    70                         float pos_max   = psMetadataLookupF32 (&status, sequence, "POS_MAX");
    71                         float pos_delta = psMetadataLookupF32 (&status, sequence, "POS_DELTA");
    72                         assert (pos_delta > 0.0);
    73                         assert (pos_max >= pos_min);
    74            
    75                         // loop over rotation sequence
    76                         for (float pos = pos_min; pos <= pos_max; pos += pos_delta) {
    77              
    78                             // define the output filename
    79                             psString filename = NULL;
    80                             if (path) {
    81                                 psStringAppend (&filename, "%s/%s.%03d.%03d", path, basename, nSeq, nImage);
    82                             } else {
    83                                 psStringAppend (&filename, "%s.%03d.%03d", basename, nSeq, nImage);
    84                             }
     64                                    // ra, dec in degrees; offsets in arcsec
     65                                    float ra = R + dr*(ir - 0.5*nr + 0.5) / cos (RAD_DEG*D) / 3600.0;
     66                                    float dec = D + dd*(id - 0.5*nd + 0.5) / 3600.0;
     67                     
     68                                    // rotation sequence parameters
     69                                    float pos_min   = psMetadataLookupF32 (&status, sequence, "POS_MIN");
     70                                    float pos_max   = psMetadataLookupF32 (&status, sequence, "POS_MAX");
     71                                    float pos_delta = psMetadataLookupF32 (&status, sequence, "POS_DELTA");
     72                                    assert (pos_delta > 0.0);
     73                                    assert (pos_max >= pos_min);
     74                       
     75                                    // loop over rotation sequence
     76                                    for (float pos = pos_min; pos <= pos_max; pos += pos_delta) {
     77                         
     78                                        // define the output filename
     79                                        psString filename = NULL;
     80                                        if (path) {
     81                                                psStringAppend (&filename, "%s/%s.%03d.%03d", path, basename, nSeq, nImage);
     82                                        } else {
     83                                                psStringAppend (&filename, "%s.%03d.%03d", basename, nSeq, nImage);
     84                                        }
    8585
    86                             // define the ppSim command
    87                             psString command = NULL;
     86                                        // define the ppSim command
     87                                        psString command = NULL;
    8888
    89                             psStringAppend (&command, "%s -type OBJECT", ppSimCommand);
    90                             psStringAppend (&command, " -filter %s", (char *) filters->data[i]);
    91                             psStringAppend (&command, " -exptime %f", exptimes->data.F32[i]);
    92                             psStringAppend (&command, " -skymags %f", skymags->data.F32[i]);
     89                                        psStringAppend (&command, "%s -type OBJECT", ppSimCommand);
     90                                        psStringAppend (&command, " -filter %s", (char *) filters->data[i]);
     91                                        psStringAppend (&command, " -exptime %f", exptimes->data.F32[i]);
     92                                        psStringAppend (&command, " -skymags %f", skymags->data.F32[i]);
    9393
    94                             psStringAppend (&command, " -ra %f", ra);
    95                             psStringAppend (&command, " -dec %f", dec);
    96                             psStringAppend (&command, " -pa %f", pos);
    97                             psStringAppend (&command, " -obs_mode OBJECT.%s", (char *) filters->data[i]);
     94                                        psStringAppend (&command, " -ra %f", ra);
     95                                        psStringAppend (&command, " -dec %f", dec);
     96                                        psStringAppend (&command, " -pa %f", pos);
     97                                        psStringAppend (&command, " -obs_mode OBJECT.%s", (char *) filters->data[i]);
    9898
    99                             double frnd = psRandomUniform(rng);
    100                             float seeing = IQmin + (IQmax - IQmin)*frnd;
    101              
    102                             psStringAppend (&command, " -seeing %f", seeing);
     99                                        double frnd = psRandomUniform(rng);
     100                                        float seeing = IQmin + (IQmax - IQmin)*frnd;
     101                         
     102                                        psStringAppend (&command, " -seeing %f", seeing);
    103103
    104                             psStringAppend (&command, " %s", filename);
     104                                        psStringAppend (&command, " %s", filename);
    105105
    106                             fprintf (simfile, "%s\n", command);
    107                             psFree (command);
    108                            
    109                             // define the inject command
    110                             // path should be dirname/filename
    111                             command = psStringCopy (injectCommand);
    112                             psStringAppend (&command, " %s*.fits",    filename);
    113                             fprintf (inject, "%s\n", command);
    114                             psFree (command);
    115                             psFree (filename);
     106                                        fprintf (simfile, "%s\n", command);
     107                                        psFree (command);
     108                                       
     109                                        // define the inject command
     110                                        // path should be dirname/filename
     111                                        // for SIMTEST camera nebulous insertion append .fits
     112                                        // SIMMOSAIC nebulous insertions are appended with ChipXX.fits
     113                                        // non-nebulous insertions use *.fits
     114                                        const char *neb = "neb";
    116115
    117                             nImage ++;
    118                         }
    119                     }
    120                 }
     116                                        if (strncmp (path, neb, 3) == 0) {
     117                                       
     118                                            if (strcmp (camera, "SIMTEST") == 0) {
     119                                                command = psStringCopy (injectCommand);
     120                                                psStringAppend (&command, " %s.fits", filename);
     121                                                fprintf (inject, "%s\n", command);
     122                                               
     123                                                                } else if (strcmp (camera, "SIMMOSAIC") == 0) {
     124                                                                        for (int i = 0; i < 2; i++) {
     125                                                        for (int j = 0; j < 2; j++) {
     126                                                                        command = psStringCopy (injectCommand);
     127                                                        psStringAppend (&command, " %s.Chip%d%d.fits", filename, i, j);
     128                                                                fprintf (inject, "%s\n", command);
     129                                                                command = NULL;
     130                                                                }
     131                                                        }
     132                                                   
     133                                                } else {
     134                                        psLogMsg ("ppSimSequence", PS_LOG_WARN, "unsupported camera type for nebulous insertion");
     135                                        exit (1);
     136
     137                                                }
     138
     139                                        } else {
     140                                            command = psStringCopy (injectCommand);
     141                                            psStringAppend (&command, " %s*.fits",    filename);
     142                                            fprintf (inject, "%s\n", command);
     143                                        }
     144
     145                                        psFree (command);
     146                                        psFree (filename);
     147                                        nImage ++;
     148                                    }
     149                            }
     150                        }
     151                }
    121152            }
    122         }
    123153    }
    124154    return true;
Note: See TracChangeset for help on using the changeset viewer.