Helpers#

h_transport_materials.helpers.absolute_path(filename: str, level=1)[source]#

Returns the absolute path of a file. Based on a relative path.

Parameters:
  • filename (str) – the relative path to the file

  • level (int, optional) – Level in the file call. 0 corresponds to the file where absolute_path is defined, 1 correspond to the file calling this function, 2 corresponds to the parent of the file calling this function. Defaults to 1.

Returns:

the absolute path of the file

Return type:

str

h_transport_materials.helpers.structure_data_from_wpd(filename: str)[source]#

Returns a structured dataset based on a csv file from WebPlotDigitizer exported with the “Export all data” option

Parameters:

filename (str) – the relative path to the csv file

Returns:

structured dictionary with keys corresponding to field names.

Ex: {“fieldA”: {“x”: [1,2,3], “y”: [1,2,3]}}

Return type:

dict