IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 43081


Ignore:
Timestamp:
Sep 7, 2026, 4:51:13 PM (2 weeks ago)
Author:
eugene
Message:

add option to pass expname to ipp_inject_fileset.pl, small code refactor

Location:
branches/eam_branches/ipp-pstamp-20260421/ppSim/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-pstamp-20260421/ppSim/src/ppSimSequence.h

    r42385 r43081  
    1717bool ppSimSequenceObject (FILE *simfile, FILE *inject, psMetadata *sequence, int nSeq, psRandom *rng, const char *path, const char *basename, const char *refcat, const char *ppSimCommand, const char *injectCommand, psArray *files);
    1818
     19psString ppSimDefineExpname (const char *basename, int nSeq, int nImage);
     20psString ppSimDefineFilename (const char *path, const char *expname);
     21
    1922#endif
  • branches/eam_branches/ipp-pstamp-20260421/ppSim/src/ppSimSequenceBias.c

    r27967 r43081  
    1515    for (int i = 0; i < nImages; i++) {
    1616               
    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         }
    24 
    2517        // define the ppSim command
    2618        psString command = NULL;
    … …  
    3022        if (setLevel) psStringAppend (&command, " -biaslevel %f", level);
    3123        if (setRange) psStringAppend (&command, " -biasrange %f", range);
    32          
     24
     25        // define the exposure name and output filename
     26        psString expname = ppSimDefineExpname (basename, nSeq, nImage);
     27        psString filename = ppSimDefineFilename (path, expname);
     28
     29        // add output filename to the end of the full command
    3330        psStringAppend (&command, " %s", filename);
    3431
    … …  
    4239        for (int i = 0; i < files->n; i++) {
    4340            command = psStringCopy (injectCommand);
    44             psStringAppend (&command, " %s.%s", filename, (char *) files->data[i]);
     41            psStringAppend (&command, " --exp_name %s %s.%s", expname, filename, (char *) files->data[i]);
    4542            fprintf (inject, "%s\n", command);
    4643            psFree (command);
    4744        }
    4845
     46        psFree (expname);
    4947        psFree (filename);
    5048        nImage ++;
    … …  
    5250    return true;
    5351}
     52
     53psString ppSimDefineExpname (const char *basename, int nSeq, int nImage) {
     54 
     55  // define the exposure name
     56  psString expname = NULL;
     57  psStringAppend (&expname, "%s.%03d.%03d", basename, nSeq, nImage);
     58  return expname;
     59}
     60 
     61psString ppSimDefineFilename (const char *path, const char *expname) {
     62
     63  // define the output filename
     64  psString filename = NULL;
     65  if (path) {
     66    psStringAppend (&filename, "%s/%s", path, expname);
     67  } else {
     68    psStringAppend (&filename, "%s", expname);
     69  }
     70  return filename;
     71}
  • branches/eam_branches/ipp-pstamp-20260421/ppSim/src/ppSimSequenceDark.c

    r27967 r43081  
    2727        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             }
    36 
    3729            // define the ppSim command
    3830            psString command = NULL;
    … …  
    4840            psStringAppend (&command, " -exptime %f", exptime);
    4941
     42            // define the exposure name and output filename
     43            psString expname = ppSimDefineExpname (basename, nSeq, nImage);
     44            psString filename = ppSimDefineFilename (path, expname);
     45           
     46            // add output filename to the end of the full command
    5047            psStringAppend (&command, " %s", filename);
    5148
    … …  
    5956            for (int i = 0; i < files->n; i++) {
    6057                command = psStringCopy (injectCommand);
    61                 psStringAppend (&command, " %s.%s", filename, (char *) files->data[i]);
     58                psStringAppend (&command, " --exp_name %s %s.%s", expname, filename, (char *) files->data[i]);
    6259                fprintf (inject, "%s\n", command);
    6360                psFree (command);
    6461            }
    6562
     63            psFree (expname);
    6664            psFree (filename);
    6765            nImage ++;
  • branches/eam_branches/ipp-pstamp-20260421/ppSim/src/ppSimSequenceFlat.c

    r27967 r43081  
    2727        for (int j = 0; j < nSetup; j++) {
    2828               
    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 
    3729            // define the ppSim comand
    3830            psString command = NULL;
    3931
    4032            psStringAppend (&command, "%s -type FLAT", ppSimCommand);
    41 
    4233            psStringAppend (&command, " -filter %s", (char *) filters->data[i]);
    4334            psStringAppend (&command, " -exptime %f", exptimes->data.F32[i]);
     35
     36            // define the exposure name and output filename
     37            psString expname = ppSimDefineExpname (basename, nSeq, nImage);
     38            psString filename = ppSimDefineFilename (path, expname);
    4439
    4540            psStringAppend (&command, " %s", filename);
    … …  
    5449            for (int i = 0; i < files->n; i++) {
    5550                command = psStringCopy (injectCommand);
    56                 psStringAppend (&command, " %s.%s", filename, (char *) files->data[i]);
     51                psStringAppend (&command, " --exp_name %s %s.%s", expname, filename, (char *) files->data[i]);
    5752                fprintf (inject, "%s\n", command);
    5853                psFree (command);
    5954            }
    6055
     56            psFree (expname);
    6157            psFree (filename);
    6258            nImage ++;
  • branches/eam_branches/ipp-pstamp-20260421/ppSim/src/ppSimSequenceObject.c

    r43068 r43081  
    7979                        for (float pos = pos_min; pos <= pos_max; pos += pos_delta) {
    8080                         
    81                             // define the output filename
    82                             psString filename = NULL;
    83                             if (path) {
    84                                 psStringAppend (&filename, "%s/%s.%03d.%03d", path, basename, nSeq, nImage);
    85                             } else {
    86                                 psStringAppend (&filename, "%s.%03d.%03d", basename, nSeq, nImage);
    87                             }
     81                            // define the exposure name and output filename
     82                            psString expname = ppSimDefineExpname (basename, nSeq, nImage);
     83                            psString filename = ppSimDefineFilename (path, expname);
    8884
    8985                            // define the ppSim command
    … …  
    121117                            for (int i = 0; i < files->n; i++) {
    122118                                command = psStringCopy (injectCommand);
    123                                 psStringAppend (&command, " %s.%s", filename, (char *) files->data[i]);
     119                                psStringAppend (&command, " --exp_name %s %s.%s", expname, filename, (char *) files->data[i]);
    124120                                fprintf (inject, "%s\n", command);
    125121                                psFree (command);
    126122                            }
    127123
     124                            psFree (expname);
    128125                            psFree (filename);
    129126                            nImage ++;
Note: See TracChangeset for help on using the changeset viewer.