IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 25, 2012, 11:37:10 AM (14 years ago)
Author:
bills
Message:

New features for ppstamp

-sources <sources file>
-write_cmf

If sources file is supplied (or -write_cmf and astrom is supplied) extract sources
from the region of interest and output them into a cmf file.

Also do a better job insuring that zero point is saved in the output headers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/src/ppstampArguments.c

    r33504 r34596  
    2525    fprintf(stderr, "   [-mask   mk_image]    : mask image\n");
    2626    fprintf(stderr, "   [-variance var_image] : variance image\n");
     27    fprintf(stderr, "   [-sources sources]    : sources cmf (ignored for chip stage)\n");
    2728    fprintf(stderr, "   [-stage stage]        : stage of input image (raw, chip, warp, stack, diff)\n");
    2829    fprintf(stderr, "   [-write_jpeg]         : write a JPEG  format of the image stamp\n");
     30    fprintf(stderr, "   [-write_cmf]          : create an output cmf with the sources overlapping the stamp\n");
     31    fprintf(stderr, "   [-wholefile]          : ignore the region of interest and process the entire input image\n");
    2932    // fprintf(stderr, "   [-no_censor_masked]   : do not set masked pixels to NAN\n");
    3033    fprintf(stderr, "\n");
     
    9295        options->stage = psStringCopy(argv[argnum]);
    9396        psArgumentRemove(argnum, &argc, argv);
     97    } else {
     98        // Should we require this?
     99        options->stage = psStringCopy("unknown");
    94100    }
    95101    if ((argnum = psArgumentGet(argc, argv, "-write_jpeg"))) {
    96102        psArgumentRemove(argnum, &argc, argv);
    97103        options->writeJPEG = true;
    98     } else {
    99         options->writeJPEG = false;
     104    }
     105    if ((argnum = psArgumentGet(argc, argv, "-write_cmf"))) {
     106        psArgumentRemove(argnum, &argc, argv);
     107        options->writeCMF = true;
    100108    }
    101109
    102     pmConfigFileSetsMD(config->arguments, &argc, argv, "ASTROM", "-astrom", "-astromlist");
     110    // XXX: Note: the various list options have never been tested with ppstamp to my knowledge
     111    bool gotAstrom = false;
     112    if ((argnum = psArgumentGet(argc, argv, "-astrom"))) {
     113        gotAstrom = true;
     114        pmConfigFileSetsMD(config->arguments, &argc, argv, "ASTROM", "-astrom", "-astromlist");
     115    }
    103116    pmConfigFileSetsMD(config->arguments, &argc, argv, "MASK",   "-mask", "-masklist");
    104117    pmConfigFileSetsMD(config->arguments, &argc, argv, "VARIANCE", "-variance", "-variancelist");
    105118
    106     // the input file is a required argument; if not found, we will exit
     119    if ((argnum = psArgumentGet(argc, argv, "-sources"))) {
     120        pmConfigFileSetsMD(config->arguments, &argc, argv, "SOURCES", "-sources", "-sourceslist");
     121        // supplying a sources file implies that we want to save the output
     122        options->writeCMF = true;
     123    } else if (options->writeCMF && !gotAstrom) {
     124        // if we didn't get a sources file but the user wanted us to write the sources we must
     125        // have an astrometry file supplied
     126        // XXX: Is this too restrictive? Could the sources be contained in say the input file?
     127        psError(PSTAMP_ERR_ARGUMENTS, true, "cannot write cmf file unless input sources are supplied\n");
     128        usage();
     129    }
     130
     131    // the input image file is a required argument; if not found, we will exit
    107132    bool status = pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list");
    108133    if (!status) {
     
    126151    }
    127152
    128     // finally the output file
     153    // finally the only argument left must be output outroot
    129154    if (argc < 2) {
    130155        psError(PSTAMP_ERR_ARGUMENTS, true, "must specify OUTPUT\n");
     
    135160    }
    136161
    137     // Add the output image (which remains on the command-line) to the arguments list
    138162    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Name of the output image", argv[1]);
    139 
    140     // psMetadataPrint(stdout, config->arguments,0);
    141163
    142164    return config;
Note: See TracChangeset for help on using the changeset viewer.