IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 18, 2010, 12:49:05 PM (16 years ago)
Author:
eugene
Message:

merging changes from trunk into branches/pap

Location:
branches/pap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/pap

  • branches/pap/ppSim/src/ppSimSequenceObject.c

    r24099 r28003  
    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, psArray *files) {
    44
    55    bool status;
     
    3434    // loop over the filters & exposure times
    3535    for (int i = 0; i < filters->n; i++) {
    36            
     36               
    3737        // offset parameters
    3838        float dR = psMetadataLookupF32 (&status, sequence, "OFFSET.RA");
    3939        float dD = psMetadataLookupF32 (&status, sequence, "OFFSET.DEC");
    40  
     40     
    4141        int nR = psMetadataLookupS32 (&status, sequence, "OFFSET.NR");
    4242        int nD = psMetadataLookupS32 (&status, sequence, "OFFSET.ND");
    43  
     43     
    4444        // loop over the offset sequence
    4545        for (int iR = 0; iR < nR; iR++) {
     
    5050                float R = Ro + dR*(iR - 0.5*nR + 0.5) / cos (RAD_DEG*Do) / 3600.0;
    5151                float D = Do + dD*(iD - 0.5*nD + 0.5) / 3600.0;
    52      
     52             
    5353                // dither parameters
    5454                float dr = psMetadataLookupF32 (&status, sequence, "DITHER.RA");
    5555                float dd = psMetadataLookupF32 (&status, sequence, "DITHER.DEC");
    56  
     56         
    5757                int nr = psMetadataLookupS32 (&status, sequence, "DITHER.NR");
    5858                int nd = psMetadataLookupS32 (&status, sequence, "DITHER.ND");
    59  
     59         
    6060                // loop over the dither sequence
    6161                for (int ir = 0; ir < nr; ir++) {
     
    6565                        float ra = R + dr*(ir - 0.5*nr + 0.5) / cos (RAD_DEG*D) / 3600.0;
    6666                        float dec = D + dd*(id - 0.5*nd + 0.5) / 3600.0;
    67          
     67                     
    6868                        // rotation sequence parameters
    6969                        float pos_min   = psMetadataLookupF32 (&status, sequence, "POS_MIN");
     
    7272                        assert (pos_delta > 0.0);
    7373                        assert (pos_max >= pos_min);
    74            
     74                       
    7575                        // loop over rotation sequence
    7676                        for (float pos = pos_min; pos <= pos_max; pos += pos_delta) {
    77              
     77                         
    7878                            // define the output filename
    7979                            psString filename = NULL;
     
    9595                            psStringAppend (&command, " -dec %f", dec);
    9696                            psStringAppend (&command, " -pa %f", pos);
    97                             psStringAppend (&command, " -obs_mode OBJECT.%s", (char *) filters->data[i]);
     97                            psStringAppend (&command, " -obs_mode OBJECT.%s", (char *) filters->data[i]);
    9898
    9999                            double frnd = psRandomUniform(rng);
    100100                            float seeing = IQmin + (IQmax - IQmin)*frnd;
    101              
     101                         
    102102                            psStringAppend (&command, " -seeing %f", seeing);
    103103
     
    106106                            fprintf (simfile, "%s\n", command);
    107107                            psFree (command);
    108                            
     108                                       
    109109                            // define the inject command
    110110                            // path should be dirname/filename
    111                             command = psStringCopy (injectCommand);
    112                             psStringAppend (&command, " %s*.fits",    filename);
    113                             fprintf (inject, "%s\n", command);
    114                             psFree (command);
     111                           
     112                            // we use the filename above (really the file root) to construct the filenames
     113                            for (int i = 0; i < files->n; i++) {
     114                                command = psStringCopy (injectCommand);
     115                                psStringAppend (&command, " %s.%s", filename, (char *) files->data[i]);
     116                                fprintf (inject, "%s\n", command);
     117                                psFree (command);
     118                            }
     119
    115120                            psFree (filename);
    116 
    117121                            nImage ++;
    118122                        }
Note: See TracChangeset for help on using the changeset viewer.