lib.file_io module¶
DECONVOLUTION FILE INPUT/OUTPUT
This module defines methods for file input and output for deconvolution_script.py.
Author: | Samuel Farrens <samuel.farrens@gmail.com> |
---|---|
Version: | 1.0 |
Date: | 13/03/2017 |
-
lib.file_io.
check_data_format
(data, n_dim)[source]¶ Check data format
This method checks that the input data has the correct number of dimensions
Parameters: - data (np.ndarray) – Input data array
- n_dim (int or list of ints) – Expected number of dimensions
Raises: ValueError
– For invalid array dimensions
-
lib.file_io.
read_file
(file_name)[source]¶ Read file
This method reads image array data from a file.
Parameters: file_name (str) – Name of file with path Returns: Return type: np.ndarray array of image data Raises: ValueError
– For invalid file extension
-
lib.file_io.
read_from_fits
(file_name)[source]¶ Read FITS file
This method reads image array data from a FITS file.
Parameters: file_name (str) – Name of file with path Returns: Return type: np.ndarray array of image data
-
lib.file_io.
read_input_files
(data_file_name, psf_file_name, current_file_name=None)[source]¶ Read input files
This method reads image array data from the specified input files.
Parameters: Returns: Return type: tuple of np.ndarray arrays of image data
Raises: ValueError
– If number of noisy images less than the number of PSFsValueError
– If the shape of the current results does not match the input data
-
lib.file_io.
write_output_files
(output_file_name, primal_res, dual_res=None, psf_res=None, output_format='npy')[source]¶ Write output files
This method writes the image data results to the specified output file(s)
Parameters: - output_file_name (str) – Name of file with path for the output data
- primal_res (np.ndarray) – Array of primal output results
- dual_res (np.ndarray, optional) – Array of dual output results
- psf_res (np.ndarray, optional) – Array of PSF output results
- output_format (str, optional) – Output file format (numpy binary or FITS)