pyanno4rt.input_check.check_functions
Check functions module.
This module aims to provide a collection of basic validity check functions.
Overview
|
Check the optimization components. |
|
Check the equality between the number of dose voxels calculated from the dose resolution inputs and implied by the dose-influence matrix. |
|
Check the feature filter. |
|
Check if a key is not featured in a dictionary. |
|
Check if the length of a vector-type object is invalid. |
|
Check if a file or directory path is invalid. |
|
Check if a file path is irregular or has an invalid extension. |
|
Check if a directory path is irregular or has invalid file extensions. |
|
Check if any element type in a list or tuple is invalid. |
|
Check if the input data type is invalid. |
|
Check if the data has an invalid value range. |
|
Check if a value is not included in a set of options. |
Functions
- pyanno4rt.input_check.check_functions.check_components(label, data, check_functions)[source]
Check the optimization components.
- Parameters:
label (str) – Label for the item to be checked (‘components’).
data (dict) – Dictionary with the optimization components.
check_functions (tuple) – Tuple with the individual check functions for the dictionary items.
- pyanno4rt.input_check.check_functions.check_dose_matrix(dose_shape, dose_matrix_rows)[source]
Check the equality between the number of dose voxels calculated from the dose resolution inputs and implied by the dose-influence matrix.
- Parameters:
dose_shape (tuple) – Tuple with the number of dose grid points per axis, calculated from the dose resolution inputs.
dose_matrix_rows (int) – Number of rows in the dose-influence matrix (the number of voxels in the dose grid).
- Raises:
ValueError – If the product of the elements in dose_shape is not equal to the value of dose_matrix_rows.
- pyanno4rt.input_check.check_functions.check_feature_filter(label, data, check_functions)[source]
Check the feature filter.
- Parameters:
label (str) – Label for the item to be checked (‘feature_filter’).
data (dict) – Dictionary with the parameters of the feature filter.
check_functions (tuple) – Tuple with the individual check functions for the dictionary items.
- pyanno4rt.input_check.check_functions.check_key_in_dict(label, data, keys)[source]
Check if a key is not featured in a dictionary.
- Parameters:
key (str) – Label for the item to be checked.
data (dict) – Dictionary with the reference keys.
keys (tuple) – Tuple with the keys to search for in the dictionary.
- Raises:
KeyError – If a key is not featured in the dictionary.
- pyanno4rt.input_check.check_functions.check_length(label, data, reference, sign)[source]
Check if the length of a vector-type object is invalid.
- Parameters:
label (str) – Label for the item to be checked.
data (list, tuple or ndarray) – Vector-type object with length property.
reference (int) – Reference value for the length comparison.
sign ({'==', '>', '>=', '<', '<='}) – Sign for the length comparison.
- Raises:
ValueError – If the vector-type object has an invalid length.
- pyanno4rt.input_check.check_functions.check_path(label, data)[source]
Check if a file or directory path is invalid.
- Parameters:
label (str) – Label for the item to be checked.
data (str) – Path to the file or directory.
- Raises:
IOError – If the path references an invalid file or directory.
- pyanno4rt.input_check.check_functions.check_regular_extension(label, data, extensions)[source]
Check if a file path is irregular or has an invalid extension.
- Parameters:
label (str) – Label for the item to be checked.
data (str) – Path to the file.
extensions (tuple) – Tuple with the allowed extensions for the file path.
- Raises:
FileNotFoundError – If the path references an irregular file.
TypeError – If the path has an invalid extension.
- pyanno4rt.input_check.check_functions.check_regular_extension_directory(label, data, extensions)[source]
Check if a directory path is irregular or has invalid file extensions.
- Parameters:
label (str) – Label for the item to be checked.
data (str) – Path to the file directory.
extensions (tuple) – Tuple with the allowed extensions for the directory files.
- Raises:
NotADirectoryError – If the path references an irregular directory.
TypeError – If a file in the directory has an invalid extension.
- pyanno4rt.input_check.check_functions.check_subtype(label, data, types)[source]
Check if any element type in a list or tuple is invalid.
- Parameters:
label (str) – Label for the item to be checked.
data (list or tuple) – List or tuple with the element types to be checked.
types (type or tuple) – Single type or tuple with the allowed element types.
- Raises:
TypeError – If one or more elements of the data have an invalid type.
- pyanno4rt.input_check.check_functions.check_type(label, data, types, type_condition=None)[source]
Check if the input data type is invalid.
- Parameters:
label (str) – Label for the item to be checked.
data – Input data with arbitrary type to be checked.
types (tuple or dict) – Tuple or dictionary with the allowed data types.
type_condition (None or str, default=None) – Value of the conditional variable (used as a selector if types is a dictionary).
- Raises:
TypeError – If the input data has an invalid type.
- pyanno4rt.input_check.check_functions.check_value(label, data, reference, sign, is_vector=False)[source]
Check if the data has an invalid value range.
- Parameters:
label (str) – Label for the item to be checked.
data (int, float, None, list or tuple) – Scalar or vector input to be checked.
reference (int or float) – Reference for the value comparison.
sign ({'==', '>', '>=', '<', '<='}) – Sign for the value comparison.
is_vector (bool, default=False) – Indicator for the vector property of the data.
- Raises:
ValueError – If the data has an invalid value range.
- pyanno4rt.input_check.check_functions.check_value_in_set(label, data, options, value_condition=None)[source]
Check if a value is not included in a set of options.
- Parameters:
label (str) – Label for the item to be checked.
data (str or list) – Input value to be checked.
options (tuple or dict) – Tuple or dictionary with the value options.
value_condition (None or str, default=None) – Value of the conditional variable (used as a selector if options is a dictionary).
- Raises:
ValueError – If the data has a value not included in the set of options.