IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4641


Ignore:
Timestamp:
Jul 27, 2005, 6:55:51 PM (21 years ago)
Author:
eugene
Message:

general cleanup

Location:
trunk/psphot
Files:
6 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/Makefile

    r4574 r4641  
    3131$(SRC)/apply_psf_model.$(ARCH).o \
    3232$(SRC)/test_psf_scatter.$(ARCH).o \
    33 $(SRC)/mark_psf_sources.$(ARCH).o \
    34 $(SRC)/subtract_psf_sources.$(ARCH).o \
    3533$(SRC)/mark_psf_source.$(ARCH).o \
    3634$(SRC)/subtract_psf_source.$(ARCH).o \
    3735$(SRC)/by_SN.$(ARCH).o \
    3836$(SRC)/fit_galaxies.$(ARCH).o \
    39 $(SRC)/subtract_galaxies.$(ARCH).o \
    4037$(SRC)/LocalSky.$(ARCH).o \
    41 $(SRC)/basic_classes.$(ARCH).o \
    42 $(SRC)/find_defects.$(ARCH).o
     38$(SRC)/basic_classes.$(ARCH).o
    4339
    4440FITSOURCE = \
  • trunk/psphot/src/load_args.c

    r4375 r4641  
    1313
    1414  char *mask = NULL;
    15   if ((N = get_argument (*argc, argv, "--mask"))) {
     15  if ((N = get_argument (*argc, argv, "-mask"))) {
    1616    remove_argument (N, argc, argv);
    1717    mask = psStringCopy (argv[N]);
     
    2020
    2121  char *noise = NULL;
    22   if ((N = get_argument (*argc, argv, "--noise"))) {
     22  if ((N = get_argument (*argc, argv, "-noise"))) {
    2323    remove_argument (N, argc, argv);
    2424    noise = psStringCopy (argv[N]);
     
    2626  }
    2727
     28  char *diff = NULL;
     29  if ((N = get_argument (*argc, argv, "-diff"))) {
     30    remove_argument (N, argc, argv);
     31    diff = psStringCopy (argv[N]);
     32    remove_argument (N, argc, argv);
     33  }
     34
    2835  if (*argc != 4) usage ();
    2936
     37  // load config information
    3038  psMetadata *config = psMetadataParseConfig (NULL, &Nfail, argv[3], FALSE);
    3139
     40  // identify input image & optional noise & mask images
    3241  psMetadataAddStr (config, PS_LIST_HEAD, "INPUT",  "", argv[1]);
    3342  psMetadataAddStr (config, PS_LIST_HEAD, "OUTPUT", "", argv[2]);
     
    3847    psMetadataAddStr (config, PS_LIST_HEAD, "NOISE", "", noise);
    3948  }
     49  if (diff != NULL) {
     50    psMetadataAddStr (config, PS_LIST_HEAD, "DIFF_IMAGE", "", diff);
     51  }
    4052  return (config);
    4153}
     
    4355int usage () {
    4456
    45     fprintf (stderr, "USAGE: psphot (image.fits) (output.fits) (config)\n");
     57    fprintf (stderr, "USAGE: psphot (image) (output) (config)\n");
    4658    fprintf (stderr, "options: \n");
    47     fprintf (stderr, "  --mask  (filename)\n");
    48     fprintf (stderr, "  --noise (filename)\n");
     59    fprintf (stderr, "  -mask  (filename)\n");
     60    fprintf (stderr, "  -noise (filename)\n");
     61    fprintf (stderr, "  -diff  (filename)\n");
    4962    exit (2);
    5063}
  • trunk/psphot/src/onesource.c

    r4630 r4641  
    1414    float MRAD   = psMetadataLookupF32 (&status, config, "GAL_MOMENTS_RADIUS");
    1515    float RADIUS = psMetadataLookupF32 (&status, config, "FIT_RADIUS");
    16     float SOFT   = psMetadataLookupF32 (&status, config, "SOFT_RADIUS");
    1716
    1817    psSource *source = pmSourceAlloc();
  • trunk/psphot/src/output.c

    r4398 r4641  
    11# include "psphot.h"
    22
    3 // output functions
    4 // we have several fixed modes (sx, obj, cmp)
    5 
    6 // we require a fixed number of chars already allocated
    7 init_line (char *line, int *Nline) {
    8   *Nline = 0;
    9 }
    10 
    11 add_to_line (char *line, int *Nline, char *format, ...) {
    12 
    13     va_list ap;
    14 
    15     va_start (ap, format);
    16     Nchar = vsprintf (&line[*Nline], format, ap);
    17     *Nline += Nchar;
     3// output functions: we have several fixed modes (sx, obj, cmp)
     4
     5void output (psImageData *imdata, psMetadata *config, psArray *sources) {
     6
     7  char *outputMode = psMetadataLookupPtr (&status, config, "OUTPUT_MODE");
     8
     9  if (outputMode == NULL) {
     10    WriteSourcesText (imdata, config, sources);
     11    exit (0);
     12  }
     13
     14  if (!strcasecmp (outputMode, "OBJ")) {
     15    WriteSourcesOBJ (imdata, config, sources);
     16    exit (0);
     17  }
     18 
     19  if (!strcasecmp (outputMode, "SX")) {
     20    WriteSourcesSX (imdata, config, sources);
     21    exit (0);
     22  }
     23 
     24  if (!strcasecmp (outputMode, "CMP")) {
     25    WriteSourcesCMP (imdata, config, sources);
     26    exit (0);
     27  }
     28 
     29  if (!strcasecmp (outputMode, "CMF")) {
     30    WriteSourcesCMF (imdata, config, sources);
     31    exit (0);
     32  }
     33 
     34  psAbort ("psphot", "unknown output mode %s", outputMode);
     35}
     36
     37bool WriteSourceText (psImageData *imdata, psMetadata *config, psArray *sources) {
     38
     39  char *filename = psMetadataLookupPtr (&status, config, "OUTPUT");
     40
     41  DumpImage (imdata->image, filename);
     42
     43  // get these names from config?
     44  DumpModelPSF (sources, "psfsources.dat");
     45  DumpModelFLT (sources, "fltsources.dat");
     46  DumpModelNULL (sources, "nullsources.dat");
     47  DumpMoments (sources, "moments.dat");
     48
     49  exit (0);
    1850}
    1951
    2052// dophot-style output list with fixed line width
    21 bool WriteSourcesOBJ (psArray *sources, char *filename) {
     53bool WriteSourcesOBJ (psImageData *imdata, psMetadata *config, psArray *sources) {
    2254
    2355# define NCHAR 104
    2456
    2557    char line[NCHAR];
     58
     59    char *filename = psMetadataLookupPtr (&status, config, "OUTPUT");
    2660
    2761    FILE *f = fopen (filename, "w");
     
    6397
    6498// elixir/sextractor-style output list with fixed line width
    65 bool WriteSourcesSX (psArray *sources, char *filename) {
     99bool WriteSourcesSX (psImageData *imdata, psMetadata *config, psArray *sources) {
    66100
    67101# define NCHAR 104
    68102
    69103    char line[NCHAR];
     104
     105    char *filename = psMetadataLookupPtr (&status, config, "OUTPUT");
    70106
    71107    FILE *f = fopen (filename, "w");
     
    108144
    109145// elixir-style pseudo FITS table (header + ascii list)
    110 bool WriteSourcesCMP (psMetadata *header, psArray *sources, char *filename) {
     146bool WriteSourcesCMP (psImageData *imdata, psMetadata *config, psArray *sources) {
    111147
    112148
     
    114150
    115151    char line[NCHAR];
     152
     153    char *filename = psMetadataLookupPtr (&status, config, "OUTPUT");
    116154
    117155    FILE *f = fopen (filename, "w");
     
    121159    }
    122160
    123     // write header to file
     161    // write imdata->header to file
    124162
    125163    // write sources with models first
     
    155193
    156194// elixir-style FITS table output (header + table in 1st extension)
    157 bool WriteSourcesCMF (psArray *sources, char *filename) {
    158     // ???
    159 }
     195bool WriteSourcesCMF (psImageData *imdata, psMetadata *config, psArray *sources) {
     196
     197    char *filename = psMetadataLookupPtr (&status, config, "OUTPUT");
     198
     199    // write imdata->header to file
     200
     201    // write FITS table to file (use autocode tools)
     202}
     203
     204// we require a fixed number of chars already allocated
     205init_line (char *line, int *Nline) {
     206  *Nline = 0;
     207}
     208
     209add_to_line (char *line, int *Nline, char *format, ...) {
     210
     211    va_list ap;
     212
     213    va_start (ap, format);
     214    Nchar = vsprintf (&line[*Nline], format, ap);
     215    *Nline += Nchar;
     216}
     217
  • trunk/psphot/src/psphot.c

    r4574 r4641  
    3434    psf = choose_psf_model (config, sources, sky);
    3535
    36     // identify defects based on 1-pixel wide x and y direction 2nd moments
    37     // find_defects (zap, sources, config, psf);
    38 
    3936    // test PSF on all except SATURATE and DEFECT (artifacts)
    4037    apply_psf_model (imdata, config, sources, psf, sky);
     
    4340    fit_galaxies (imdata, config, sources, sky);
    4441
    45     // subtract_galaxies (sources, config);
    46  
    47     DumpImage (imdata->image, argv[2]);
    48     DumpModelPSF (sources, "psfsources.dat");
    49     DumpModelFLT (sources, "fltsources.dat");
    50     DumpModelNULL (sources, "nullsources.dat");
    51     DumpMoments (sources, "moments.dat");
     42    // write out data in appropriate format
     43    output (imdata, config, sources);
    5244
    5345    exit (0);
  • trunk/psphot/src/setup.c

    r4630 r4641  
    4444    } else {
    4545
     46      // XXX EAM it looks like psBinaryOp is broken for: image op scalar
     47      // this loop performs the operation by hand
    4648      noise = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
    4749      for (int iy = 0; iy < image->numRows; iy++) {
     
    5153      }
    5254
    53       // XXX EAM it looks like psBinaryOp is broken for (image op scalar)
     55      // this uses psBinaryOp
    5456      # if (0)
    5557      psScalar *value;
     
    6567    }
    6668
     69    // load the mask if specified, otherwise construct
    6770    char *maskName = psMetadataLookupPtr (&status, config, "MASK");
    6871    if (status == true) {
    6972      file = psFitsAlloc (maskName);
    7073      mask  = psFitsReadImage  (NULL, file, region, 0);
    71       // require U8
    7274      psFree (file);
     75      // XXX require / convert mask to psU8?
    7376    } else {
    7477      mask = psImageAlloc (image->numCols, image->numRows, PS_TYPE_U8);
     
    9295        }
    9396    }
    94     DumpImage (mask, "mask.fits");
    95 
    9697    psLogMsg ("psphot", 3, "load data: %f sec\n", psTimerMark ("psphot"));
    9798
     99    // save the image data & return it
    98100    psImageData *imdata = psAlloc(sizeof(psImageData));
    99101    imdata->image = image;
Note: See TracChangeset for help on using the changeset viewer.