Changeset 21471
- Timestamp:
- Feb 13, 2009, 12:41:28 PM (17 years ago)
- Location:
- trunk/psModules/test/objects
- Files:
-
- 9 edited
-
tap_pmModel.c (modified) (1 diff)
-
tap_pmModelClass.c (modified) (1 diff)
-
tap_pmPSF_IO.c (modified) (2 diffs)
-
tap_pmResiduals.c (modified) (1 diff)
-
tap_pmSource.c (modified) (8 diffs)
-
tap_pmSourceExtendedPars.c (modified) (1 diff)
-
tap_pmSourceFitSet.c (modified) (4 diffs)
-
tap_pmSourceSky.c (modified) (7 diffs)
-
tap_pmSourceUtils.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/test/objects/tap_pmModel.c
r15985 r21471 33 33 readout->image = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 34 34 readout->mask = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_U8); 35 readout-> weight= psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);35 readout->variance = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 36 36 for (psS32 i = 0 ; i < NUM_BIAS_DATA ; i++) { 37 37 psImage *tmpImage = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); -
trunk/psModules/test/objects/tap_pmModelClass.c
r15985 r21471 30 30 readout->image = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 31 31 readout->mask = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_U8); 32 readout-> weight= psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);32 readout->variance = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 33 33 for (psS32 i = 0 ; i < NUM_BIAS_DATA ; i++) { 34 34 psImage *tmpImage = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); -
trunk/psModules/test/objects/tap_pmPSF_IO.c
r21223 r21471 55 55 readout->image = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 56 56 readout->mask = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_U8); 57 readout-> weight= psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);57 readout->variance = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 58 58 for (psS32 i = 0 ; i < NUM_BIAS_DATA ; i++) { 59 59 psImage *tmpImage = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); … … 93 93 cell->hdu->images = psArrayAlloc(NUM_HDUS); 94 94 cell->hdu->masks = psArrayAlloc(NUM_HDUS); 95 cell->hdu-> weights = psArrayAlloc(NUM_HDUS);95 cell->hdu->variances = psArrayAlloc(NUM_HDUS); 96 96 for (int k = 0 ; k < NUM_HDUS ; k++) { 97 97 cell->hdu->images->data[k] = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 98 98 cell->hdu->masks->data[k] = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_MASK); 99 cell->hdu-> weights->data[k] = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);99 cell->hdu->variances->data[k] = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 100 100 psImageInit(cell->hdu->images->data[k], (float) (BASE_IMAGE+k)); 101 101 psImageInit(cell->hdu->masks->data[k], (psU8) (BASE_MASK+k)); 102 psImageInit(cell->hdu-> weights->data[k], (float) (BASE_WEIGHT+k));102 psImageInit(cell->hdu->variances->data[k], (float) (BASE_WEIGHT+k)); 103 103 } 104 104 -
trunk/psModules/test/objects/tap_pmResiduals.c
r15985 r21471 29 29 ok(resid->Rx && psMemCheckImage(resid->Rx), "pmResidualsAlloc() allocated the resid->Rx image"); 30 30 ok(resid->Ry && psMemCheckImage(resid->Ry), "pmResidualsAlloc() allocated the resid->Ry image"); 31 ok(resid-> weight && psMemCheckImage(resid->weight), "pmResidualsAlloc() allocated the resid->weightimage");31 ok(resid->variance && psMemCheckImage(resid->variance ), "pmResidualsAlloc() allocated the resid->variance image"); 32 32 ok(resid->mask && psMemCheckImage(resid->mask), "pmResidualsAlloc() allocated the resid->mask image"); 33 33 -
trunk/psModules/test/objects/tap_pmSource.c
r21223 r21471 48 48 readout->image = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 49 49 readout->mask = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_U8); 50 readout-> weight= psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);50 readout->variance = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 51 51 for (psS32 i = 0 ; i < NUM_BIAS_DATA ; i++) { 52 52 psImage *tmpImage = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); … … 77 77 ok(src->peak == NULL, "pmSourceAlloc() pmSource->peak correctly"); 78 78 ok(src->pixels == NULL, "pmSourceAlloc() pmSource->pixels correctly"); 79 ok(src-> weight == NULL, "pmSourceAlloc() pmSource->weightcorrectly");79 ok(src->variance == NULL, "pmSourceAlloc() pmSource->variance correctly"); 80 80 ok(src->maskObj == NULL, "pmSourceAlloc() pmSource->maskObj correctly"); 81 81 ok(src->maskView == NULL, "pmSourceAlloc() pmSource->maskView correctly"); … … 169 169 170 170 src->pixels = psImageAlloc(2, 4, PS_TYPE_F32); 171 src-> weight= psImageAlloc(6, 8, PS_TYPE_F32);171 src->variance = psImageAlloc(6, 8, PS_TYPE_F32); 172 172 src->maskView = psImageAlloc(10, 12, PS_TYPE_U8); 173 173 pmSource *dst = pmSourceCopy(src); … … 207 207 ok(dst->pixels->numCols == src->pixels->numCols && dst->pixels->numRows == src->pixels->numRows, 208 208 "pmSourceCopy() generated correct size pmSource->pixels"); 209 ok(dst-> weight != NULL, "pmSourceCopy() allocated a new pmSource->weight");210 ok(dst-> weight->numCols == src->weight->numCols && dst->weight->numRows == src->weight->numRows,211 "pmSourceCopy() generated correct size pmSource-> weight");209 ok(dst->variance != NULL, "pmSourceCopy() allocated a new pmSource->variance"); 210 ok(dst->variance->numCols == src->variance->numCols && dst->variance->numRows == src->variance->numRows, 211 "pmSourceCopy() generated correct size pmSource->variance"); 212 212 ok(dst->maskView != NULL, "pmSourceCopy() allocated a new pmSource->maskView"); 213 213 ok(dst->maskView->numCols == src->maskView->numCols && dst->maskView->numRows == src->maskView->numRows, … … 290 290 int expectedNumCols = 1 + (TEST_NUM_COLS/2); 291 291 int expectedNumRows = 1 + (TEST_NUM_COLS/2); 292 // XX: We only verify the size of the pixels, weight, maskView, and maskObj292 // XX: We only verify the size of the pixels, variance, maskView, and maskObj 293 293 // images. A better test would verify that the actual data is set correctly. 294 294 // We don't do that here since it basically duplicated psLib function tests. 295 295 ok(src->pixels->numCols == expectedNumCols && src->pixels->numRows == expectedNumRows, 296 296 "pmSourceDefinePixels() set the size of pmSource->pixels correctly"); 297 ok(src-> weight->numCols == expectedNumCols && src->weight->numRows == expectedNumRows,298 "pmSourceDefinePixels() set the size of pmSource-> weightcorrectly");297 ok(src->variance->numCols == expectedNumCols && src->variance->numRows == expectedNumRows, 298 "pmSourceDefinePixels() set the size of pmSource->variance correctly"); 299 299 ok(src->maskView->numCols == expectedNumCols && src->maskView->numRows == expectedNumRows, 300 300 "pmSourceDefinePixels() set the size of pmSource->maskView correctly"); … … 396 396 int expectedNumCols = 1 + (TEST_NUM_COLS/2); 397 397 int expectedNumRows = 1 + (TEST_NUM_COLS/2); 398 // XX: We only verify the size of the pixels, weight, maskView, and maskObj398 // XX: We only verify the size of the pixels, variance, maskView, and maskObj 399 399 // images. A better test would verify that the actual data is set correctly. 400 400 // We don't do that here since it basically duplicated psLib function tests. 401 401 ok(src->pixels->numCols == expectedNumCols && src->pixels->numRows == expectedNumRows, 402 402 "pmSourceRedefinePixels() set the size of pmSource->pixels correctly"); 403 ok(src-> weight->numCols == expectedNumCols && src->weight->numRows == expectedNumRows,404 "pmSourceRedefinePixels() set the size of pmSource-> weightcorrectly");403 ok(src->variance->numCols == expectedNumCols && src->variance->numRows == expectedNumRows, 404 "pmSourceRedefinePixels() set the size of pmSource->variance correctly"); 405 405 ok(src->maskView->numCols == expectedNumCols && src->maskView->numRows == expectedNumRows, 406 406 "pmSourceRedefinePixels() set the size of pmSource->maskView correctly"); … … 584 584 // We only test with a single Gaussian model, with no residuals or masks. 585 585 // For completeness, additional tests should be added. 586 // We should also set mode &= PM_MODEL_OP_NOISE to test that the src-> weights are added.586 // We should also set mode &= PM_MODEL_OP_NOISE to test that the src->variances are added. 587 587 { 588 588 psMemId id = psMemGetId(); … … 632 632 // call pmSourceOp() with acceptable parameters 633 633 // Test source->modelFlux 634 // We should also set mode &= PM_MODEL_OP_NOISE to test that the src-> weights are added.634 // We should also set mode &= PM_MODEL_OP_NOISE to test that the src->variances are added. 635 635 { 636 636 psMemId id = psMemGetId(); -
trunk/psModules/test/objects/tap_pmSourceExtendedPars.c
r15985 r21471 46 46 ok(tmp->radius == NULL, "pmSourceRadialProfileAlloc() set the ->radius member to NULL"); 47 47 ok(tmp->flux == NULL, "pmSourceRadialProfileAlloc() set the ->flux member to NULL"); 48 ok(tmp-> weight == NULL, "pmSourceRadialProfileAlloc() set the ->weightmember to NULL");48 ok(tmp->variance == NULL, "pmSourceRadialProfileAlloc() set the ->variance member to NULL"); 49 49 50 50 psFree(tmp); -
trunk/psModules/test/objects/tap_pmSourceFitSet.c
r15985 r21471 30 30 if (1) { 31 31 src->pixels = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 32 src-> weight= psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);32 src->variance = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 33 33 src->maskObj = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_U8); 34 34 if (1) { … … 36 36 for (int j = 0 ; j < TEST_NUM_COLS ; j++) { 37 37 src->pixels->data.F32[i][j] = 0.0; 38 src-> weight->data.F32[i][j] = 1.0;38 src->variance->data.F32[i][j] = 1.0; 39 39 src->maskObj->data.U8[i][j] = 0; 40 40 } … … 663 663 664 664 665 // Call pmSourceFitSet() with NULL psSource pixels, weight, maskObj input parameters665 // Call pmSourceFitSet() with NULL psSource pixels, variance, maskObj input parameters 666 666 { 667 667 psMemId id = psMemGetId(); … … 677 677 src->pixels = tmpImg; 678 678 679 tmpImg = src-> weight;680 src-> weight= NULL;679 tmpImg = src->variance; 680 src->variance = NULL; 681 681 rc = pmSourceFitSet(src, modelSet, PM_SOURCE_FIT_PSF, 1); 682 ok(rc == false, "pmSourceFitSet() returned FALSE with NULL src-> weightinput parameter");683 src-> weight= tmpImg;682 ok(rc == false, "pmSourceFitSet() returned FALSE with NULL src->variance input parameter"); 683 src->variance = tmpImg; 684 684 685 685 tmpImg = src->maskObj; -
trunk/psModules/test/objects/tap_pmSourceSky.c
r15985 r21471 153 153 psMemId id = psMemGetId(); 154 154 pmSource *src = pmSourceAlloc(); 155 src-> weight= psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);156 for (int i =0 ; i < src-> weight->numRows ; i++) {157 for (int j = 0 ; j < src-> weight->numCols ; j++) {158 src-> weight->data.F32[i][j] = (float) (i + j);155 src->variance = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 156 for (int i =0 ; i < src->variance->numRows ; i++) { 157 for (int j = 0 ; j < src->variance->numCols ; j++) { 158 src->variance->data.F32[i][j] = (float) (i + j); 159 159 } 160 160 } … … 168 168 169 169 170 // Call pmSourceLocalSkyVariance() with NULL pmSource-> weightinput parameter170 // Call pmSourceLocalSkyVariance() with NULL pmSource->variance input parameter 171 171 { 172 172 psMemId id = psMemGetId(); … … 175 175 src->peak = pmPeakAlloc(1, 2, 3.0, PM_PEAK_LONE); 176 176 bool rc = pmSourceLocalSkyVariance(src, PS_STAT_SAMPLE_MEAN, 10.0, 1, 2); 177 ok(rc == false, "pmSourceLocalSkyVariance() returned FALSE with NULL pmSource-> weightinput parameter");177 ok(rc == false, "pmSourceLocalSkyVariance() returned FALSE with NULL pmSource->variance input parameter"); 178 178 psFree(src); 179 179 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 185 185 psMemId id = psMemGetId(); 186 186 pmSource *src = pmSourceAlloc(); 187 src-> weight= psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);188 for (int i =0 ; i < src-> weight->numRows ; i++) {189 for (int j = 0 ; j < src-> weight->numCols ; j++) {190 src-> weight->data.F32[i][j] = (float) (i + j);187 src->variance = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 188 for (int i =0 ; i < src->variance->numRows ; i++) { 189 for (int j = 0 ; j < src->variance->numCols ; j++) { 190 src->variance->data.F32[i][j] = (float) (i + j); 191 191 } 192 192 } … … 203 203 psMemId id = psMemGetId(); 204 204 pmSource *src = pmSourceAlloc(); 205 src-> weight= psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);206 for (int i =0 ; i < src-> weight->numRows ; i++) {207 for (int j = 0 ; j < src-> weight->numCols ; j++) {208 src-> weight->data.F32[i][j] = (float) (i + j);205 src->variance = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 206 for (int i =0 ; i < src->variance->numRows ; i++) { 207 for (int j = 0 ; j < src->variance->numCols ; j++) { 208 src->variance->data.F32[i][j] = (float) (i + j); 209 209 } 210 210 } … … 221 221 psMemId id = psMemGetId(); 222 222 pmSource *src = pmSourceAlloc(); 223 src-> weight= psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);224 for (int i =0 ; i < src-> weight->numRows ; i++) {225 for (int j = 0 ; j < src-> weight->numCols ; j++) {226 src-> weight->data.F32[i][j] = (float) (i + j);223 src->variance = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 224 for (int i =0 ; i < src->variance->numRows ; i++) { 225 for (int j = 0 ; j < src->variance->numCols ; j++) { 226 src->variance->data.F32[i][j] = (float) (i + j); 227 227 } 228 228 } … … 245 245 psMemId id = psMemGetId(); 246 246 pmSource *src = pmSourceAlloc(); 247 src-> weight= psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);247 src->variance = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 248 248 src->maskObj = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_MASK); 249 249 psF32 mean = 0.0; 250 for (int i = 0 ; i < src-> weight->numRows ; i++) {251 for (int j = 0 ; j < src-> weight->numCols ; j++) {252 src-> weight->data.F32[i][j] = (float) (i + j);250 for (int i = 0 ; i < src->variance->numRows ; i++) { 251 for (int j = 0 ; j < src->variance->numCols ; j++) { 252 src->variance->data.F32[i][j] = (float) (i + j); 253 253 mean+= (float) (i + j); 254 254 src->maskObj->data.U8[i][j] = 0; -
trunk/psModules/test/objects/tap_pmSourceUtils.c
r21223 r21471 39 39 readout->image = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 40 40 readout->mask = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_U8); 41 readout-> weight= psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);41 readout->variance = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 42 42 for (psS32 i = 0 ; i < NUM_BIAS_DATA ; i++) { 43 43 psImage *tmpImage = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); … … 77 77 cell->hdu->images = psArrayAlloc(NUM_HDUS); 78 78 cell->hdu->masks = psArrayAlloc(NUM_HDUS); 79 cell->hdu-> weights = psArrayAlloc(NUM_HDUS);79 cell->hdu->variances = psArrayAlloc(NUM_HDUS); 80 80 for (int k = 0 ; k < NUM_HDUS ; k++) { 81 81 cell->hdu->images->data[k] = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 82 82 cell->hdu->masks->data[k] = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_MASK); 83 cell->hdu-> weights->data[k] = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32);83 cell->hdu->variances->data[k] = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 84 84 psImageInit(cell->hdu->images->data[k], (float) (BASE_IMAGE+k)); 85 85 psImageInit(cell->hdu->masks->data[k], (psU8) (BASE_MASK+k)); 86 psImageInit(cell->hdu-> weights->data[k], (float) (BASE_WEIGHT+k));86 psImageInit(cell->hdu->variances->data[k], (float) (BASE_WEIGHT+k)); 87 87 } 88 88
Note:
See TracChangeset
for help on using the changeset viewer.
