nucleon_elastic_ff.data.arraymanip¶
Routines for array manipulations
Routines are mostly an interface for numpy or cupy.
-
nucleon_elastic_ff.data.arraymanip.
average_arrays
(arrays: List[numpy.ndarray], axis: int = 0) → numpy.ndarray[source]¶ Averages arrays over specified dimension. Input can be a list.
- arrays: List[np.ndarray]
- The arrays to average.
- axis: int = 0
- The average dimension index.
-
nucleon_elastic_ff.data.arraymanip.
get_fft
(array: numpy.ndarray, axes: Tuple[int] = (1, 2, 3), cuda: bool = False) → numpy.ndarray[source]¶ Execute fft for input array over specified axes.
For input $f(t, n_i)$, the transformation is defined by $$ f(t, k_i) = \left( \prod_{i=1}^3 \sum_{n_i=0}^{N_i} \exp \left\{ - \frac{2 \pi i}{N_i} n_i k_i \right \} \right) f(t, n_i) $$
- Arguments
- mean: np.ndarray
- The source averaged input data of shape [NT, NZ, NY, NX]
- axes: Tuple[int] = (1, 2, 3)
- The axes on which the fft is executed.
- cuda: bool = False
- Use cupy to do fft transformation.
-
nucleon_elastic_ff.data.arraymanip.
shift_array
(array: numpy.ndarray, shift: int = 0, axis: int = 0) → numpy.ndarray[source]¶ Rolls the array in specified dimension by shift: v[n] -> v[n+shift]
- array: List[np.ndarray]
- The arrays to average.
- shift: int
- The amount to shift.
- axis: int = 0
- The shift dimension index.