idstools.scenariodescription

Module Contents

class idstools.scenariodescription.ScenarioDescription(pulse: int, run: int, yaml_path: str)[source]

The above function initializes an object with a pulse, run, and yaml path, and attempts to load YAML data from a file.

Parameters:
pulse: int

The “pulse” parameter is an integer that represents a pulse number.

run: int

The run parameter is an integer that represents the run number.

yaml_path: str

The yaml_path parameter is a string that represents the path to the YAML file.

yaml_data = 'None'
yaml_path
get_children(yaml_data, dict_to_fill={})[source]

The function get_children recursively retrieves data from a YAML file and populates a dictionary with specific keys and values.

Parameters:
yaml_data

The yaml_data parameter is a dictionary that contains data in YAML format.

dict_to_fill={}

The dict_to_fill parameter is a dictionary that is used to store the values extracted from the yaml data . It is initially an empty dictionary and is passed as an argument to the get_children function.

Returns:

the dictionary with scenario children.

get_family()[source]

The function “get_family” returns a dictionary containing the parents and children of a scenario based on the provided YAML data.

Returns:

“parents” and “children”. The values associated with these keys are the results of calling the get_parents and get_children methods, passing in yaml data as argument.

Return type:

a dictionary called family_dict which contains two keys

get_parents(yaml_data, dict_to_fill={})[source]

The function get_parents retrieves parent data from a YAML file and populates a dictionary with the parent information.

Parameters:
yaml_data

The yaml_data parameter is a dictionary that contains data in YAML format.

dict_to_fill={}

The dict_to_fill parameter is a dictionary that is used to store the parents information. It is initially empty and is filled with parent data as the function recursively calls itself.

Returns:

the dictionary with scenario parents

print_yaml()[source]

The function print_yaml prints the yaml_data attribute of the object on Terminal.

class idstools.scenariodescription.ScenarioDescriptionSummary(directory_list=[])[source]

The function initializes a directory list variable based on the provided input or a default value.

Parameters:
directory_list=[]

A list of directory paths to search for scenario files.

directory_list = '[]'
static get_data_frame_from_yaml(yaml_file_path, add_obsolete=False)[source]

The function get_data_frame_from_yaml takes a YAML file path, reads the data from the file, checks if the status is active (unless addObsolete is set to True), converts the data into a flat table, and returns it as a pandas DataFrame.

Parameters:
yaml_file_path

The path to the YAML file from which you want to create a DataFrame.

add_obsolete=False

The add_obsolete parameter is a boolean flag that determines whether or not to include obsolete data in the resulting DataFrame.

Returns:

a pandas DataFrame object.

get_dataframes_from_files(extension='.yaml', add_obsolete=False)[source]

The function get_dataframes_from_files retrieves data from YAML files, creates dataframes, adds additional information, and returns a concatenated dataframe.

Parameters:
extension='.yaml'

The “extension” parameter is a string that specifies the file extension to search for.

add_obsolete=False

The “add_obsolete” parameter is a boolean flag that determines whether or not to include obsolete data in the resulting dataframes.

Returns:

a pandas DataFrame object.

static get_yaml_data(yaml_file_path)[source]

The function get_yaml_data reads a YAML file and returns its contents as a Python object.

Parameters:
yaml_file_path

The yaml_file_path parameter is a string that represents the file path of the YAML file that you want to load and retrieve data from.

Returns:

the data loaded from the YAML file.

idstools.scenariodescription.default_folder_path = "'/work/imas/shared/imasdb/ITER/3/0'"
idstools.scenariodescription.logger
idstools.scenariodescription.yaml_mapping