Changeset 19315
- Timestamp:
- Sep 2, 2008, 9:14:17 AM (18 years ago)
- Location:
- trunk/ppSim/src
- Files:
-
- 6 edited
-
ppSimSequence.c (modified) (4 diffs)
-
ppSimSequence.h (modified) (1 diff)
-
ppSimSequenceBias.c (modified) (2 diffs)
-
ppSimSequenceDark.c (modified) (4 diffs)
-
ppSimSequenceFlat.c (modified) (2 diffs)
-
ppSimSequenceObject.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSim/src/ppSimSequence.c
r19080 r19315 43 43 psArgumentRemove(argNum, &argc, argv); 44 44 workdir = psStringCopy (argv[argNum]); 45 psArgumentRemove(argNum, &argc, argv); 46 } 47 48 char *ppsim_recipe = NULL; 49 if ((argNum = psArgumentGet (argc, argv, "-ppsim_recipe"))) { 50 psArgumentRemove(argNum, &argc, argv); 51 ppsim_recipe = psStringCopy (argv[argNum]); 45 52 psArgumentRemove(argNum, &argc, argv); 46 53 } … … 83 90 fprintf (stderr, " (inject) : an output file with commands to inject the images into the pipeline\n"); 84 91 fprintf (stderr, "options:\n"); 92 fprintf (stderr, " -camera (camera) [otherwise must be set in sequences file]\n"); 93 fprintf (stderr, " -ppsim_recipe (recipe)\n"); 85 94 fprintf (stderr, " -dbname (dbname)\n"); 86 95 fprintf (stderr, " -path (path)\n"); … … 120 129 if (tess_id) psStringAppend (&injectCommand, " --tess_id %s", tess_id); 121 130 131 // build the base ppSimCommand string 132 psString ppSimCommand = psStringCopy ("ppSim"); 133 if (ppsim_recipe) psStringAppend (&ppSimCommand, " -recipe PPSIM %s", ppsim_recipe); 134 122 135 unsigned long seed = psMetadataLookupS32 (&status, config, "RND_SEED"); 123 136 if (!status) seed = 0; … … 157 170 } 158 171 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); 182 159 183 if (!strcasecmp (type, "BIAS")) { 160 ppSimSequenceBias (simfile, inject, sequence, i, rng, path, basename, camera, injectCommand);184 ppSimSequenceBias (simfile, inject, sequence, i, rng, path, basename, ppSimCommandReal, injectCommandReal); 161 185 continue; 162 186 } 163 187 if (!strcasecmp (type, "DARK")) { 164 ppSimSequenceDark (simfile, inject, sequence, i, rng, path, basename, camera, injectCommand);188 ppSimSequenceDark (simfile, inject, sequence, i, rng, path, basename, ppSimCommandReal, injectCommandReal); 165 189 continue; 166 190 } 167 191 if (!strcasecmp (type, "FLAT")) { 168 ppSimSequenceFlat (simfile, inject, sequence, i, rng, path, basename, camera, injectCommand);192 ppSimSequenceFlat (simfile, inject, sequence, i, rng, path, basename, ppSimCommandReal, injectCommandReal); 169 193 continue; 170 194 } 171 195 if (!strcasecmp (type, "OBJECT")) { 172 ppSimSequenceObject (simfile, inject, sequence, i, rng, path, basename, camera, injectCommand);196 ppSimSequenceObject (simfile, inject, sequence, i, rng, path, basename, ppSimCommandReal, injectCommandReal); 173 197 continue; 174 198 } -
trunk/ppSim/src/ppSimSequence.h
r19080 r19315 12 12 #include <psastro.h> 13 13 14 bool ppSimSequenceBias (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, c har *camera, const char *injectCommand);15 bool ppSimSequenceDark (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, c har *camera, const char *injectCommand);16 bool ppSimSequenceFlat (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, c har *camera, const char *injectCommand);17 bool ppSimSequenceObject (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, c har *camera, const char *injectCommand);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); 18 18 19 19 #endif -
trunk/ppSim/src/ppSimSequenceBias.c
r19080 r19315 1 1 # include "ppSimSequence.h" 2 2 3 bool ppSimSequenceBias (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, c har *camera, const char *injectCommand) {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) { 4 4 5 5 bool status, setLevel, setRange; 6 7 if (camera == NULL) {8 camera = psMetadataLookupStr (&status, sequence, "CAMERA");9 }10 6 11 7 // optional details … … 19 15 for (int i = 0; i < nImages; i++) { 20 16 21 psString command = NULL; 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 } 22 24 23 psStringAppend (&command, "ppSim -type BIAS"); 24 psStringAppend (&command, " -camera %s", camera);25 // define the ppSim command 26 psString command = NULL; 25 27 26 if (setLevel) psStringAppend (&command, " -biaslevel %f", level); 27 if (setRange) psStringAppend (&command, " -biasrange %f", range); 28 psStringAppend (&command, "%s -type BIAS", ppSimCommand); 28 29 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 } 36 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); 37 34 38 fprintf (simfile, "%s\n", command);39 psFree (command);35 fprintf (simfile, "%s\n", command); 36 psFree (command); 40 37 41 // path should be dirname/filename 42 command = psStringCopy (injectCommand); 43 psStringAppend (&command, " --camera %s", camera);44 psStringAppend (&command, " %s*.fits", filename);45 fprintf (inject, "%s\n", command);46 psFree (command);47 psFree (filename);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); 48 45 49 nImage ++;46 nImage ++; 50 47 } 51 48 return true; -
trunk/ppSim/src/ppSimSequenceDark.c
r19080 r19315 1 1 # include "ppSimSequence.h" 2 2 3 bool ppSimSequenceDark (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, c har *camera, const char *injectCommand) {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) { 4 4 5 5 bool status, setRate; 6 6 float min, max = 0; 7 8 if (camera == NULL) {9 camera = psMetadataLookupStr (&status, sequence, "CAMERA");10 }11 7 12 8 setRate = false; … … 30 26 31 27 for (int j = 0; j < n; j++) { 28 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 } 36 37 // define the ppSim command 32 38 psString command = NULL; 33 39 34 psStringAppend (&command, "ppSim -type DARK"); 35 psStringAppend (&command, " -camera %s", camera); 36 40 psStringAppend (&command, "%s -type DARK", ppSimCommand); 41 37 42 if (setRate) { 38 43 double frnd = psRandomUniform(rng); … … 43 48 psStringAppend (&command, " -exptime %f", exptime); 44 49 45 // XXX need to add output filename46 psString filename = NULL;47 if (path) {48 psStringAppend (&filename, "%s/%s.%03d.%03d", path, basename, nSeq, nImage);49 } else {50 psStringAppend (&filename, "%s.%03d.%03d", basename, nSeq, nImage);51 }52 50 psStringAppend (&command, " %s", filename); 53 51 … … 55 53 psFree (command); 56 54 55 // define the inject command 57 56 // path should be dirname/filename 58 57 command = psStringCopy (injectCommand); 59 psStringAppend (&command, " --camera %s", camera);60 58 psStringAppend (&command, " %s*.fits", filename); 61 59 fprintf (inject, "%s\n", command); -
trunk/ppSim/src/ppSimSequenceFlat.c
r19080 r19315 1 1 # include "ppSimSequence.h" 2 2 3 bool ppSimSequenceFlat (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, c har *camera, const char *injectCommand) {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) { 4 4 5 5 bool status; 6 7 if (camera == NULL) {8 camera = psMetadataLookupStr (&status, sequence, "CAMERA");9 }10 6 11 7 // determine the filters & exposure times … … 28 24 for (int i = 0; i < filters->n; i++) { 29 25 30 // loop over the filters & exposure times31 for (int j = 0; j < nSetup; j++) {26 // loop over the filters & exposure times 27 for (int j = 0; j < nSetup; j++) { 32 28 33 psString command = NULL; 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 } 34 36 35 psStringAppend (&command, "ppSim -type FLAT");36 psStringAppend (&command, " -camera %s", camera);37 // define the ppSim comand 38 psString command = NULL; 37 39 38 psStringAppend (&command, " -filter %s", (char *) filters->data[i]); 39 psStringAppend (&command, " -exptime %f", exptimes->data.F32[i]); 40 psStringAppend (&command, "%s -type FLAT", ppSimCommand); 40 41 41 // XXX need to add output filename 42 psString filename = NULL; 43 if (path) { 44 psStringAppend (&filename, "%s/%s.%03d.%03d", path, basename, nSeq, nImage); 45 } else { 46 psStringAppend (&filename, "%s.%03d.%03d", basename, nSeq, nImage); 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 ++; 47 59 } 48 psStringAppend (&command, " %s", filename);49 50 51 fprintf (simfile, "%s\n", command);52 psFree (command);53 54 // path should be dirname/filename55 command = psStringCopy (injectCommand);56 psStringAppend (&command, " --camera %s", camera);57 psStringAppend (&command, " %s*.fits", filename);58 fprintf (inject, "%s\n", command);59 psFree (command);60 psFree (filename);61 62 nImage ++;63 }64 60 } 65 61 return true; -
trunk/ppSim/src/ppSimSequenceObject.c
r19080 r19315 1 1 # include "ppSimSequence.h" 2 2 3 bool ppSimSequenceObject (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, c har *camera, const char *injectCommand) {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) { 4 4 5 5 bool status; … … 8 8 // ppSim -camera $camera -type OBJECT -filter $filter -exptime $exptime 9 9 // -skyrate $sky -ra $ra -dec $dec -pa $pa -scale $scale -zp $zp -seeing $seeing $filename", 10 11 if (camera == NULL) {12 camera = psMetadataLookupStr (&status, sequence, "CAMERA");13 }14 10 15 11 // sequence reference coordinate … … 80 76 for (float pos = pos_min; pos <= pos_max; pos += pos_delta) { 81 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 } 85 86 // define the ppSim command 82 87 psString command = NULL; 83 88 84 psStringAppend (&command, "ppSim -type OBJECT"); 85 psStringAppend (&command, " -camera %s", camera); 89 psStringAppend (&command, "%s -type OBJECT", ppSimCommand); 86 90 psStringAppend (&command, " -filter %s", (char *) filters->data[i]); 87 91 psStringAppend (&command, " -exptime %f", exptimes->data.F32[i]); … … 97 101 psStringAppend (&command, " -seeing %f", seeing); 98 102 99 // XXX need to add output filename100 psString filename = NULL;101 if (path) {102 psStringAppend (&filename, "%s/%s.%03d.%03d", path, basename, nSeq, nImage);103 } else {104 psStringAppend (&filename, "%s.%03d.%03d", basename, nSeq, nImage);105 }106 103 psStringAppend (&command, " %s", filename); 107 104 … … 109 106 psFree (command); 110 107 108 // define the inject command 111 109 // path should be dirname/filename 112 110 command = psStringCopy (injectCommand); 113 psStringAppend (&command, " --camera %s", camera);114 111 psStringAppend (&command, " %s*.fits", filename); 115 112 fprintf (inject, "%s\n", command);
Note:
See TracChangeset
for help on using the changeset viewer.
