pandora.check_configuration
This module contains functions allowing to check the configuration given to Pandora pipeline.
Module Contents
Functions
|
Test if file can be open by rasterio |
|
Test if file can be open by rasterio |
|
Check if two data_vars are the same dimensions |
|
Check if attributes are in the dataset |
|
Check if input dataset is correct |
|
Check that left and right datasets are correct |
|
Check width and height are the same between two images |
|
Check the images |
|
Check that band names have the correct format : band names must be strings. |
|
Check disparities from user configuration |
|
Check disparities with this format |
|
Get the input configuration |
|
Get the pipeline configuration |
|
Return the approximate memory consumption for a given pipeline in GiB. |
|
Check if the pipeline is correct by |
|
Complete and check if the dictionary is correct |
|
Complete and check if the dictionary is correct |
|
Concatenate dictionaries |
|
Returns the multiscale parameters |
|
Read a json configuration file |
|
Update the default configuration with the user configuration, |
Attributes
- pandora.check_configuration.rasterio_can_open_mandatory(file_: str) bool [source]
Test if file can be open by rasterio
- Parameters:
file (string) – File to test
- Returns:
True if rasterio can open file and False otherwise
- Return type:
bool
- pandora.check_configuration.rasterio_can_open(file_: str) bool [source]
Test if file can be open by rasterio
- Parameters:
file (string) – File to test
- Returns:
True if rasterio can open file and False otherwise
- Return type:
bool
- pandora.check_configuration.check_shape(dataset: xarray.Dataset, ref: str, test: str) None [source]
Check if two data_vars are the same dimensions
- Parameters:
dataset (xr.Dataset) – dataset
ref (str) – name of the reference image
test (str) – the tested image
- Returns:
None
- pandora.check_configuration.check_attributes(dataset: xarray.Dataset, attribute_list: set) None [source]
Check if attributes are in the dataset
- Parameters:
dataset (xr.Dataset) – dataset
attribute_list (list) – the attribute to test
- Returns:
None
- pandora.check_configuration.check_dataset(dataset: xarray.Dataset) None [source]
Check if input dataset is correct
- Parameters:
dataset (xr.Dataset) – dataset
- Returns:
None
- pandora.check_configuration.check_datasets(left: xarray.Dataset, right: xarray.Dataset) None [source]
Check that left and right datasets are correct
- Parameters:
left (xr.Dataset) – left dataset
right (xr.Dataset) – right dataset
- Returns:
None
- pandora.check_configuration.check_image_dimension(img1: rasterio.io.DatasetReader, img2: rasterio.io.DatasetReader) None [source]
Check width and height are the same between two images
- Parameters:
img1 (rasterio.io.DatasetReader) – image DatasetReader with width and height
img2 (rasterio.io.DatasetReader) – image DatasetReader with width and height
- Returns:
None
- pandora.check_configuration.check_images(user_cfg: Dict[str, dict]) None [source]
Check the images
- Parameters:
user_cfg (dict) – user configuration
- Returns:
None
- pandora.check_configuration.check_band_names(dataset: xarray.Dataset) None [source]
Check that band names have the correct format : band names must be strings.
- Parameters:
dataset (xr.Dataset) – dataset
- Returns:
None
- pandora.check_configuration.check_disparities_from_input(disparity: list[int] | str | None, img_left: str) None [source]
Check disparities from user configuration
- Parameters:
disparity (list[int] | str | None) – disparity to check if disparity is a list of two values: min and max.
img_left (str) – path to the left image
- Returns:
None
- pandora.check_configuration.check_disparities_from_dataset(disparity: xarray.DataArray) None [source]
Check disparities with this format
disparity: 3D (band_disp, row, col) xarray.DataArray float32 and band_disp = (min, max)
- Parameters:
disparity (xr.DataArray) – disparity to check
- Returns:
None
- pandora.check_configuration.get_config_input(user_cfg: Dict[str, dict]) Dict[str, dict] [source]
Get the input configuration
- Parameters:
user_cfg (dict) – user configuration
- Return cfg:
partial configuration
- Rtype cfg:
dict
- pandora.check_configuration.get_config_pipeline(user_cfg: Dict[str, dict]) Dict[str, dict] [source]
Get the pipeline configuration
- Parameters:
user_cfg (dict) – user configuration
- Return cfg:
partial configuration
- Rtype cfg:
dict
- pandora.check_configuration.memory_consumption_estimation(user_pipeline_cfg: Dict[str, dict], user_input: Dict[str, dict] | Tuple[str, int, int] | Tuple[str, str], pandora_machine: pandora.state_machine.PandoraMachine, checked_cfg_flag: bool = False) Tuple[float, float] | None [source]
Return the approximate memory consumption for a given pipeline in GiB.
- Parameters:
user_pipeline_cfg (dict) – user pipeline configuration
user_input (dict or Tuple[str, int, int] or Tuple[str, str]) – user input configuration, may be given as a dict or directly as (img_path, disp_min, disp_max) where [disp_min, disp_max] is the disparity interval used, or as (img_path, disparity_path) where disparity_path leads to a disparity grid containing two bands: min and max.
pandora_machine (PandoraMachine object) – instance of PandoraMachine
checked_cfg_flag (bool) – Flag for checking pipeline
- Returns:
minimum and maximum memory consumption
- Return type:
Tuple[float, float]
- pandora.check_configuration.check_pipeline_section(user_cfg: Dict[str, dict], img_left: xarray.Dataset, img_right: xarray.Dataset, pandora_machine: pandora.state_machine.PandoraMachine) Dict[str, dict] [source]
Check if the pipeline is correct by - Checking the sequence of steps according to the machine transitions - Checking parameters, define in dictionary, of each Pandora step
- Parameters:
user_cfg (dict) – pipeline user configuration
img_left (xarray.Dataset) – image left with metadata
img_right (xarray.Dataset) – image right with metadata
pandora_machine (PandoraMachine object) – instance of PandoraMachine
- Returns:
cfg: pipeline configuration
- Return type:
cfg: dict
- pandora.check_configuration.check_input_section(user_cfg: Dict[str, dict]) Dict[str, dict] [source]
Complete and check if the dictionary is correct
- Parameters:
user_cfg (dict) – user configuration
- Returns:
cfg: global configuration
- Return type:
cfg: dict
- pandora.check_configuration.check_conf(user_cfg: Dict[str, dict], pandora_machine: pandora.state_machine.PandoraMachine) dict [source]
Complete and check if the dictionary is correct
- Parameters:
user_cfg (dict) – user configuration
pandora_machine (PandoraMachine) – instance of PandoraMachine
- Returns:
cfg: global configuration
- Return type:
cfg: dict
- pandora.check_configuration.concat_conf(cfg_list: List[Dict[str, dict]]) Dict[str, dict] [source]
Concatenate dictionaries
- Parameters:
cfg_list (List of dict) – list of configurations
- Returns:
cfg: global configuration
- Return type:
cfg: dict
- pandora.check_configuration.read_multiscale_params(cfg: Dict[str, dict]) Tuple[int, int] [source]
Returns the multiscale parameters
- Parameters:
cfg (dict) – configuration
- Returns:
num_scales: number of scales
scale_factor: factor by which each coarser layer is downsampled
- Return type:
tuple(int, int )
- pandora.check_configuration.input_configuration_schema_integer_disparity: collections.abc.Mapping[source]
- pandora.check_configuration.input_configuration_schema_left_disparity_grids_right_none: collections.abc.Mapping[source]
- pandora.check_configuration.input_configuration_schema_left_disparity_grids_right_grids: collections.abc.Mapping[source]
- pandora.check_configuration.MEMORY_CONSUMPTION_LIST = [['matching_cost', 'matching_cost_method', 'mc_cnn', 1.57e-05, 265], ['optimization',...[source]
- pandora.check_configuration.read_config_file(config_file: os.PathLike | str) Dict[str, dict] [source]
Read a json configuration file
- Parameters:
config_file (PathLike | string) – path to a json file containing the algorithm parameters
- Return user_cfg:
configuration dictionary
- Return type:
dict
- pandora.check_configuration.update_conf(def_cfg: Dict[str, dict], user_cfg: Dict[str, dict]) Dict[str, dict] [source]
Update the default configuration with the user configuration,
- Parameters:
def_cfg (dict) – default configuration
user_cfg (dict) – user configuration
- Returns:
the user and default configuration
- Return type:
dict