Changeset 1864
- Timestamp:
- Sep 23, 2004, 8:31:49 AM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 12 edited
-
astro/psTime.c (modified) (2 diffs)
-
astronomy/psTime.c (modified) (2 diffs)
-
dataManip/psDataManipErrors.dat (modified) (1 diff)
-
dataManip/psDataManipErrors.h (modified) (2 diffs)
-
dataManip/psVectorFFT.c (modified) (13 diffs)
-
fft/psImageFFT.c (modified) (4 diffs)
-
fft/psVectorFFT.c (modified) (13 diffs)
-
image/psImageErrors.dat (modified) (2 diffs)
-
image/psImageErrors.h (modified) (3 diffs)
-
image/psImageExtraction.c (modified) (3 diffs)
-
image/psImageExtraction.h (modified) (3 diffs)
-
image/psImageFFT.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psTime.c
r1795 r1864 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-09- 11 02:36:39 $13 * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-09-23 18:31:49 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 #include "psImage.h" 29 29 30 #include "psAstronomyErrors.h" 30 31 31 32 /** Sidereal angular conversion from seconds to radians for GMST in seconds (i.e. pi/(180*240)) */ -
trunk/psLib/src/astronomy/psTime.c
r1795 r1864 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-09- 11 02:36:39 $13 * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-09-23 18:31:49 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 #include "psImage.h" 29 29 30 #include "psAstronomyErrors.h" 30 31 31 32 /** Sidereal angular conversion from seconds to radians for GMST in seconds (i.e. pi/(180*240)) */ -
trunk/psLib/src/dataManip/psDataManipErrors.dat
r1787 r1864 7 7 # N.B. in code, the ERRORNAME appears as PS_ERRORTEXT_ERRORNAME 8 8 #################################################################### 9 # 10 psVectorFFT_IMAGE_TYPE_UNSUPPORTED Input psVector type, %s, is not supported. Valid data types are psF32 and psC32. 11 psVectorFFT_REVERSE_NOT_COMPLEX Input psVector (%s) is not complex. Reverse FFT operation requires a complex input. 12 psVectorFFT_FORWARD_NOT_REAL Input psVector (%s) is not real. Forward FFT operation requires a real input. 13 psVectorFFT_FFTW_PLAN_NULL Could not create a valid FFT plan to perform the transform. 14 psVectorFFT_TYPE_UNSUPPORTED Specified psVector type, %s, is not supported. 15 psVectorFFT_REAL_IMAG_TYPE_MISMATCH Real psVector type, %s, and imaginary psVector type, %s, must be the same. 16 psVectorFFT_REAL_IMAG_SIZE_MISMATCH Real psVector size, %d, and imaginary psVector size, %d, must be the same. 17 psVectorFFT_NONREAL_NOTSUPPORTED Input psVector type, %s, is required to be either psF32 or psF64. 18 psVectorFFT_NONCOMPLEX_NOTSUPPORTED Input psVector type, %s, is required to be either psC32 or psC64. 19 -
trunk/psLib/src/dataManip/psDataManipErrors.h
r1787 r1864 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-09- 11 00:43:54$9 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-09-23 18:31:49 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 30 30 31 31 //~Start #define PS_ERRORTEXT_$1 "$2" 32 #define PS_ERRORTEXT_psVectorFFT_IMAGE_TYPE_UNSUPPORTED "Input psVector type, %s, is not supported. Valid data types are psF32 and psC32." 33 #define PS_ERRORTEXT_psVectorFFT_REVERSE_NOT_COMPLEX "Input psVector (%s) is not complex. Reverse FFT operation requires a complex input." 34 #define PS_ERRORTEXT_psVectorFFT_FORWARD_NOT_REAL "Input psVector (%s) is not real. Forward FFT operation requires a real input." 35 #define PS_ERRORTEXT_psVectorFFT_FFTW_PLAN_NULL "Could not create a valid FFT plan to perform the transform." 36 #define PS_ERRORTEXT_psVectorFFT_TYPE_UNSUPPORTED "Specified psVector type, %s, is not supported." 37 #define PS_ERRORTEXT_psVectorFFT_REAL_IMAG_TYPE_MISMATCH "Real psVector type, %s, and imaginary psVector type, %s, must be the same." 38 #define PS_ERRORTEXT_psVectorFFT_REAL_IMAG_SIZE_MISMATCH "Real psVector size, %d, and imaginary psVector size, %d, must be the same." 39 #define PS_ERRORTEXT_psVectorFFT_NONREAL_NOTSUPPORTED "Input psVector type, %s, is required to be either psF32 or psF64." 40 #define PS_ERRORTEXT_psVectorFFT_NONCOMPLEX_NOTSUPPORTED "Input psVector type, %s, is required to be either psC32 or psC64." 32 41 //~End 33 42 -
trunk/psLib/src/dataManip/psVectorFFT.c
r1625 r1864 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-0 8-25 21:10:08$7 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-09-23 18:31:49 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 23 23 #include "psImageExtraction.h" 24 24 25 #include "psDataManipErrors.h" 26 25 27 #define P_FFTW_PLAN_RIGOR FFTW_ESTIMATE 26 28 … … 42 44 43 45 if ((type != PS_TYPE_F32) && (type != PS_TYPE_C32)) { 44 psError(__func__, "Input image must be a 32-bit float or complex image (type=%d)", type); 46 char* typeStr; 47 PS_TYPE_NAME(typeStr,type); 48 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorFFT", 49 PS_ERR_BAD_PARAMETER_TYPE, true, 50 PS_ERRORTEXT_psVectorFFT_IMAGE_TYPE_UNSUPPORTED, 51 typeStr); 45 52 psFree(out); 46 53 return NULL; … … 48 55 49 56 if ((type != PS_TYPE_C32) && (direction == PS_FFT_REVERSE)) { 50 psError(__func__, "Input image must be complex image for reverse FFT (type=%d).", type); 57 char* typeStr; 58 PS_TYPE_NAME(typeStr,type); 59 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorFFT", 60 PS_ERR_BAD_PARAMETER_TYPE, true, 61 PS_ERRORTEXT_psVectorFFT_REVERSE_NOT_COMPLEX, 62 typeStr); 51 63 psFree(out); 52 64 return NULL; … … 55 67 56 68 if ((type != PS_TYPE_F32) && (direction == PS_FFT_FORWARD)) { 57 psError(__func__, "Input image must be real image for forward FFT (type=%d).", type); 69 char* typeStr; 70 PS_TYPE_NAME(typeStr,type); 71 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorFFT", 72 PS_ERR_BAD_PARAMETER_TYPE, true, 73 PS_ERRORTEXT_psVectorFFT_FORWARD_NOT_REAL, 74 typeStr); 58 75 psFree(out); 59 76 return NULL; … … 94 111 /* check if a plan exists now */ 95 112 if (plan == NULL) { 96 psError(__func__, "Failed to create FFTW plan."); 113 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorFFT", 114 PS_ERR_BAD_PARAMETER_TYPE, true, 115 PS_ERRORTEXT_psVectorFFT_FFTW_PLAN_NULL); 97 116 psFree(out); 98 117 return NULL; … … 142 161 outVec[i] = crealf(inVec[i]); 143 162 } 144 } else { 145 psError(__func__, "Can not extract real component from given vector type (%d).", type); 163 } else if (type == PS_TYPE_C64) { 164 psF64* outVec; 165 psC64* inVec = in->data.C64; 166 167 out = psVectorRecycle(out, numElements, PS_TYPE_F64); 168 out->n = numElements; 169 outVec = out->data.F64; 170 171 for (unsigned int i = 0; i < numElements; i++) { 172 outVec[i] = creal(inVec[i]); 173 } 174 } else { 175 char* typeStr; 176 PS_TYPE_NAME(typeStr,type); 177 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorReal", 178 PS_ERR_BAD_PARAMETER_TYPE, true, 179 PS_ERRORTEXT_psVectorFFT_TYPE_UNSUPPORTED, 180 typeStr); 146 181 psFree(out); 147 182 return NULL; … … 186 221 outVec[i] = cimagf(inVec[i]); 187 222 } 188 } else { 189 psError(__func__, "Can not extract imaginary component from given vector type (%d).", type); 223 } else if (type == PS_TYPE_C64) { 224 psF64* outVec; 225 psC64* inVec = in->data.C64; 226 227 out = psVectorRecycle(out, numElements, PS_TYPE_F64); 228 out->n = numElements; 229 outVec = out->data.F64; 230 231 for (unsigned int i = 0; i < numElements; i++) { 232 outVec[i] = cimag(inVec[i]); 233 } 234 } else { 235 char* typeStr; 236 PS_TYPE_NAME(typeStr,type); 237 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorImaginary", 238 PS_ERR_BAD_PARAMETER_TYPE, true, 239 PS_ERRORTEXT_psVectorFFT_TYPE_UNSUPPORTED, 240 typeStr); 190 241 psFree(out); 191 242 return NULL; … … 213 264 214 265 if (imag->type.type != type) { 215 psError(__func__, "The inputs to psVectorComplex must be the same type."); 216 psFree(out); 217 return NULL; 218 } 219 220 if (PS_IS_PSELEMTYPE_COMPLEX(type)) { 221 psError(__func__, "The inputs to psVectorComplex can not be complex."); 266 char* typeStrReal; 267 char* typeStrImag; 268 PS_TYPE_NAME(typeStrReal,type); 269 PS_TYPE_NAME(typeStrImag,imag->type.type); 270 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorComplex", 271 PS_ERR_BAD_PARAMETER_TYPE, true, 272 PS_ERRORTEXT_psVectorFFT_REAL_IMAG_TYPE_MISMATCH, 273 typeStrReal,typeStrImag); 222 274 psFree(out); 223 275 return NULL; … … 236 288 outVec[i] = realVec[i] + I * imagVec[i]; 237 289 } 238 } else { 239 psError(__func__, "Can not merge real and imaginary portions for given vector type (%d).", type); 290 } else if (type == PS_TYPE_F64) { 291 psC64* outVec; 292 psF64* realVec = real->data.F64; 293 psF64* imagVec = imag->data.F64; 294 295 out = psVectorRecycle(out, numElements, PS_TYPE_C64); 296 out->n = numElements; 297 outVec = out->data.C64; 298 299 for (unsigned int i = 0; i < numElements; i++) { 300 outVec[i] = realVec[i] + I * imagVec[i]; 301 } 302 } else { 303 char* typeStr; 304 PS_TYPE_NAME(typeStr,type); 305 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorComplex", 306 PS_ERR_BAD_PARAMETER_TYPE, true, 307 PS_ERRORTEXT_psVectorFFT_NONREAL_NOTSUPPORTED, 308 typeStr); 240 309 psFree(out); 241 310 return NULL; … … 281 350 outVec[i] = crealf(inVec[i]) - I * cimagf(inVec[i]); 282 351 } 283 } else { 284 psError(__func__, "Can not compute complex conjugate for given vector type (%d).", type); 352 } else if (type == PS_TYPE_C64) { 353 psC64* outVec; 354 psC64* inVec = in->data.C64; 355 356 out = psVectorRecycle(out, numElements, PS_TYPE_C64); 357 out->n = numElements; 358 outVec = out->data.C64; 359 360 for (unsigned int i = 0; i < numElements; i++) { 361 outVec[i] = creal(inVec[i]) - I * cimag(inVec[i]); 362 } 363 } else { 364 char* typeStr; 365 PS_TYPE_NAME(typeStr,type); 366 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorConjugate", 367 PS_ERR_BAD_PARAMETER_TYPE, true, 368 PS_ERRORTEXT_psVectorFFT_NONCOMPLEX_NOTSUPPORTED, 369 typeStr); 285 370 psFree(out); 286 371 return NULL; … … 309 394 outNumElements = inHalfNumElements + 1; 310 395 311 /* if not a complex number, this is not implemented */312 if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {313 psError(__func__, "Power Spectrum for non-complex inputs is not implemented.");314 psFree(out);315 return NULL;316 }317 318 396 if (type == PS_TYPE_C32) { 319 397 psF32* outVec; … … 340 418 inAbs1 = cabsf(inVec[inHalfNumElements]); 341 419 outVec[inHalfNumElements] = inAbs1 * inAbs1 / inNumElementsSquared; 342 } else { 343 psError(__func__, "Can not power spectrum for given vector type (%d).", type); 344 psFree(out); 345 return NULL; 346 } 347 348 return out; 349 350 } 420 } else if (type == PS_TYPE_C64) { 421 psF64* outVec; 422 psC64* inVec = in->data.C64; 423 psF64 inAbs1; 424 psF64 inAbs2; 425 426 out = psVectorRecycle(out, outNumElements, PS_TYPE_F64); 427 out->n = outNumElements; 428 outVec = out->data.F64; 429 430 // from ADD: P_0 = |C_0|^2/N^2 431 inAbs1 = cabs(inVec[0]); 432 outVec[0] = inAbs1 * inAbs1 / inNumElementsSquared; 433 434 // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1) 435 for (unsigned int i = 1; i < inHalfNumElements; i++) { 436 inAbs1 = cabs(inVec[i]); 437 inAbs2 = cabs(inVec[inNumElements - i]); 438 outVec[i] = (inAbs1 * inAbs1 + inAbs2 * inAbs2) / inNumElementsSquared; 439 } 440 441 // from ADD: P_N/2 = |C_N/2|^2/N^2 442 inAbs1 = cabs(inVec[inHalfNumElements]); 443 outVec[inHalfNumElements] = inAbs1 * inAbs1 / inNumElementsSquared; 444 } else { 445 char* typeStr; 446 PS_TYPE_NAME(typeStr,type); 447 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorPowerSpectrum", 448 PS_ERR_BAD_PARAMETER_TYPE, true, 449 PS_ERRORTEXT_psVectorFFT_NONCOMPLEX_NOTSUPPORTED, 450 typeStr); 451 psFree(out); 452 return NULL; 453 } 454 455 return out; 456 457 } -
trunk/psLib/src/fft/psImageFFT.c
r1840 r1864 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-09-2 1 22:30:19 $7 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-09-23 18:31:49 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 24 24 #include "psImageErrors.h" 25 25 26 #define P _FFTW_PLAN_RIGOR FFTW_ESTIMATE26 #define PS_FFTW_PLAN_RIGOR FFTW_ESTIMATE 27 27 28 28 static bool p_fftwWisdomImported = false; … … 90 90 plan = fftwf_plan_dft_2d(numCols, numRows, 91 91 (fftwf_complex *) out->data.C32[0], 92 (fftwf_complex *) out->data.C32[0], direction, P _FFTW_PLAN_RIGOR);92 (fftwf_complex *) out->data.C32[0], direction, PS_FFTW_PLAN_RIGOR); 93 93 94 94 /* check if a plan exists now -- if not, it is a real problem */ … … 422 422 423 423 for (unsigned int col = 0; col < numCols; col++) { 424 real = creal f(inRow[col]);425 imag = cimag f(inRow[col]);424 real = creal(inRow[col]); 425 imag = cimag(inRow[col]); 426 426 outRow[col] = real * real + imag * imag / numElementsSquared; 427 427 } -
trunk/psLib/src/fft/psVectorFFT.c
r1625 r1864 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-0 8-25 21:10:08$7 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-09-23 18:31:49 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 23 23 #include "psImageExtraction.h" 24 24 25 #include "psDataManipErrors.h" 26 25 27 #define P_FFTW_PLAN_RIGOR FFTW_ESTIMATE 26 28 … … 42 44 43 45 if ((type != PS_TYPE_F32) && (type != PS_TYPE_C32)) { 44 psError(__func__, "Input image must be a 32-bit float or complex image (type=%d)", type); 46 char* typeStr; 47 PS_TYPE_NAME(typeStr,type); 48 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorFFT", 49 PS_ERR_BAD_PARAMETER_TYPE, true, 50 PS_ERRORTEXT_psVectorFFT_IMAGE_TYPE_UNSUPPORTED, 51 typeStr); 45 52 psFree(out); 46 53 return NULL; … … 48 55 49 56 if ((type != PS_TYPE_C32) && (direction == PS_FFT_REVERSE)) { 50 psError(__func__, "Input image must be complex image for reverse FFT (type=%d).", type); 57 char* typeStr; 58 PS_TYPE_NAME(typeStr,type); 59 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorFFT", 60 PS_ERR_BAD_PARAMETER_TYPE, true, 61 PS_ERRORTEXT_psVectorFFT_REVERSE_NOT_COMPLEX, 62 typeStr); 51 63 psFree(out); 52 64 return NULL; … … 55 67 56 68 if ((type != PS_TYPE_F32) && (direction == PS_FFT_FORWARD)) { 57 psError(__func__, "Input image must be real image for forward FFT (type=%d).", type); 69 char* typeStr; 70 PS_TYPE_NAME(typeStr,type); 71 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorFFT", 72 PS_ERR_BAD_PARAMETER_TYPE, true, 73 PS_ERRORTEXT_psVectorFFT_FORWARD_NOT_REAL, 74 typeStr); 58 75 psFree(out); 59 76 return NULL; … … 94 111 /* check if a plan exists now */ 95 112 if (plan == NULL) { 96 psError(__func__, "Failed to create FFTW plan."); 113 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorFFT", 114 PS_ERR_BAD_PARAMETER_TYPE, true, 115 PS_ERRORTEXT_psVectorFFT_FFTW_PLAN_NULL); 97 116 psFree(out); 98 117 return NULL; … … 142 161 outVec[i] = crealf(inVec[i]); 143 162 } 144 } else { 145 psError(__func__, "Can not extract real component from given vector type (%d).", type); 163 } else if (type == PS_TYPE_C64) { 164 psF64* outVec; 165 psC64* inVec = in->data.C64; 166 167 out = psVectorRecycle(out, numElements, PS_TYPE_F64); 168 out->n = numElements; 169 outVec = out->data.F64; 170 171 for (unsigned int i = 0; i < numElements; i++) { 172 outVec[i] = creal(inVec[i]); 173 } 174 } else { 175 char* typeStr; 176 PS_TYPE_NAME(typeStr,type); 177 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorReal", 178 PS_ERR_BAD_PARAMETER_TYPE, true, 179 PS_ERRORTEXT_psVectorFFT_TYPE_UNSUPPORTED, 180 typeStr); 146 181 psFree(out); 147 182 return NULL; … … 186 221 outVec[i] = cimagf(inVec[i]); 187 222 } 188 } else { 189 psError(__func__, "Can not extract imaginary component from given vector type (%d).", type); 223 } else if (type == PS_TYPE_C64) { 224 psF64* outVec; 225 psC64* inVec = in->data.C64; 226 227 out = psVectorRecycle(out, numElements, PS_TYPE_F64); 228 out->n = numElements; 229 outVec = out->data.F64; 230 231 for (unsigned int i = 0; i < numElements; i++) { 232 outVec[i] = cimag(inVec[i]); 233 } 234 } else { 235 char* typeStr; 236 PS_TYPE_NAME(typeStr,type); 237 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorImaginary", 238 PS_ERR_BAD_PARAMETER_TYPE, true, 239 PS_ERRORTEXT_psVectorFFT_TYPE_UNSUPPORTED, 240 typeStr); 190 241 psFree(out); 191 242 return NULL; … … 213 264 214 265 if (imag->type.type != type) { 215 psError(__func__, "The inputs to psVectorComplex must be the same type."); 216 psFree(out); 217 return NULL; 218 } 219 220 if (PS_IS_PSELEMTYPE_COMPLEX(type)) { 221 psError(__func__, "The inputs to psVectorComplex can not be complex."); 266 char* typeStrReal; 267 char* typeStrImag; 268 PS_TYPE_NAME(typeStrReal,type); 269 PS_TYPE_NAME(typeStrImag,imag->type.type); 270 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorComplex", 271 PS_ERR_BAD_PARAMETER_TYPE, true, 272 PS_ERRORTEXT_psVectorFFT_REAL_IMAG_TYPE_MISMATCH, 273 typeStrReal,typeStrImag); 222 274 psFree(out); 223 275 return NULL; … … 236 288 outVec[i] = realVec[i] + I * imagVec[i]; 237 289 } 238 } else { 239 psError(__func__, "Can not merge real and imaginary portions for given vector type (%d).", type); 290 } else if (type == PS_TYPE_F64) { 291 psC64* outVec; 292 psF64* realVec = real->data.F64; 293 psF64* imagVec = imag->data.F64; 294 295 out = psVectorRecycle(out, numElements, PS_TYPE_C64); 296 out->n = numElements; 297 outVec = out->data.C64; 298 299 for (unsigned int i = 0; i < numElements; i++) { 300 outVec[i] = realVec[i] + I * imagVec[i]; 301 } 302 } else { 303 char* typeStr; 304 PS_TYPE_NAME(typeStr,type); 305 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorComplex", 306 PS_ERR_BAD_PARAMETER_TYPE, true, 307 PS_ERRORTEXT_psVectorFFT_NONREAL_NOTSUPPORTED, 308 typeStr); 240 309 psFree(out); 241 310 return NULL; … … 281 350 outVec[i] = crealf(inVec[i]) - I * cimagf(inVec[i]); 282 351 } 283 } else { 284 psError(__func__, "Can not compute complex conjugate for given vector type (%d).", type); 352 } else if (type == PS_TYPE_C64) { 353 psC64* outVec; 354 psC64* inVec = in->data.C64; 355 356 out = psVectorRecycle(out, numElements, PS_TYPE_C64); 357 out->n = numElements; 358 outVec = out->data.C64; 359 360 for (unsigned int i = 0; i < numElements; i++) { 361 outVec[i] = creal(inVec[i]) - I * cimag(inVec[i]); 362 } 363 } else { 364 char* typeStr; 365 PS_TYPE_NAME(typeStr,type); 366 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorConjugate", 367 PS_ERR_BAD_PARAMETER_TYPE, true, 368 PS_ERRORTEXT_psVectorFFT_NONCOMPLEX_NOTSUPPORTED, 369 typeStr); 285 370 psFree(out); 286 371 return NULL; … … 309 394 outNumElements = inHalfNumElements + 1; 310 395 311 /* if not a complex number, this is not implemented */312 if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {313 psError(__func__, "Power Spectrum for non-complex inputs is not implemented.");314 psFree(out);315 return NULL;316 }317 318 396 if (type == PS_TYPE_C32) { 319 397 psF32* outVec; … … 340 418 inAbs1 = cabsf(inVec[inHalfNumElements]); 341 419 outVec[inHalfNumElements] = inAbs1 * inAbs1 / inNumElementsSquared; 342 } else { 343 psError(__func__, "Can not power spectrum for given vector type (%d).", type); 344 psFree(out); 345 return NULL; 346 } 347 348 return out; 349 350 } 420 } else if (type == PS_TYPE_C64) { 421 psF64* outVec; 422 psC64* inVec = in->data.C64; 423 psF64 inAbs1; 424 psF64 inAbs2; 425 426 out = psVectorRecycle(out, outNumElements, PS_TYPE_F64); 427 out->n = outNumElements; 428 outVec = out->data.F64; 429 430 // from ADD: P_0 = |C_0|^2/N^2 431 inAbs1 = cabs(inVec[0]); 432 outVec[0] = inAbs1 * inAbs1 / inNumElementsSquared; 433 434 // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1) 435 for (unsigned int i = 1; i < inHalfNumElements; i++) { 436 inAbs1 = cabs(inVec[i]); 437 inAbs2 = cabs(inVec[inNumElements - i]); 438 outVec[i] = (inAbs1 * inAbs1 + inAbs2 * inAbs2) / inNumElementsSquared; 439 } 440 441 // from ADD: P_N/2 = |C_N/2|^2/N^2 442 inAbs1 = cabs(inVec[inHalfNumElements]); 443 outVec[inHalfNumElements] = inAbs1 * inAbs1 / inNumElementsSquared; 444 } else { 445 char* typeStr; 446 PS_TYPE_NAME(typeStr,type); 447 psErrorMsg(PS_ERRORNAME_DOMAIN "psVectorPowerSpectrum", 448 PS_ERR_BAD_PARAMETER_TYPE, true, 449 PS_ERRORTEXT_psVectorFFT_NONCOMPLEX_NOTSUPPORTED, 450 typeStr); 451 psFree(out); 452 return NULL; 453 } 454 455 return out; 456 457 } -
trunk/psLib/src/image/psImageErrors.dat
r1840 r1864 11 11 psImage_NOT_AN_IMAGE The input psImage must have a PS_DIMEN_IMAGE dimension type. 12 12 psImage_IMAGE_NULL Can not operate on a NULL psImage. 13 psImage_IMAGE_TYPE_UNSUPPORTED Specified psImage type (%s)is not supported.13 psImage_IMAGE_TYPE_UNSUPPORTED Specified psImage type, %s, is not supported. 14 14 psImage_INTERPOLATE_METHOD_INVALID Specified interpolation method (%d) is not supported. 15 15 psImage_SUBSET_RANGE_INVALID Specified subset range, [%d:%d,%d:%d], lies outside psImage's boundaries, [0:%d,0:%d]. … … 62 62 psImageManip_SCALE_NOT_POSITIVE Specified scale value, %d, must be a positive value. 63 63 psImageManip_INTERPOLATION_MODE_UNSUPPORTED Specified interpolation mode, %d, is unsupported. 64 psImageConvolve_SHIFT_NULL Specified shift vectors can not be NULL. 65 psImageConvolve_SHIFT_TYPE_MISMATCH The X-shift vector type, %s, does not match the Y-shift vector type, %s. Types must match. 64 psImageConvolve_SHIFT_NULL Specified shift vectors can not be NULL. 65 psImageConvolve_KERNEL_NULL Specified psKernel can not be NULL. 66 psImageConvolve_SHIFT_TYPE_MISMATCH Input t-, x-, and y-shift vector types (%s/%s/%s) must match. 67 psImageConvolve_FFT_FAILED Failed to perform a fourier transform of input image. 68 psImageConvolve_KERNEL_FFT_FAILED Failed to perform a fourier transform of kernel. 69 psImageConvolve_KERNEL_TOO_LARGE Specified psKernel size, %dx%d, can not be larger than input psImage size, %dx%d. -
trunk/psLib/src/image/psImageErrors.h
r1840 r1864 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-09-2 1 22:30:19 $9 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-09-23 18:31:49 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 33 33 #define PS_ERRORTEXT_psImage_NOT_AN_IMAGE "The input psImage must have a PS_DIMEN_IMAGE dimension type." 34 34 #define PS_ERRORTEXT_psImage_IMAGE_NULL "Can not operate on a NULL psImage." 35 #define PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED "Specified psImage type (%s)is not supported."35 #define PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED "Specified psImage type, %s, is not supported." 36 36 #define PS_ERRORTEXT_psImage_INTERPOLATE_METHOD_INVALID "Specified interpolation method (%d) is not supported." 37 37 #define PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID "Specified subset range, [%d:%d,%d:%d], lies outside psImage's boundaries, [0:%d,0:%d]." … … 82 82 #define PS_ERRORTEXT_psImageManip_INTERPOLATION_MODE_UNSUPPORTED "Specified interpolation mode, %d, is unsupported." 83 83 #define PS_ERRORTEXT_psImageConvolve_SHIFT_NULL "Specified shift vectors can not be NULL." 84 #define PS_ERRORTEXT_psImageConvolve_SHIFT_TYPE_MISMATCH "The X-shift vector type, %s, does not match the Y-shift vector type, %s. Types must match." 84 #define PS_ERRORTEXT_psImageConvolve_KERNEL_NULL "Specified psKernel can not be NULL." 85 #define PS_ERRORTEXT_psImageConvolve_SHIFT_TYPE_MISMATCH "Input t-, x-, and y-shift vector types (%s/%s/%s) must match." 86 #define PS_ERRORTEXT_psImageConvolve_FFT_FAILED "Failed to perform a fourier transform of input image." 87 #define PS_ERRORTEXT_psImageConvolve_KERNEL_FFT_FAILED "Failed to perform a fourier transform of kernel." 88 #define PS_ERRORTEXT_psImageConvolve_KERNEL_TOO_LARGE "Specified psKernel size, %dx%d, can not be larger than input psImage size, %dx%d. " 85 89 //~End 86 90 -
trunk/psLib/src/image/psImageExtraction.c
r1840 r1864 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-09-2 1 22:30:19 $12 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-09-23 18:31:49 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 100 100 } 101 101 102 psImage* psImageSubsection(psImage* image, const char* section) 102 psImage* psImageSubsection(psImage* image, 103 const char* section) 103 104 { 104 105 int x1; … … 606 607 return out; 607 608 } 609 610 psVector* psImageCut(psVector* out, 611 psVector* coords, 612 const psImage* input, 613 const psImage* restrict mask, 614 unsigned int maskVal, 615 float startCol, 616 float startRow, 617 float endCol, 618 float endRow, 619 float nSamples, 620 psImageInterpolateMode mode) 621 { 622 623 return NULL; 624 } 625 626 psVector* psImageRadialCut(psVector* out, 627 const psImage* input, 628 const psImage* restrict mask, 629 unsigned int maskVal, 630 float centerCol, 631 float centerRow, 632 const psVector* radii, 633 const psStats* stats) 634 { 635 636 return NULL; 637 } -
trunk/psLib/src/image/psImageExtraction.h
r1613 r1864 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-0 8-25 00:04:01$12 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-09-23 18:31:49 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 145 145 psVector* psImageCut( 146 146 psVector* out, ///< psVector to recycle, or NULL. 147 psVector* coords, ///< if not NULL, the calculated coordinates along the slice (output) 147 148 const psImage* input, ///< the input image in which to perform the cut 148 149 const psImage* restrict mask, ///< the mask for the input image. … … 152 153 float endCol, ///< the column of the end of the cut line 153 154 float endRow, ///< the row of the end of the cut line 154 float width, ///< the distance about the line to perform the statistics155 const psStats* stats ///< the statistic to perform in operation155 float nSamples, ///< the number of samples along the cut 156 psImageInterpolateMode mode ///< the interpolation method to use 156 157 ); 157 158 -
trunk/psLib/src/image/psImageFFT.c
r1840 r1864 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-09-2 1 22:30:19 $7 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-09-23 18:31:49 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 24 24 #include "psImageErrors.h" 25 25 26 #define P _FFTW_PLAN_RIGOR FFTW_ESTIMATE26 #define PS_FFTW_PLAN_RIGOR FFTW_ESTIMATE 27 27 28 28 static bool p_fftwWisdomImported = false; … … 90 90 plan = fftwf_plan_dft_2d(numCols, numRows, 91 91 (fftwf_complex *) out->data.C32[0], 92 (fftwf_complex *) out->data.C32[0], direction, P _FFTW_PLAN_RIGOR);92 (fftwf_complex *) out->data.C32[0], direction, PS_FFTW_PLAN_RIGOR); 93 93 94 94 /* check if a plan exists now -- if not, it is a real problem */ … … 422 422 423 423 for (unsigned int col = 0; col < numCols; col++) { 424 real = creal f(inRow[col]);425 imag = cimag f(inRow[col]);424 real = creal(inRow[col]); 425 imag = cimag(inRow[col]); 426 426 outRow[col] = real * real + imag * imag / numElementsSquared; 427 427 }
Note:
See TracChangeset
for help on using the changeset viewer.
