fiberlab.io module
General input/output methods.
- fiberlab.io.bench_image(ifile, ext=0, compress=True)[source]
Read an image from a bench imaging camera.
- Parameters:
ifile (
str, Path) – File name. Can be None, but, if so, None is returned.ext (
int, optional) – If the file is a multi-extension fits file, this selects the extension with the relevant data.compress (
bool, optional) – If the data include multiple color channels (as indicated by the image data array being 3D), compress into a single 2D image by summing across the last dimension?
- Returns:
Array with the (floating-point) image data. If
ifileis None, this is also None.- Return type:
- fiberlab.io.find_collimated_farfield_files(root)[source]
Find the set of collimated far-field output files according to the expected nomenclature.
- Parameters:
root (
str, Path) – Root directory with files.- Returns:
Full paths to (1) the z0 image, (2) the z1 image, (3) the background image, and (4) the list of a* files.
- Return type:
tuple
- fiberlab.io.find_fullcone_farfield_files(root)[source]
Find a set of fullcone far-field output files according to the expected nomenclature.
- Parameters:
root (
str, Path) – Root directory with files.- Returns:
Full paths to (1) the z0 image, (2) the z1 image, and (3) the background image.
- Return type:
tuple
- fiberlab.io.gather_collimated_file_list(root, par=None, threshold=None)[source]
Gather the list of collimated farfield output files to analyze.
- Parameters:
root (
str, Path) – Root directory with files.par (
str, Path, optional) – Name of a file that provides 2 or 3 columns: (1) the files to analyze, (2) the background image to use for each file, and (3) the threshold to use for each file. If this file is provided, any threshold is ignored and the root directory is not trolled for all bg*, z*, and a* files. The last column with the thresholds can be omitted, which means the code will use the value provided on the command line (or its default).threshold (
float, optional) – Ifparis not provided or it has no 3nd column, this is the threshold to use for all files.
- Returns:
Provides (1) the z0 file, (2) its background file, (3) its threshold, (4) the z1 file, (5) its background file, (6) its threshold, (7) the list of a* files, (8) their background files, and (9) their thresholds.
- Return type:
tuple
- fiberlab.io.gather_fullcone_file_list(root, par=None, threshold=None)[source]
Gather the list of full-cone farfield output files to analyze.
- Parameters:
root (
str, Path) – Root directory with files.par (
str, Path, optional) – Name of a file that provides 2 or 3 columns: (1) the files to analyze, (2) the background image to use for each file, and (3) the threshold to use for each file. If this file is provided, any threshold is ignored and the root directory is not trolled for all bg*, z*, and a* files. The last column with the thresholds can be omitted, which means the code will use the value provided on the command line (or its default).threshold (
float, optional) – Ifparis not provided or it has no 3nd column, this is the threshold to use for all files.
- Returns:
Provides (1) the z0 file, (2) its background file, (3) its threshold, (4) the z1 file, (5) its background file, (6) its threshold, (7) the list of a* files, (8) their background files, and (9) their thresholds.
- Return type:
tuple
- fiberlab.io.parse_file_list(root, par, threshold)[source]
Parse a file with the set of data files to analyze.
- Parameters:
root (
str, Path) – Root directory with files.par (
str, Path) – Name of a file that provides 2 or 3 columns: (1) the files to analyze, (2) the background image to use for each file, and (3) the threshold to use for each file. The last column with the thresholds can be omitted, which means the code will use the value provided on the command line (or its default).threshold (
float, optional) – Ifparhas no 3nd column, this is the threshold to use for all files.
- Returns:
Provides (1) the z0 file, (2) its background file, (3) its threshold, (4) the z1 file, (5) its background file, (6) its threshold, (7) the list of a* files, (8) their background files, and (9) their thresholds.
- Return type:
tuple