Changeset 7828
- Timestamp:
- Jul 5, 2006, 5:29:28 PM (20 years ago)
- Location:
- trunk/psModules/src/detrend
- Files:
-
- 2 edited
-
pmFringeStats.c (modified) (4 diffs)
-
pmFringeStats.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/detrend/pmFringeStats.c
r7604 r7828 3 3 * @author Eugene Magnier, IfA 4 4 * 5 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-0 6-21 03:21:16$5 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-07-06 03:29:28 $ 7 7 * 8 8 * Copyright 2004 IfA … … 14 14 #include "pmFPA.h" 15 15 #include "pmFringeStats.h" 16 17 #define MAX(x,y) ((x) > (y) ? (x) : (y))18 #define MIN(x,y) ((x) < (y) ? (x) : (y))19 16 20 17 … … 191 188 return measurements; 192 189 } 193 194 190 195 191 bool pmFringeStatsWriteFits(psFits *fits, const pmFringeStats *fringe, const char *extname) … … 353 349 354 350 351 pmFringeStats *pmFringeStatsConcatenate(const psArray *fringes, const psVector *x0, const psVector *y0) 352 { 353 PS_ASSERT_PTR_NON_NULL(fringes, NULL); 354 PS_ASSERT_PTR_NON_NULL(fringes->data, NULL); 355 PS_ASSERT_INT_POSITIVE(fringes->n, NULL); 356 if (x0 && y0) { 357 PS_ASSERT_VECTOR_NON_NULL(x0, NULL); 358 PS_ASSERT_VECTOR_NON_NULL(y0, NULL); 359 PS_ASSERT_VECTOR_TYPE(x0, PS_TYPE_S32, NULL); 360 PS_ASSERT_VECTOR_TYPE(y0, PS_TYPE_S32, NULL); 361 PS_ASSERT_VECTORS_SIZE_EQUAL(x0, y0, NULL); 362 PS_ASSERT_VECTOR_SIZE(x0, fringes->n, NULL); 363 PS_ASSERT_VECTOR_SIZE(y0, fringes->n, NULL); 364 } 365 366 // Get the measurement parameters, and check they are consistent 367 int numPoints = 0; // Number of fringe points 368 int dX = 0, dY = 0; // Half-width and -height of fringe boxes 369 int nX = 0, nY = 0; // Smoothing scales 370 for (long i = 0; i < fringes->n; i++) { 371 pmFringeStats *fringe = fringes->data[i]; // The fringe of interest 372 pmFringeRegions *regions = fringe->regions; // The fringe regions 373 if (numPoints == 0) { 374 dX = regions->dX; 375 dY = regions->dY; 376 nX = regions->nX; 377 nY = regions->nY; 378 } else if (regions->dX != dX || regions->dY != dY || regions->nX != nX || regions->nY != nY) { 379 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Fringe %ld has different parameters (%d,%d,%d,%d) " 380 "from the first (%d,%d,%d,%d).\n", i, 381 regions->dX, regions->dY, regions->nX, regions->nY, dX, dY, nX, nY); 382 return NULL; 383 } 384 unsigned int num = regions->nRequested; // Number of fringe points 385 if (regions->x->n != num || regions->y->n != num || regions->mask->n != num || 386 fringe->f->n != num || fringe->df->n != num) { 387 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Length of region (%ld,%ld,%ld) and fringe vectors " 388 "do not match (%ld,%ld) with the official value (%d).\n", regions->x->n, regions->y->n, 389 regions->mask->n, fringe->f->n, fringe->df->n, num); 390 return NULL; 391 } 392 numPoints += regions->nRequested; 393 } 394 395 pmFringeRegions *newRegions = pmFringeRegionsAlloc(numPoints, dX, dY, nX, nY); // The new list of regions 396 pmFringeStats *newStats = pmFringeStatsAlloc(newRegions); // The new list of statistics 397 398 long offset = 0; // Offset from start of the list 399 for (long i = 0; i < fringes->n; i++) { 400 pmFringeStats *fringe = fringes->data[i]; // The fringe of interest 401 pmFringeRegions *regions = fringe->regions; // The fringe regions 402 // Copy the data over 403 memcpy(&newRegions->x->data.F32[offset], regions->x->data.F32, regions->x->n * sizeof(psF32)); 404 memcpy(&newRegions->y->data.F32[offset], regions->y->data.F32, regions->y->n * sizeof(psF32)); 405 memcpy(&newRegions->mask->data.U8[offset], regions->mask->data.U8, regions->mask->n * sizeof(psU8)); 406 memcpy(&newStats->f->data.F32[offset], fringe->f->data.F32, fringe->f->n * sizeof(psF32)); 407 memcpy(&newStats->df->data.F32[offset], fringe->f->data.F32, fringe->df->n * sizeof(psF32)); 408 offset += regions->nRequested; 409 } 410 411 psFree(newRegions); // Drop reference 412 return newStats; 413 } 414 415 355 416 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 356 417 // pmFringeScale -
trunk/psModules/src/detrend/pmFringeStats.h
r7562 r7828 5 5 * @author Eugene Magnier, IfA 6 6 * 7 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $8 * @date $Date: 2006-0 6-14 22:04:40$7 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2006-07-06 03:29:28 $ 9 9 * 10 10 * Copyright 2004 IfA, University of Hawaii … … 93 93 ); 94 94 95 // Concatenate the fringe stats for several readouts into a single fringe stats. The idea is that each 96 // readout of each chip should be measured separately (so as to avoid any gaps, as in the case for GPC), but 97 // then perform the fit to all the readouts belonging to a chip. To do so, we need to concatenate. 98 pmFringeStats *pmFringeStatsConcatenate(const psArray *fringes, // Array of pmFringeStats for the readouts 99 const psVector *x0, // Offset in x for the readout 100 const psVector *y0 // Offset in y for the readout 101 ); 102 95 103 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 96 104 // pmFringeScale
Note:
See TracChangeset
for help on using the changeset viewer.
