Changeset 4641
- Timestamp:
- Jul 27, 2005, 6:55:51 PM (21 years ago)
- Location:
- trunk/psphot
- Files:
-
- 6 deleted
- 6 edited
-
Makefile (modified) (1 diff)
-
src/find_defects.c (deleted)
-
src/find_defects_new.c (deleted)
-
src/load_args.c (modified) (5 diffs)
-
src/mark_psf_sources.c (deleted)
-
src/onesource.c (modified) (1 diff)
-
src/output.c (modified) (6 diffs)
-
src/pixregion.c (deleted)
-
src/psphot.c (modified) (2 diffs)
-
src/setup.c (modified) (4 diffs)
-
src/subtract_galaxies.c (deleted)
-
src/subtract_psf_sources.c (deleted)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/Makefile
r4574 r4641 31 31 $(SRC)/apply_psf_model.$(ARCH).o \ 32 32 $(SRC)/test_psf_scatter.$(ARCH).o \ 33 $(SRC)/mark_psf_sources.$(ARCH).o \34 $(SRC)/subtract_psf_sources.$(ARCH).o \35 33 $(SRC)/mark_psf_source.$(ARCH).o \ 36 34 $(SRC)/subtract_psf_source.$(ARCH).o \ 37 35 $(SRC)/by_SN.$(ARCH).o \ 38 36 $(SRC)/fit_galaxies.$(ARCH).o \ 39 $(SRC)/subtract_galaxies.$(ARCH).o \40 37 $(SRC)/LocalSky.$(ARCH).o \ 41 $(SRC)/basic_classes.$(ARCH).o \ 42 $(SRC)/find_defects.$(ARCH).o 38 $(SRC)/basic_classes.$(ARCH).o 43 39 44 40 FITSOURCE = \ -
trunk/psphot/src/load_args.c
r4375 r4641 13 13 14 14 char *mask = NULL; 15 if ((N = get_argument (*argc, argv, "- -mask"))) {15 if ((N = get_argument (*argc, argv, "-mask"))) { 16 16 remove_argument (N, argc, argv); 17 17 mask = psStringCopy (argv[N]); … … 20 20 21 21 char *noise = NULL; 22 if ((N = get_argument (*argc, argv, "- -noise"))) {22 if ((N = get_argument (*argc, argv, "-noise"))) { 23 23 remove_argument (N, argc, argv); 24 24 noise = psStringCopy (argv[N]); … … 26 26 } 27 27 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 28 35 if (*argc != 4) usage (); 29 36 37 // load config information 30 38 psMetadata *config = psMetadataParseConfig (NULL, &Nfail, argv[3], FALSE); 31 39 40 // identify input image & optional noise & mask images 32 41 psMetadataAddStr (config, PS_LIST_HEAD, "INPUT", "", argv[1]); 33 42 psMetadataAddStr (config, PS_LIST_HEAD, "OUTPUT", "", argv[2]); … … 38 47 psMetadataAddStr (config, PS_LIST_HEAD, "NOISE", "", noise); 39 48 } 49 if (diff != NULL) { 50 psMetadataAddStr (config, PS_LIST_HEAD, "DIFF_IMAGE", "", diff); 51 } 40 52 return (config); 41 53 } … … 43 55 int usage () { 44 56 45 fprintf (stderr, "USAGE: psphot (image .fits) (output.fits) (config)\n");57 fprintf (stderr, "USAGE: psphot (image) (output) (config)\n"); 46 58 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"); 49 62 exit (2); 50 63 } -
trunk/psphot/src/onesource.c
r4630 r4641 14 14 float MRAD = psMetadataLookupF32 (&status, config, "GAL_MOMENTS_RADIUS"); 15 15 float RADIUS = psMetadataLookupF32 (&status, config, "FIT_RADIUS"); 16 float SOFT = psMetadataLookupF32 (&status, config, "SOFT_RADIUS");17 16 18 17 psSource *source = pmSourceAlloc(); -
trunk/psphot/src/output.c
r4398 r4641 1 1 # include "psphot.h" 2 2 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 5 void 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 37 bool 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); 18 50 } 19 51 20 52 // dophot-style output list with fixed line width 21 bool WriteSourcesOBJ (ps Array *sources, char *filename) {53 bool WriteSourcesOBJ (psImageData *imdata, psMetadata *config, psArray *sources) { 22 54 23 55 # define NCHAR 104 24 56 25 57 char line[NCHAR]; 58 59 char *filename = psMetadataLookupPtr (&status, config, "OUTPUT"); 26 60 27 61 FILE *f = fopen (filename, "w"); … … 63 97 64 98 // elixir/sextractor-style output list with fixed line width 65 bool WriteSourcesSX (ps Array *sources, char *filename) {99 bool WriteSourcesSX (psImageData *imdata, psMetadata *config, psArray *sources) { 66 100 67 101 # define NCHAR 104 68 102 69 103 char line[NCHAR]; 104 105 char *filename = psMetadataLookupPtr (&status, config, "OUTPUT"); 70 106 71 107 FILE *f = fopen (filename, "w"); … … 108 144 109 145 // elixir-style pseudo FITS table (header + ascii list) 110 bool WriteSourcesCMP (ps Metadata *header, psArray *sources, char *filename) {146 bool WriteSourcesCMP (psImageData *imdata, psMetadata *config, psArray *sources) { 111 147 112 148 … … 114 150 115 151 char line[NCHAR]; 152 153 char *filename = psMetadataLookupPtr (&status, config, "OUTPUT"); 116 154 117 155 FILE *f = fopen (filename, "w"); … … 121 159 } 122 160 123 // write header to file161 // write imdata->header to file 124 162 125 163 // write sources with models first … … 155 193 156 194 // elixir-style FITS table output (header + table in 1st extension) 157 bool WriteSourcesCMF (psArray *sources, char *filename) { 158 // ??? 159 } 195 bool 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 205 init_line (char *line, int *Nline) { 206 *Nline = 0; 207 } 208 209 add_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 34 34 psf = choose_psf_model (config, sources, sky); 35 35 36 // identify defects based on 1-pixel wide x and y direction 2nd moments37 // find_defects (zap, sources, config, psf);38 39 36 // test PSF on all except SATURATE and DEFECT (artifacts) 40 37 apply_psf_model (imdata, config, sources, psf, sky); … … 43 40 fit_galaxies (imdata, config, sources, sky); 44 41 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); 52 44 53 45 exit (0); -
trunk/psphot/src/setup.c
r4630 r4641 44 44 } else { 45 45 46 // XXX EAM it looks like psBinaryOp is broken for: image op scalar 47 // this loop performs the operation by hand 46 48 noise = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32); 47 49 for (int iy = 0; iy < image->numRows; iy++) { … … 51 53 } 52 54 53 // XXX EAM it looks like psBinaryOp is broken for (image op scalar)55 // this uses psBinaryOp 54 56 # if (0) 55 57 psScalar *value; … … 65 67 } 66 68 69 // load the mask if specified, otherwise construct 67 70 char *maskName = psMetadataLookupPtr (&status, config, "MASK"); 68 71 if (status == true) { 69 72 file = psFitsAlloc (maskName); 70 73 mask = psFitsReadImage (NULL, file, region, 0); 71 // require U872 74 psFree (file); 75 // XXX require / convert mask to psU8? 73 76 } else { 74 77 mask = psImageAlloc (image->numCols, image->numRows, PS_TYPE_U8); … … 92 95 } 93 96 } 94 DumpImage (mask, "mask.fits");95 96 97 psLogMsg ("psphot", 3, "load data: %f sec\n", psTimerMark ("psphot")); 97 98 99 // save the image data & return it 98 100 psImageData *imdata = psAlloc(sizeof(psImageData)); 99 101 imdata->image = image;
Note:
See TracChangeset
for help on using the changeset viewer.
