tools¶
Overview¶
The tools module contains general-purpose utility functions used throughout OOPAO — file I/O, array manipulation, photon statistics, and error handling.
Selected API reference¶
- OOPAO.tools.tools.createFolder(path)[source]¶
Create a directory (and all parent directories) if it does not exist.
- Parameters:
path (str) – Directory path.
- OOPAO.tools.tools.read_fits(filename)[source]¶
Read a FITS file and return the data array.
- Parameters:
filename (str) – Path to the FITS file.
- Returns:
Data array.
- Return type:
- OOPAO.tools.tools.crop(imageArray, size, axis, maximum=0)[source]¶
Extract a centred sub-image from a 2-D or 3-D array.
- Parameters:
imageArray (numpy.ndarray) – Input array.
size (int) – Output size in pixels.
axis (int) – Axis along which to crop (for 3-D arrays).
maximum (int) – If
1, centre on the array maximum instead of the geometric centre. Default0.
- OOPAO.tools.tools.bin_ndarray(ndarray, new_shape, operation='sum')[source]¶
Bin a 2-D or 3-D NumPy array to a new shape by summing or averaging.
- Parameters:
ndarray (numpy.ndarray) – Input array.
new_shape (tuple) – Target shape after binning.
operation (str) –
'sum'(default) or'mean'.
- OOPAO.tools.tools.set_binning(frame, binning)[source]¶
Apply integer pixel binning to a 2-D frame.
- Parameters:
frame (numpy.ndarray) – Input 2-D array.
binning (int) – Binning factor.
- Returns:
Binned array.
- Return type: