mlreflect.utils package

Submodules

mlreflect.utils.check_gpu module

mlreflect.utils.check_gpu.check_gpu()[source]

mlreflect.utils.h5_tools module

mlreflect.utils.h5_tools.create_dataset_with_override(file: h5py._hl.files.File, name: Any, data: Any)[source]

Create dataset and delete already existing one with the same name.

mlreflect.utils.h5_tools.ensure_h5_extension(file_name: str)[source]
mlreflect.utils.h5_tools.load_data(file_name: str) dict[source]

Reads all data in h5 file file_name and returns them as a dict.

mlreflect.utils.h5_tools.save_background(file_name: str, bg_array: numpy.ndarray, bg_levels: numpy.ndarray)[source]
mlreflect.utils.h5_tools.save_data_as_h5(file_name: str, q_values: numpy.ndarray, reflectivity: numpy.ndarray, labels: pandas.core.frame.DataFrame, number_of_layers: int)[source]

Saves q_values, reflectivity and labels in the .5h file file_name. Labels are saved as pandas DataFrame.

Parameters
  • file_name – Name or path of the .h5 file

  • q_valuesndarray of q values in units 1/A

  • reflectivityn-by-m ndarray of reflectivity curves where n is the number of curves and m the number

  • q-values (of) –

  • labels – pandas DataFrame of labels

  • number_of_layers – Number of thin film layers that were simulated (excluding ambient layer)

mlreflect.utils.h5_tools.save_noise(file_name: str, noise_array: numpy.ndarray, noise_levels: numpy.ndarray)[source]
mlreflect.utils.h5_tools.strip_file_extension(file_name: str)[source]

mlreflect.utils.label_helpers module

mlreflect.utils.label_helpers.convert_to_dataframe(labels: Union[pandas.core.frame.DataFrame, numpy.ndarray], label_names: List[str]) pandas.core.frame.DataFrame[source]
mlreflect.utils.label_helpers.convert_to_ndarray(labels: Union[pandas.core.frame.DataFrame, numpy.ndarray]) numpy.ndarray[source]

mlreflect.utils.naming module

mlreflect.utils.naming.make_timestamp(style: str = 'YMD')[source]

mlreflect.utils.performance_tools module

mlreflect.utils.performance_tools.timer(func)[source]

Print the runtime of the decorated function

Module contents

mlreflect.utils.check_gpu()[source]
mlreflect.utils.make_timestamp(style: str = 'YMD')[source]
mlreflect.utils.timer(func)[source]

Print the runtime of the decorated function