Changeset 40941
- Timestamp:
- Oct 13, 2019, 1:01:49 PM (7 years ago)
- Location:
- branches/eam_branches/ipp-20191011/psModules/test/objects
- Files:
-
- 2 edited
-
Makefile.am (modified) (1 diff)
-
tap_pmSourceFitModel.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20191011/psModules/test/objects/Makefile.am
r38280 r40941 12 12 13 13 TEST_PROGS = \ 14 tap_pmPeaks \ 15 tap_pmGrowthCurve \ 16 tap_pmMoments \ 17 tap_pmSource \ 18 tap_pmModel \ 19 tap_pmModelUtils \ 20 tap_pmModelClass \ 21 tap_pmModel_CentralPixel \ 22 tap_pmModel_CentralPixel_v2 \ 23 tap_pmModel_SET_FWHM \ 24 tap_pmPSF \ 25 tap_pmTrend2D \ 26 tap_pmResiduals \ 27 tap_pmSourceExtendedPars \ 28 tap_pmSourceSky \ 29 tap_pmSourceMoments \ 30 tap_pmSourceIO_PS1_DEV_0 \ 31 tap_pmSourceIO_PS1_DEV_1 \ 32 tap_pmSourceIO_SMPDATA \ 33 tap_pmSourceContour \ 34 tap_pmSourceUtils \ 35 tap_pmSourceFitSet \ 36 tap_pmPSF_IO \ 37 tap_pmSourceIO_SMPDATA 14 tap_pmSourceFitModel 15 16 # tap_pmPeaks \ 17 # tap_pmGrowthCurve \ 18 # tap_pmMoments \ 19 # tap_pmSource \ 20 # tap_pmModel \ 21 # tap_pmModelUtils \ 22 # tap_pmModelClass \ 23 # tap_pmModel_CentralPixel \ 24 # tap_pmModel_CentralPixel_v2 \ 25 # tap_pmModel_SET_FWHM \ 26 # tap_pmPSF \ 27 # tap_pmTrend2D \ 28 # tap_pmResiduals \ 29 # tap_pmSourceExtendedPars \ 30 # tap_pmSourceSky \ 31 # tap_pmSourceMoments \ 32 # tap_pmSourceIO_PS1_DEV_0 \ 33 # tap_pmSourceIO_PS1_DEV_1 \ 34 # tap_pmSourceIO_SMPDATA \ 35 # tap_pmSourceContour \ 36 # tap_pmSourceUtils \ 37 # tap_pmSourceFitSet \ 38 # tap_pmPSF_IO \ 39 # tap_pmSourceIO_SMPDATA 38 40 39 41 if BUILD_TESTS -
branches/eam_branches/ipp-20191011/psModules/test/objects/tap_pmSourceFitModel.c
r23259 r40941 18 18 int main (void) 19 19 { 20 pmModel GroupInit ();21 pmSourceFitModelInit (15, 0.01, 1.0, true);20 pmModelClassInit (); 21 // pmSourceFitModelInit (15, 0.01, 1.0, true); 22 22 23 23 // psTraceSetLevel ("psModules.objects.pmSourceFitModel", 10); … … 108 108 { 109 109 110 psImageMaskType maskVal = 0x01; 111 110 112 psVector *rnd = psVectorAlloc (1000, PS_TYPE_F32); 111 113 for (int i = 0; i < rnd->n; i++) { … … 128 130 source->modelEXT->params->data.F32[6] = 0; 129 131 130 source->pixels = psImageAlloc (100, 100, PS_TYPE_F32);131 source-> weight= psImageAlloc (100, 100, PS_TYPE_F32);132 source->mask = psImageAlloc (100, 100, PS_TYPE_U8);132 source->pixels = psImageAlloc (100, 100, PS_TYPE_F32); 133 source->variance = psImageAlloc (100, 100, PS_TYPE_F32); 134 source->maskObj = psImageAlloc (100, 100, PS_TYPE_IMAGE_MASK); 133 135 psImageInit (source->pixels, 0.0); 134 psImageInit (source-> weight, 0.0);135 psImageInit (source->mask , 0);136 psImageInit (source->variance, 0.0); 137 psImageInit (source->maskObj, 0); 136 138 137 139 // create an image with the model, and add noise: gain is 1, subtracted sky is 100, readnoise is 5 138 pmModelAdd (source->pixels, source->mask , source->modelEXT, PM_MODEL_OP_FULL);140 pmModelAdd (source->pixels, source->maskObj, source->modelEXT, PM_MODEL_OP_FULL, maskVal); 139 141 int npix = 0; 140 142 for (int j = 0; j < source->pixels->numRows; j++) { … … 143 145 float var = flux + 100 + PS_SQR(5); 144 146 source->pixels->data.F32[j][i] += rnd->data.F32[npix]*sqrt(var); 145 source-> weight->data.F32[j][i] = var;147 source->variance->data.F32[j][i] = var; 146 148 npix ++; 147 149 if (npix == rnd->n) … … 162 164 guess->params->data.F32[5] *= 0.9; 163 165 164 psImageKeepCircle (source->mask, 50, 50, radius, "OR", PM_MASK_MARK); 165 bool status = pmSourceFitModel (source, guess, PM_SOURCE_FIT_EXT); 166 pmSourceFitOptions *fitOptions = pmSourceFitOptionsAlloc(); 167 fitOptions->mode = PM_SOURCE_FIT_EXT; 168 fitOptions->covarFactor = 1.0; 169 170 // use maskVal to exclude pixels outside the circle 171 psImageKeepCircle (source->maskObj, 50, 50, radius, "OR", maskVal); 172 173 bool status = pmSourceFitModel (source, guess, fitOptions, maskVal); 166 174 if (!status) { 167 175 psFree (rnd); … … 170 178 return false; 171 179 } 172 psImage KeepCircle (source->mask, 50, 50, radius, "AND", PS_NOT_U8(PM_MASK_MARK));180 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(maskVal)); 173 181 174 182 par1->data.F32[par1->n] = (source->modelEXT->params->data.F32[1] / guess->params->data.F32[1]);
Note:
See TracChangeset
for help on using the changeset viewer.
