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 times factor. 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.mem.get_available_memory(verbose=True)[source]

Get the available memory in bytes.

Parameters:verbose (bool, optional) – Print out the total/available memory
Returns:available_memory – The available memory in bytes.
Return type:int

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_ini(verbose=True)[source]

Set and print the time at which the script started.

Returns:start_time – Starting time.
Return type:string
vip_hci.config.timing.timing(start_time)[source]

Print the execution time of a script.

It requires the initialization with the function time_ini().

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[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'
set()[source]
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).

Module contents

Subpackage conf contains configuration functions and internal utilities. It also contains a dictionary with parameters of high-contrast imaging instruments.