vip_hci.config package
Submodules
vip_hci.config.mem module
System memory related functions
- vip_hci.config.mem.check_enough_memory(input_bytes, factor=1, raise_error=True, error_msg='', verbose=True)[source]
Check if
input_bytes
are larger than system’s available memory timesfactor
. This function is used to check the inputs (largest ones such as multi-dimensional cubes) of algorithms and avoid system/Python crashes or heavy swapping.- Parameters:
input_bytes (float) – The size in bytes of the inputs of a given function.
factor (float, optional) – Scales how much memory is needed in terms of the size of input_bytes.
raise_error (bool, optional) – If True, a RuntimeError is raised when the condition is not met.
error_msg (str, optional) – [raise_error=True] To be appended to the message of the RuntimeError.
verbose (bool, optional) – If True, information about the available memory is printed out.
vip_hci.config.param module
Dictionaries with telescope/instrument parameters.
Usage
from vip_hci.config import VLT_NACO
lbda = VLT_NACO['lambdal']
diameter = VLT_NACO['diam']
pxscale = VLT_NACO['plsc']
resel = lambda/diameter*206265/pxscale
vip_hci.config.timing module
Functions for timing other functions/procedures.
- vip_hci.config.timing.time_fin(start_time)[source]
Return the execution time of a script.
It requires the initialization with the function time_ini().
vip_hci.config.utils_conf module
Module with utilities.
- class vip_hci.config.utils_conf.Progressbar(iterable=None, desc=None, total=None, leave=True, backend=None, verbose=True)[source]
Bases:
object
Show progress bars. Supports multiple backends.
Examples
from vip_hci.var import Progressbar Progressbar.backend = "tqdm" from time import sleep for i in Progressbar(range(50)): sleep(0.02) # or: bar = Progressbar(total=50): for i in range(50): sleep(0.02) bar.update() # Progressbar can be disabled globally using Progressbar.backend = "hide" # or locally using the ``verbose`` keyword: Progressbar(iterable, verbose=False)
- backend = 'pyprind'
- vip_hci.config.utils_conf.check_array(input_array, dim, msg=None)[source]
Checks the dimensionality of input. In case the check is not successful, a TypeError is raised.
- Parameters:
input_array (list, tuple or np.ndarray) – Input data.
dim (int or tuple) – Number of dimensions that
input_array
should have.dim
can take one of these values: 1, 2, 3, 4, (1,2), (2,3), (3,4) or (2,3,4).msg (str, optional) – String to be used in the error message (
input_array
name).
vip_hci.config.utils_param module
Module for various object oriented functions.
- vip_hci.config.utils_param.filter_duplicate_keys(filter_item: any, ref_item: any, filter_in: bool = True)[source]
Filter in or out keys of an item based on a reference item.
Can keep only the keys from a reference item or exclude all of them, based on the boolean filter_in.
- Parameters:
filter_item (Object or dict) – An object or a dictionnary that needs to be filtered.
ref_item (Object or dict) – An object or a dictionnary that gives the keys wanted for filtering.
filter_in (bool) – If True, keeps only the keys from reference, else erase only those keys.
- vip_hci.config.utils_param.print_algo_params(function_parameters: dict) None [source]
Print the parameters that will be used for the run of an algorithm.
- vip_hci.config.utils_param.separate_kwargs_dict(initial_kwargs: dict, parent_class: any) None [source]
Take a set of kwargs parameters and split them in two separate dicts.
The condition for the separation is to extract the parameters of an object (example: PCA_Params) and leave the other parameters as another dictionnary. This is used in
vip_hci.psfsub
andvip_hci.invprob
functions to allow both the parameters of the function and the usualrot_options
to be passed as one kwargs.- Parameters:
initial_kwargs (dict) – The complete set of kwargs to separate.
parent_class (class) – The model containing the parameters to extract into the first dictionnary.
- Returns:
class_params (dict) – Parameters for the parent class to initialize.
more_params (dict) – Parameters left after extracting the class_params.
- vip_hci.config.utils_param.setup_parameters(params_obj: object, fkt: Callable, as_list: bool = False, show_params: bool = False, **add_params: dict) any [source]
Help creating a dictionnary of parameters for a given function.
Look for the exact list of parameters needed for the
fkt
function and takes only the attributes needed from theparams_obj
. More parameters can be included with the**add_pararms
dictionnary.- Parameters:
params_obj (object) – Parameters to sort and order for the function.
fkt (function) – The function we want to give parameters to.
as_list (boolean) – Determines if the set of parameters should be return as a list instead of a dictionnary.
**add_params (dictionnary, optional) – Additionnal parameters that may not be included in the params_obj.
- Returns:
params_setup – The dictionnary comprised of parameters needed for the function, selected amongst attributes of PostProc objects and additionnal parameters. Can be a list if asked for (used in specific cases such as when calling functions through
vip_hci.config.utils_conf.pool_map
, see an example invip_hci.psfsub.framediff
).- Return type:
dictionnary or list
Module contents
Subpackage conf
contains configuration functions and internal utilities. It
also contains a dictionary with parameters of high-contrast imaging instruments.