Changeset 6727
- Timestamp:
- Mar 29, 2006, 11:08:05 AM (20 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 5 deleted
- 10 edited
-
Makefile.am (modified) (2 diffs)
-
psphot.c (modified) (1 diff)
-
psphot.h (modified) (2 diffs)
-
psphotApplyPSF.c (deleted)
-
psphotCleanup.c (modified) (1 diff)
-
psphotDefinePixels.c (deleted)
-
psphotFitGalaxies.c (deleted)
-
psphotFullFit.c (deleted)
-
psphotImageLoop.c (modified) (2 diffs)
-
psphotLoadPixels.c (deleted)
-
psphotModelTest.c (modified) (5 diffs)
-
psphotOutput.c (modified) (2 diffs)
-
psphotParseCamera.c (modified) (3 diffs)
-
psphotReadout.c (modified) (6 diffs)
-
psphotSkyReplace.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/Makefile.am
r6715 r6727 39 39 psphotGrowthCurve.c \ 40 40 psphotFakeSources.c \ 41 psphotModelTest.c \ 42 psphotFitSet.c \ 41 43 psphotCleanup.c 42 43 junk = psphotDefinePixels.c \44 pmSourceContour.c \45 pmModelFitSet.c \46 pmSourceFitSet.c \47 psphotModelTest.c48 44 49 45 noinst_HEADERS = \ … … 55 51 tags: 56 52 etags `find . -name \*.[ch] -print` 57 58 # psphotFullFit.c59 # psphotApplyPSF.c60 # psphotFitGalaxies.c61 # psphotLoadPixels.c -
trunk/psphot/src/psphot.c
r6715 r6727 27 27 exit (0); 28 28 } 29 30 /** I/O test code 31 32 psFits *fits = psFitsOpen (argv[1], "r"); 33 psMetadata *header = psFitsReadHeader (NULL, fits); 34 psFitsClose (fits); 35 36 psMetadata *new = psMetadataCopy (NULL, header); 37 psMetadataConfigWrite (new, "test.cnf"); 38 39 fits = psFitsOpen ("test.fits", "w"); 40 psFitsWriteHeaderNotImage (fits, new); 41 psFitsClose (fits); 42 43 exit (0); 44 45 **/ -
trunk/psphot/src/psphot.h
r6715 r6727 46 46 bool psphotImageLoop (pmConfig *config); 47 47 48 bool psphotModelTest (pmReadout *readout, psMetadata * arguments, psMetadata *recipe);48 bool psphotModelTest (pmReadout *readout, psMetadata *recipe); 49 49 bool psphotReadout (pmConfig *config, pmFPAview *view); 50 50 void psphotCleanup (void); … … 85 85 // output functions 86 86 bool psphotDumpMoments (psMetadata *config, psArray *sources); 87 bool psphotUpdateHeader (psMetadata *header,psMetadata *config);87 psMetadata *psphotDefineHeader (psMetadata *config); 88 88 89 89 // PSF / DBL / EXT evaluation functions -
trunk/psphot/src/psphotCleanup.c
r6715 r6727 9 9 psTimeFinalize (); 10 10 pmConceptsDone (); 11 fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "psphot"); 11 fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, NULL, false), "psphot"); 12 // fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "psphot"); 12 13 return; 13 14 } -
trunk/psphot/src/psphotImageLoop.c
r6715 r6727 28 28 29 29 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { 30 continue;31 30 psLogMsg ("psphot", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 32 31 if (! cell->process) { continue; } … … 39 38 if (! readout->data_exists) { continue; } 40 39 41 // run a single-model test if desired42 // XXX move this to psphotReadout??43 // psphotModelTest (readout, recipe);44 45 40 // run the actual photometry analysis 46 41 psphotReadout (config, view); 47 42 48 43 pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER); 49 50 // write out the desired output dataset(s)51 // psphotOutput (view, recipe);52 44 } 53 45 pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER); -
trunk/psphot/src/psphotModelTest.c
r6715 r6727 1 1 # include "psphot.h" 2 # include "psEllipse.h"3 2 static char DEFAULT_MODE[] = "EXT"; 4 3 5 bool psphotModelTest (pmReadout *readout, recipe) {4 bool psphotModelTest (pmReadout *readout, psMetadata *recipe) { 6 5 7 6 bool status; … … 97 96 fprintf (stderr, "sum: %f @ (%f, %f)\n", source->moments->Sum, source->moments->x, source->moments->y); 98 97 99 EllipseMoments moments;98 psEllipseMoments moments; 100 99 moments.x2 = source->moments->Sx; 101 100 moments.y2 = source->moments->Sy; 102 101 moments.xy = source->moments->Sxy; 103 EllipseAxes axes =EllipseMomentsToAxes (moments);102 psEllipseAxes axes = psEllipseMomentsToAxes (moments); 104 103 105 104 fprintf (stderr, "axes: %f @ (%f, %f)\n", axes.theta*180/M_PI, axes.major, axes.minor); … … 137 136 138 137 // list model input shape 139 EllipseShape shape;138 psEllipseShape shape; 140 139 shape.sx = 1.4 / model->params->data.F32[4]; 141 140 shape.sy = 1.4 / model->params->data.F32[5]; 142 141 shape.sxy = model->params->data.F32[6]; 143 axes = EllipseShapeToAxes (shape);142 axes = psEllipseShapeToAxes (shape); 144 143 145 144 fprintf (stderr, "guess: %f @ (%f, %f)\n", axes.theta*180/M_PI, axes.major, axes.minor); … … 152 151 153 152 // define the pixels used for the fit 154 psImageKeepCircle (source->mask, xObj, yObj, RADIUS, "OR", P SPHOT_MASK_MARKED);153 psImageKeepCircle (source->mask, xObj, yObj, RADIUS, "OR", PM_SOURCE_MASK_MARKED); 155 154 156 155 char *fitset = psMetadataLookupStr (&status, recipe, "TEST_FIT_SET"); … … 163 162 164 163 // measure the source mags 165 pmSourcePhotometry (&fitMag, &obsMag, model, source->pixels, source->mask); 164 pmSourcePhotometryModel (&fitMag, model); 165 pmSourcePhotometryAper (&obsMag, model, source->pixels, source->mask); 166 166 fprintf (stderr, "ap: %f, fit: %f, apmifit: %f\n", obsMag, fitMag, obsMag - fitMag); 167 167 -
trunk/psphot/src/psphotOutput.c
r6715 r6727 89 89 } 90 90 91 bool psphotUpdateHeader (psMetadata *header, psMetadata *config) { 91 // these values are saved in an output header stub - they are added to either the 92 // PHU header (CMP) or the MEF table header (CMF) 93 psMetadata *psphotDefineHeader (psMetadata *recipe) { 94 95 psMetadata *header = psMetadataAlloc (); 92 96 93 97 // write necessary information to output header 94 psMetadataItemTransfer (header, config, "NSTARS"); 95 psMetadataItemTransfer (header, config, "ZERO_PT"); 96 psMetadataItemTransfer (header, config, "APMIFIT"); 97 psMetadataItemTransfer (header, config, "dAPMIFIT"); 98 psMetadataItemTransfer (header, config, "SKYBIAS"); 99 psMetadataItemTransfer (header, config, "PHOTCODE"); 98 psMetadataItemTransfer (header, recipe, "ZERO_PT"); 99 psMetadataItemTransfer (header, recipe, "PHOTCODE"); 100 101 psMetadataItemTransfer (header, recipe, "APMIFIT"); 102 psMetadataItemTransfer (header, recipe, "DAPMIFIT"); 103 psMetadataItemTransfer (header, recipe, "NAPMIFIT"); 104 psMetadataItemTransfer (header, recipe, "SKYBIAS"); 105 psMetadataItemTransfer (header, recipe, "SKYSAT"); 100 106 101 // write necessary information to output header 102 psMetadataItemTransfer (header, config, "NPSFSTAR"); 103 psMetadataItemTransfer (header, config, "SKYBIAS"); 104 psMetadataItemTransfer (header, config, "SKYSAT"); 105 psMetadataItemTransfer (header, config, "APMIFIT"); 106 psMetadataItemTransfer (header, config, "DAPMIFIT"); 107 psMetadataItemTransfer (header, config, "NAPMIFIT"); 108 psMetadataItemTransfer (header, config, "APLOSS"); 107 psMetadataItemTransfer (header, recipe, "NPSFSTAR"); 108 psMetadataItemTransfer (header, recipe, "APLOSS"); 109 109 110 110 // XXX these need to be defined from elsewhere … … 115 115 psMetadataAdd (header, PS_LIST_TAIL, "FLIMIT", PS_DATA_F32 | PS_META_REPLACE, "COMPLETENESS MAG", 0.0); 116 116 117 return true;117 return header; 118 118 } -
trunk/psphot/src/psphotParseCamera.c
r6715 r6727 62 62 63 63 pmFPAfileDefine (config->files, format, input, "PSPHOT.OUTPUT"); 64 pmFPAfileDefine (config->files, format, input, "PSPHOT.RESID"); 64 65 65 // pmFPAfileDefine (config->files, format, input, "PSPHOT.RESID");66 66 // pmFPAfileDefine (config->files, format, input, "PSPHOT.PSF_INPUT"); 67 67 // pmFPAfileDefine (config->files, format, input, "PSPHOT.PSF_OUTPUT"); … … 76 76 77 77 // psphot is supplied with the output name 78 // this needs to be better: supply to all output (WRITE) files? 78 79 char *output = psMetadataLookupPtr(&status, config->arguments, "OUTPUT"); 80 79 81 file = psMetadataLookupPtr (&status, config->files, "PSPHOT.OUTPUT"); 82 if (!status) psAbort (__func__, "missing OUTPUT entry"); 83 psMetadataAddStr (file->names, PS_LIST_TAIL, "OUTPUT", 0, "", output); 84 85 file = psMetadataLookupPtr (&status, config->files, "PSPHOT.RESID"); 80 86 if (!status) psAbort (__func__, "missing OUTPUT entry"); 81 87 psMetadataAddStr (file->names, PS_LIST_TAIL, "OUTPUT", 0, "", output); … … 95 101 psMetadataAddStr (recipe, PS_LIST_TAIL, "PHOTCODE", PS_META_NO_REPLACE, "default photcode", "NONE"); 96 102 psMetadataAddStr (recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_NO_REPLACE, "default break point", "NONE"); 103 psMetadataAddF32 (recipe, PS_LIST_TAIL, "ZERO_PT", PS_META_NO_REPLACE, "default zero point", 25.00); 97 104 98 105 // Chip selection: if we are using a single chip, select it for each FPA -
trunk/psphot/src/psphotReadout.c
r6715 r6727 1 1 # include "psphot.h" 2 2 3 // XXX 2006.02.07 : no leaks! 4 // XXX change 'config' to 'recipe' eventually 3 // XXX 2006.03.28 : no leaks! 5 4 bool psphotReadout (pmConfig *config, pmFPAview *view) { 6 5 … … 15 14 pmReadout *readout = pmFPAviewThisReadout (view, input->fpa); 16 15 17 sources = psphotFakeSources();18 status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "psphot sources", sources);19 psFree (sources);20 return true;21 22 16 // XXX does this need to invoke I/O? 23 17 pmReadoutSetWeights (readout); … … 25 19 // I have a valid mask, now mask in the analysis region of interest 26 20 psphotMaskReadout (readout, recipe); 21 22 // run a single-model test if desired 23 psphotModelTest (readout, recipe); 27 24 28 25 // generate a background model (median, smoothed image) … … 55 52 psphotReplaceUnfit (sources); 56 53 57 // find remaining peaks after first source subtraction pass54 // XXX find remaining peaks after first source subtraction pass 58 55 // psphotFindPeaks (); 59 56 … … 67 64 psphotMagnitudes (sources, recipe, psf); 68 65 69 // update the header with stats results 70 // XXX need to do this conditionally? 71 // XXX psMetadata *header = pmReadoutGetHeader (readout); 72 // XXX psphotUpdateHeader (header, config); 66 // create an output header with stats results 67 psMetadata *header = psphotDefineHeader (recipe); 73 68 74 // XXX make this an option?75 69 // replace background in residual image 76 70 psphotSkyReplace (config, view); 77 71 78 // need to do something with the sources, psf, and sky 79 status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "psphot sources", sources); 80 status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN, "psphot psf", psf); 81 // XXX : replace? status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SKY.MEAN", PS_DATA_F32, "psphot sky mean", sky->sampleMean); 82 // XXX : replace? status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SKY.SIGMA", PS_DATA_F32, "psphot sky stdev", sky->sampleStdev); 72 // save the results of the analysis 73 status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "psphot sources", sources); 74 status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.HEADER", PS_DATA_METADATA, "header stats", header); 75 status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN, "psphot psf", psf); 83 76 84 77 // free up the local copies of the data 85 78 psFree (psf); 79 psFree (header); 86 80 psFree (sources); 87 81 psFree (peaks); … … 89 83 } 90 84 91 92 // XXX Deprecate or allow these versions? 93 # if (0) 94 // select analysis method 95 char *FITMODE = psMetadataLookupStr (&status, config, "FITMODE"); 96 if (!strcasecmp(FITMODE, "ENSEMBLE")) { 97 psphotEnsemblePSF (readout, config, sources, psf); 98 } 99 100 if (!strcasecmp(FITMODE, "FULL")) { 101 psphotEnsemblePSF (readout, config, sources, psf); 102 psphotFullFit (readout, config, sources, psf); 103 psphotReplaceUnfit (sources); 104 psphotApResid (readout, sources, config, psf); 105 } 106 107 if (!strcasecmp(FITMODE, "BASIC")) { 108 psphotApplyPSF (readout, config, sources, psf); 109 psphotFitExtended (readout, config, sources); 110 } 111 112 113 114 psphotSaveImage (NULL, readout->image, "pixels.fits"); 115 psphotSaveImage (NULL, readout->weight, "weight.fits"); 116 psphotSaveImage (NULL, readout->mask, "mask.fits"); 117 exit (1); 118 119 # endif 85 # if (1) 86 fprintf (stderr, "making fake sources\n"); 87 sources = psphotFakeSources (); 88 psMetadata *tmp = psMetadataAlloc (); 89 status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "psphot sources", sources); 90 status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.HEADER", PS_DATA_METADATA, "header stats", tmp); 91 psFree (sources); 92 psFree (tmp); 93 return true; 94 # endif -
trunk/psphot/src/psphotSkyReplace.c
r6715 r6727 1 1 # include "psphot.h" 2 2 3 // XXX make this an option? 3 4 // in order to successfully replace the sky, we must define a corresponding file... 4 5 bool psphotSkyReplace (pmConfig *config, pmFPAview *view) {
Note:
See TracChangeset
for help on using the changeset viewer.
