synospec.etc.util module
Collection of utility methods.
Copyright © 2020, Kyle B. Westfall
- synospec.etc.util.boxcar_average(arr, boxcar)[source]
Boxcar average an array.
- Parameters
arr (numpy.ndarray) – Array to average. Currently cannot be masked.
boxcar (
int,tuple) – Integer number of pixels to average. If a single integer, all axes are averaged with the same size box. If atuple, the integer is defined separately for each array axis; length of tuple must match the number of array dimensions.
- Returns
The averaged array. If boxcar is a single integer, the returned array shape is:
tuple([s//boxcar for s in arr.shape])
A similar operation gives the shape when boxcar has elements defined for each array dimension. If the input array is not an integer number of boxcar pixels along a given dimension, the remainder of the array elements along that dimension are ignored (i.e., pixels within the modulus of the array shape and boxcar of the end of the array dimension are ignored).
- Return type
- synospec.etc.util.boxcar_replicate(arr, boxcar)[source]
Boxcar replicate an array.
- Parameters
arr (numpy.ndarray) – Array to replicate.
boxcar (
int,tuple) – Integer number of times to replicate each pixel. If a single integer, all axes are replicated the same number of times. If atuple, the integer is defined separately for each array axis; length of tuple must match the number of array dimensions.
- Returns
The block-replicated array.
- Return type