Changeset 21374
- Timestamp:
- Feb 5, 2009, 5:20:02 PM (17 years ago)
- Location:
- trunk/ppSub/src
- Files:
-
- 5 edited
-
ppSubCamera.c (modified) (6 diffs)
-
ppSubReadoutPhotometry.c (modified) (7 diffs)
-
ppSubReadoutRenorm.c (modified) (4 diffs)
-
ppSubReadoutSubtract.c (modified) (5 diffs)
-
ppSubVarianceFactors.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/ppSubCamera.c
r21360 r21374 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1.3 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-06 0 1:37:17$8 * @version $Revision: 1.33 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-06 03:20:02 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 39 39 } 40 40 41 // Input weightmap42 pmFPAfile *input Weight = pmFPAfileBindFromArgs(&status, input, config, "PPSUB.INPUT.WEIGHT", "INPUT.WEIGHT");43 if (!status) { 44 psError (PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.INPUT. WEIGHT");41 // Input variance map 42 pmFPAfile *inputVariance = pmFPAfileBindFromArgs(&status, input, config, "PPSUB.INPUT.VARIANCE", "INPUT.VARIANCE"); 43 if (!status) { 44 psError (PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.INPUT.VARIANCE"); 45 45 return NULL; 46 46 } 47 if (input Weight && inputWeight->type != PM_FPA_FILE_WEIGHT) {48 psError(PS_ERR_IO, true, "PPSUB.INPUT. WEIGHT is not of type WEIGHT");47 if (inputVariance && inputVariance->type != PM_FPA_FILE_VARIANCE) { 48 psError(PS_ERR_IO, true, "PPSUB.INPUT.VARIANCE is not of type VARIANCE"); 49 49 return false; 50 50 } … … 73 73 } 74 74 75 // Reference weightmap76 pmFPAfile *ref Weight = pmFPAfileBindFromArgs(&status, ref, config, "PPSUB.REF.WEIGHT", "REF.WEIGHT");77 if (!status) { 78 psError (PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.REF. WEIGHT");75 // Reference variance map 76 pmFPAfile *refVariance = pmFPAfileBindFromArgs(&status, ref, config, "PPSUB.REF.VARIANCE", "REF.VARIANCE"); 77 if (!status) { 78 psError (PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.REF.VARIANCE"); 79 79 return NULL; 80 80 } 81 if (ref Weight && refWeight->type != PM_FPA_FILE_WEIGHT) {82 psError(PS_ERR_IO, true, "PPSUB.REF. WEIGHT is not of type WEIGHT");81 if (refVariance && refVariance->type != PM_FPA_FILE_VARIANCE) { 82 psError(PS_ERR_IO, true, "PPSUB.REF.VARIANCE is not of type VARIANCE"); 83 83 return false; 84 84 } … … 108 108 outMask->save = true; 109 109 110 // Output weight111 if (input Weight && refWeight) {112 pmFPAfile *out Weight = pmFPAfileDefineOutput(config, output->fpa, "PPSUB.OUTPUT.WEIGHT");113 if (!out Weight) {114 psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT. WEIGHT"));115 return false; 116 } 117 if (out Weight->type != PM_FPA_FILE_WEIGHT) {118 psError(PS_ERR_IO, true, "PPSUB.OUTPUT. WEIGHT is not of type WEIGHT");119 return false; 120 } 121 out Weight->save = true;110 // Output variance 111 if (inputVariance && refVariance) { 112 pmFPAfile *outVariance = pmFPAfileDefineOutput(config, output->fpa, "PPSUB.OUTPUT.VARIANCE"); 113 if (!outVariance) { 114 psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT.VARIANCE")); 115 return false; 116 } 117 if (outVariance->type != PM_FPA_FILE_VARIANCE) { 118 psError(PS_ERR_IO, true, "PPSUB.OUTPUT.VARIANCE is not of type VARIANCE"); 119 return false; 120 } 121 outVariance->save = true; 122 122 } 123 123 … … 146 146 // XXX should be based on recipe : inConvMask->save = true; 147 147 148 // Convolved input weight149 if (input Weight) {150 pmFPAfile *inConv Weight = pmFPAfileDefineOutput(config, inConv->fpa, "PPSUB.INPUT.CONV.WEIGHT");151 if (!inConv Weight) {152 psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT. WEIGHT"));153 return false; 154 } 155 if (inConv Weight->type != PM_FPA_FILE_WEIGHT) {156 psError(PS_ERR_IO, true, "PPSUB.INPUT.CONV. WEIGHT is not of type WEIGHT");157 return false; 158 } 159 // XXX should be based on recipe : inConv Weight->save = true;148 // Convolved input variance 149 if (inputVariance) { 150 pmFPAfile *inConvVariance = pmFPAfileDefineOutput(config, inConv->fpa, "PPSUB.INPUT.CONV.VARIANCE"); 151 if (!inConvVariance) { 152 psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT.VARIANCE")); 153 return false; 154 } 155 if (inConvVariance->type != PM_FPA_FILE_VARIANCE) { 156 psError(PS_ERR_IO, true, "PPSUB.INPUT.CONV.VARIANCE is not of type VARIANCE"); 157 return false; 158 } 159 // XXX should be based on recipe : inConvVariance->save = true; 160 160 } 161 161 … … 184 184 // XXX should be based on recipe : refConvMask->save = true; 185 185 186 // Convolved ref weight187 if (ref Weight) {188 pmFPAfile *refConv Weight = pmFPAfileDefineOutput(config, refConv->fpa, "PPSUB.REF.CONV.WEIGHT");189 if (!refConv Weight) {190 psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT. WEIGHT"));191 return false; 192 } 193 if (refConv Weight->type != PM_FPA_FILE_WEIGHT) {194 psError(PS_ERR_IO, true, "PPSUB.REF.CONV. WEIGHT is not of type WEIGHT");195 return false; 196 } 197 // XXX should be based on recipe : refConv Weight->save = true;186 // Convolved ref variance 187 if (refVariance) { 188 pmFPAfile *refConvVariance = pmFPAfileDefineOutput(config, refConv->fpa, "PPSUB.REF.CONV.VARIANCE"); 189 if (!refConvVariance) { 190 psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT.VARIANCE")); 191 return false; 192 } 193 if (refConvVariance->type != PM_FPA_FILE_VARIANCE) { 194 psError(PS_ERR_IO, true, "PPSUB.REF.CONV.VARIANCE is not of type VARIANCE"); 195 return false; 196 } 197 // XXX should be based on recipe : refConvVariance->save = true; 198 198 } 199 199 -
trunk/ppSub/src/ppSubReadoutPhotometry.c
r21360 r21374 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-06 0 1:37:17$8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-06 03:20:02 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 25 25 26 26 if (!psMetadataLookupBool(NULL, recipe, "PHOTOMETRY")) { 27 pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL");28 pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL.STDEV");29 return true;27 pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL"); 28 pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL.STDEV"); 29 return true; 30 30 } 31 31 … … 40 40 pmPSF *psf = psMetadataLookupPtr(NULL, psfInputChip->analysis, "PSPHOT.PSF"); 41 41 if (!psf) { 42 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find PSF from psphot");43 return false;42 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find PSF from psphot"); 43 return false; 44 44 } 45 45 psMetadataAddPtr(psfLoadChip->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN | PS_META_REPLACE, "PSF from matched addition", psf); … … 55 55 pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); // Readout with the sources 56 56 if (!photRO) { 57 pmCell *cell = pmFPAfileThisCell(config->files, view, "PSPHOT.RESID"); // Output cell58 photRO = pmReadoutAlloc(cell); // Output readout: subtraction57 pmCell *cell = pmFPAfileThisCell(config->files, view, "PSPHOT.RESID"); // Output cell 58 photRO = pmReadoutAlloc(cell); // Output readout: subtraction 59 59 } 60 60 photRO->image = psImageCopy(photRO->image, outRO->image, PS_TYPE_F32); 61 if (outRO-> weight) {62 photRO->weight = psImageCopy(photRO->weight, outRO->weight, PS_TYPE_F32);61 if (outRO->variance) { 62 photRO->variance = psImageCopy(photRO->variance, outRO->variance, PS_TYPE_F32); 63 63 } else { 64 psFree (photRO->weight);65 photRO->weight= NULL;64 psFree (photRO->variance); 65 photRO->variance = NULL; 66 66 } 67 67 if (outRO->mask) { 68 photRO->mask = psImageCopy(photRO->mask, outRO->mask, PS_TYPE_IMAGE_MASK);68 photRO->mask = psImageCopy(photRO->mask, outRO->mask, PS_TYPE_IMAGE_MASK); 69 69 } else { 70 psFree (photRO->mask);71 photRO->mask = NULL;70 psFree (photRO->mask); 71 photRO->mask = NULL; 72 72 } 73 73 … … 77 77 // old-style variance renormalization 78 78 if (!ppSubReadoutRenormPhot (config, recipe, photRO)) { 79 psError(PS_ERR_UNKNOWN, false, "failure in renormalization");80 return false;79 psError(PS_ERR_UNKNOWN, false, "failure in renormalization"); 80 return false; 81 81 } 82 82 83 83 if (!psphotReadoutMinimal(config, view)) { 84 psWarning("Unable to perform photometry on subtracted image.");85 psErrorStackPrint(stderr, "Error stack from photometry:");86 psErrorClear();84 psWarning("Unable to perform photometry on subtracted image."); 85 psErrorStackPrint(stderr, "Error stack from photometry:"); 86 psErrorClear(); 87 87 } 88 88 89 89 if (stats) { 90 psArray *sources = psMetadataLookupPtr(NULL, photRO->analysis, "PSPHOT.SOURCES"); // Sources91 psMetadataAddS32(stats, PS_LIST_TAIL, "NUM_SOURCES", 0, "Number of sources detected",92 sources ? sources->n : 0);93 psMetadataAddF32(stats, PS_LIST_TAIL, "TIME_PHOT", 0, "Time to do photometry",94 psTimerClear("PPSUB_PHOT"));90 psArray *sources = psMetadataLookupPtr(NULL, photRO->analysis, "PSPHOT.SOURCES"); // Sources 91 psMetadataAddS32(stats, PS_LIST_TAIL, "NUM_SOURCES", 0, "Number of sources detected", 92 sources ? sources->n : 0); 93 psMetadataAddF32(stats, PS_LIST_TAIL, "TIME_PHOT", 0, "Time to do photometry", 94 psTimerClear("PPSUB_PHOT")); 95 95 } 96 96 … … 103 103 // XXX not sure that this is still needed (only if psphotReadoutMinimal measures the background) 104 104 // if (!pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL") || 105 // !pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL.STDEV") ||106 // !pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND")) {107 // psError(PS_ERR_UNKNOWN, false, "Unable to drop PSPHOT internal files.");108 // return false;105 // !pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL.STDEV") || 106 // !pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND")) { 107 // psError(PS_ERR_UNKNOWN, false, "Unable to drop PSPHOT internal files."); 108 // return false; 109 109 // } 110 110 … … 116 116 // Record data about sources: not everything gets into the output CMF files 117 117 { 118 pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); // Readout with the sources119 psArray *sources = psMetadataLookupPtr(NULL, photRO->analysis, "PSPHOT.SOURCES"); // Sources120 FILE *sourceFile = fopen("sources.dat", "w"); // File for sources121 fprintf(sourceFile,122 "# x y mag mag_err psf_chisq cr_nsigma ext_nsigma psf_qf flags m_x m_y m_xx m_xy m_yy\n");123 for (int i = 0; i < sources->n; i++) {124 pmSource *source = sources->data[i];125 if (!source) {126 continue;127 }118 pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); // Readout with the sources 119 psArray *sources = psMetadataLookupPtr(NULL, photRO->analysis, "PSPHOT.SOURCES"); // Sources 120 FILE *sourceFile = fopen("sources.dat", "w"); // File for sources 121 fprintf(sourceFile, 122 "# x y mag mag_err psf_chisq cr_nsigma ext_nsigma psf_qf flags m_x m_y m_xx m_xy m_yy\n"); 123 for (int i = 0; i < sources->n; i++) { 124 pmSource *source = sources->data[i]; 125 if (!source) { 126 continue; 127 } 128 128 129 float x, y; // Position of source130 float chi2; // chi^2 for source131 if (source->modelPSF) {132 x = source->modelPSF->params->data.F32[PM_PAR_XPOS];133 y = source->modelPSF->params->data.F32[PM_PAR_YPOS];134 chi2 = source->modelPSF->chisq;135 } else if (source->peak) {136 x = source->peak->xf;137 y = source->peak->yf;138 chi2 = NAN;139 } else {140 psWarning("No position available for source.");141 continue;142 }129 float x, y; // Position of source 130 float chi2; // chi^2 for source 131 if (source->modelPSF) { 132 x = source->modelPSF->params->data.F32[PM_PAR_XPOS]; 133 y = source->modelPSF->params->data.F32[PM_PAR_YPOS]; 134 chi2 = source->modelPSF->chisq; 135 } else if (source->peak) { 136 x = source->peak->xf; 137 y = source->peak->yf; 138 chi2 = NAN; 139 } else { 140 psWarning("No position available for source."); 141 continue; 142 } 143 143 144 float xMoment = NAN, yMoment = NAN, xxMoment = NAN, xyMoment = NAN, yyMoment = NAN;145 if (source->moments) {146 xMoment = source->moments->Mx;147 yMoment = source->moments->My;148 xxMoment = source->moments->Mxx;149 xyMoment = source->moments->Mxy;150 yyMoment = source->moments->Myy;151 }144 float xMoment = NAN, yMoment = NAN, xxMoment = NAN, xyMoment = NAN, yyMoment = NAN; 145 if (source->moments) { 146 xMoment = source->moments->Mx; 147 yMoment = source->moments->My; 148 xxMoment = source->moments->Mxx; 149 xyMoment = source->moments->Mxy; 150 yyMoment = source->moments->Myy; 151 } 152 152 153 fprintf(sourceFile, "%f %f %f %f %f %f %f %f %d %f %f %f %f %f\n",154 x, y, source->psfMag, source->errMag, chi2, source->crNsigma, source->extNsigma,155 source->pixWeight, source->mode, xMoment, yMoment, xxMoment, xyMoment, yyMoment);156 }157 fclose(sourceFile);153 fprintf(sourceFile, "%f %f %f %f %f %f %f %f %d %f %f %f %f %f\n", 154 x, y, source->psfMag, source->errMag, chi2, source->crNsigma, source->extNsigma, 155 source->pixWeight, source->mode, xMoment, yMoment, xxMoment, xyMoment, yyMoment); 156 } 157 fclose(sourceFile); 158 158 } 159 159 #endif -
trunk/ppSub/src/ppSubReadoutRenorm.c
r21360 r21374 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-06 0 1:37:17$8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-06 03:20:02 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 23 23 psStatsOptions renormStdev = psStatsOptionFromString(psMetadataLookupStr(&mdok, recipe, "RENORM.STDEV")); 24 24 if (renormMean == PS_STAT_NONE || renormStdev == PS_STAT_NONE) { 25 psError(PS_ERR_BAD_PARAMETER_VALUE, false,26 "Unable to parse renormalisation statistics from recipe.");27 return false;25 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 26 "Unable to parse renormalisation statistics from recipe."); 27 return false; 28 28 } 29 29 psImageMaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask 30 if (!pmReadout WeightRenormPixels(readout, maskValue, renormMean, renormStdev, NULL)) {31 psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");32 return false;30 if (!pmReadoutVarianceRenormPixels(readout, maskValue, renormMean, renormStdev, NULL)) { 31 psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances."); 32 return false; 33 33 } 34 34 return true; … … 48 48 psStatsOptions renormStdev = psStatsOptionFromString(psMetadataLookupStr(&mdok, recipe, "RENORM.STDEV")); 49 49 if (renormMean == PS_STAT_NONE || renormStdev == PS_STAT_NONE) { 50 psError(PS_ERR_BAD_PARAMETER_VALUE, false,51 "Unable to parse renormalisation statistics from recipe.");52 return false;50 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 51 "Unable to parse renormalisation statistics from recipe."); 52 return false; 53 53 } 54 54 … … 58 58 59 59 psImageMaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask 60 if (!pmReadout WeightRenormPhot(readout, maskValue, renormNum, renormWidth, renormMean, renormStdev, NULL)) {61 psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances.");62 return false;60 if (!pmReadoutVarianceRenormPhot(readout, maskValue, renormNum, renormWidth, renormMean, renormStdev, NULL)) { 61 psError(PS_ERR_UNKNOWN, false, "Unable to renormalise variances."); 62 return false; 63 63 } 64 64 return true; -
trunk/ppSub/src/ppSubReadoutSubtract.c
r21360 r21374 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-06 0 1:37:17$8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-06 03:20:02 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 28 28 pmReadout *subtrahend = NULL; 29 29 if (reverse) { 30 minuend = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.CONV");31 subtrahend = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT.CONV");30 minuend = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.CONV"); 31 subtrahend = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT.CONV"); 32 32 } else { 33 minuend = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT.CONV");34 subtrahend = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.CONV");33 minuend = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT.CONV"); 34 subtrahend = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.CONV"); 35 35 } 36 36 … … 53 53 // Do the actual subtraction 54 54 pmReadout *outRO = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT"); 55 outRO->image = (psImage *)psBinaryOp(outRO->image, minuend->image, "-", subtrahend->image);56 if (minuend-> weight && subtrahend->weight) {57 outRO-> weight = (psImage *) psBinaryOp(outRO->weight, minuend->weight, "+", subtrahend->weight);55 outRO->image = (psImage*)psBinaryOp(outRO->image, minuend->image, "-", subtrahend->image); 56 if (minuend->variance && subtrahend->variance) { 57 outRO->variance = (psImage*)psBinaryOp(outRO->variance, minuend->variance, "+", subtrahend->variance); 58 58 } 59 outRO->mask = (psImage *)psBinaryOp(outRO->mask, minuend->mask, "|", subtrahend->mask);59 outRO->mask = (psImage*)psBinaryOp(outRO->mask, minuend->mask, "|", subtrahend->mask); 60 60 61 61 outRO->data_exists = true; … … 83 83 if (!outHDU || !inHDU) { 84 84 psError(PS_ERR_UNKNOWN, false, "Unable to find HDU at FPA level to copy astrometry."); 85 return false;86 } 85 return false; 86 } 87 87 88 88 // Copy astrometry over … … 90 90 if (!pmAstromReadWCS(outFPA, outChip, inHDU->header, 1.0)) { 91 91 psError(PS_ERR_UNKNOWN, false, "Unable to read WCS astrometry from input FPA."); 92 return false;93 } 92 return false; 93 } 94 94 95 95 if (!pmAstromWriteWCS(outHDU->header, outFPA, outChip, WCS_TOLERANCE)) { 96 96 psError(PS_ERR_UNKNOWN, false, "Unable to write WCS astrometry to output FPA."); 97 return false;97 return false; 98 98 } 99 99 -
trunk/ppSub/src/ppSubVarianceFactors.c
r21360 r21374 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-06 0 1:37:17$8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-06 03:20:02 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 40 40 pmSubtractionKernels *kernels = psMetadataLookupPtr(&mdok, outRO->analysis, PM_SUBTRACTION_ANALYSIS_KERNEL); // Kernels 41 41 if (!mdok) { 42 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find subtraction kernels.");43 return false;42 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find subtraction kernels."); 43 return false; 44 44 } 45 45 46 46 float vfIn = psMetadataLookupF32(NULL, inCell->concepts, "CELL.VARFACTOR"); // Variance factor for input 47 47 if (!isfinite(vfIn)) { 48 vfIn = 1.0;48 vfIn = 1.0; 49 49 } 50 50 float vfRef = psMetadataLookupF32(NULL, refCell->concepts, "CELL.VARFACTOR"); // Variance factor for ref 51 51 if (!isfinite(vfRef)) { 52 vfRef = 1.0;52 vfRef = 1.0; 53 53 } 54 54 55 55 if (kernels->mode == PM_SUBTRACTION_MODE_1) { 56 vfIn *= pmSubtractionVarianceFactor(kernels, 0.0, 0.0, false);56 vfIn *= pmSubtractionVarianceFactor(kernels, 0.0, 0.0, false); 57 57 } 58 58 if (kernels->mode == PM_SUBTRACTION_MODE_2) { 59 vfRef *= pmSubtractionVarianceFactor(kernels, 0.0, 0.0, false);60 } 59 vfRef *= pmSubtractionVarianceFactor(kernels, 0.0, 0.0, false); 60 } 61 61 if (kernels->mode == PM_SUBTRACTION_MODE_DUAL) { 62 vfIn *= pmSubtractionVarianceFactor(kernels, 0.0, 0.0, false);63 vfRef *= pmSubtractionVarianceFactor(kernels, 0.0, 0.0, true);62 vfIn *= pmSubtractionVarianceFactor(kernels, 0.0, 0.0, false); 63 vfRef *= pmSubtractionVarianceFactor(kernels, 0.0, 0.0, true); 64 64 } 65 65 … … 72 72 73 73 // measure the mean of the convolved input variance image 74 if (!psImageBackground(vfStats, NULL, inConv-> weight, inConv->mask, maskVal | maskBad, rng)) {75 psError(PS_ERR_UNKNOWN, false, "Unable to measure mean variance for convolved input");76 psFree(vfStats);77 psFree(rng);78 return false;74 if (!psImageBackground(vfStats, NULL, inConv->variance, inConv->mask, maskVal | maskBad, rng)) { 75 psError(PS_ERR_UNKNOWN, false, "Unable to measure mean variance for convolved input"); 76 psFree(vfStats); 77 psFree(rng); 78 return false; 79 79 } 80 80 float inMeanVar = vfStats->robustMedian; // Mean variance of input 81 81 82 82 // measure the mean of the convolved reference variance image 83 if (!psImageBackground(vfStats, NULL, refConv-> weight, refConv->mask, maskVal | maskBad, rng)) {84 psError(PS_ERR_UNKNOWN, false, "Unable to measure mean variance for convolved reference");85 psFree(vfStats);86 psFree(rng);87 return false;83 if (!psImageBackground(vfStats, NULL, refConv->variance, refConv->mask, maskVal | maskBad, rng)) { 84 psError(PS_ERR_UNKNOWN, false, "Unable to measure mean variance for convolved reference"); 85 psFree(vfStats); 86 psFree(rng); 87 return false; 88 88 } 89 89 float refMeanVar = vfStats->robustMedian; // Mean variance of reference … … 98 98 // Statistics on the matching 99 99 if (stats) { 100 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MODE);101 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_STAMPS);102 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_DEV_MEAN);103 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_DEV_RMS);104 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_NORM);105 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_BGDIFF);106 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MX);107 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MY);108 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MXX);109 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MXY);110 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MYY);100 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MODE); 101 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_STAMPS); 102 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_DEV_MEAN); 103 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_DEV_RMS); 104 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_NORM); 105 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_BGDIFF); 106 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MX); 107 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MY); 108 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MXX); 109 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MXY); 110 psMetadataCopySingle(stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MYY); 111 111 112 psMetadataAddF32(stats, PS_LIST_TAIL, "TIME_MATCH", 0, "Time to match PSFs",113 psTimerClear("PPSUB_MATCH"));112 psMetadataAddF32(stats, PS_LIST_TAIL, "TIME_MATCH", 0, "Time to match PSFs", 113 psTimerClear("PPSUB_MATCH")); 114 114 } 115 115 116 116 return true; 117 117 }
Note:
See TracChangeset
for help on using the changeset viewer.
