melkit.toolkit.Toolkit

class melkit.toolkit.Toolkit(filename: str)

Multi-purpose file manipulator.

__init__(filename: str)

Methods

__init__(filename)

as_dataframe(datafile)

Converts an output EDF file to a Pandas dataframe.

available_to_csv(obj_list[, title])

Returns a single-column available IDs DataFrame from an object list.

create_submodel(cv_id[, new_file])

Creates a submodel related to a given CV.

get_available_ids(obj_list)

Returns a sorted list of available IDs from a list of objects.

get_cf(cf_id)

Searches for a CF in the input file and returns it as a CF object.

get_cf_list()

Return the list of CFs in parsed file.

get_connected_cfs(obj_id)

Get those CFs directly or indirectly connected to a given Object.

get_connected_cvs(cv_id)

Get those CVs connected to a given CV

get_cv(cv_id)

Searches for a CV in the input file and returns it as a CV object.

get_cv_list()

Return the list of CVs in parsed file.

get_duplicated(obj_list)

Searches for duplicated objects (CV, FL...) from a list of objects.

get_edf_vars()

Returns a list of variable names based on EDF records in file.

get_fl(fl_id)

Searches for a FL in the input file and returns it as a FL object.

get_fl_connections(cv_id)

Get those FLs connected to a given CV

get_fl_list()

Return the list of CVs in parsed file.

get_last_values(datafile)

Returns the last values of an EDF output file.

get_last_values_dict(datafile)

Returns the last values of an EDF output file with the corresponding variable names.

get_used_ids(obj_list)

Returns a sorted list of used IDs from a list of objects.

id_search(obj_list, id)

Searches for an input object (CV, FL...) by its ID in a list of input elements.

plot_edf(datafile, y_var)

Plot an EDF variable value along time.

remove_comments([overwrite, new_file])

Remove comments from input file.

remove_object(obj_id[, overwrite, new_file])

Deletes an object from the input file.

update_object(obj[, overwrite, new_file])

Updates object input information.

used_to_csv(obj_list[, title])

Returns a single-column used IDs DataFrame from an object list.

write_object(obj[, overwrite, new_file])

Writes a new object in the input file.

_read_cfs() List[CF]

Looks for CFs in the input file and returns them as a list of CF objects.

_read_cvs() List[CV]

Looks for CVs in the input file and returns them as a list of CV objects.

_read_fls() List[FL]

Looks for FLs in the input file and returns them as a list of FL objects.

_read_object(id_regex: str) List[Object]

Looks for objects in the input file according to a given ID regex

as_dataframe(datafile: str) DataFrame

Converts an output EDF file to a Pandas dataframe.

available_to_csv(obj_list: List[Object], title='./available.csv') DataFrame

Returns a single-column available IDs DataFrame from an object list. Also exports it as a CSV file.

create_submodel(cv_id: str, new_file: str = None) List[CV] | List[FL]

Creates a submodel related to a given CV. Those neighbour CVs are made time-independent.

get_available_ids(obj_list: List[Object]) List[str]

Returns a sorted list of available IDs from a list of objects.

get_cf(cf_id: str) CF

Searches for a CF in the input file and returns it as a CF object.

get_cf_list() List[CF]

Return the list of CFs in parsed file.

get_connected_cfs(obj_id: str) List[CF]

Get those CFs directly or indirectly connected to a given Object. - If the Object is an FL, the CF associated with the CFnnnTk record is returned and, recursively, all CFs on which this CF depends are added. - If the object is a CF, that CF and its dependencies are returned.

get_connected_cvs(cv_id: str) List[CV]

Get those CVs connected to a given CV

get_cv(cv_id: str) CV

Searches for a CV in the input file and returns it as a CV object.

get_cv_list() List[CV]

Return the list of CVs in parsed file.

get_duplicated(obj_list: List[Object]) List[Object]

Searches for duplicated objects (CV, FL…) from a list of objects.

get_edf_vars() List[str]

Returns a list of variable names based on EDF records in file.

get_fl(fl_id: str) FL

Searches for a FL in the input file and returns it as a FL object.

get_fl_connections(cv_id: str) List[FL]

Get those FLs connected to a given CV

get_fl_list() List[FL]

Return the list of CVs in parsed file.

get_last_values(datafile: str) List[float]

Returns the last values of an EDF output file.

get_last_values_dict(datafile: str) List[float]

Returns the last values of an EDF output file with the corresponding variable names.

get_used_ids(obj_list: List[Object]) List[str]

Returns a sorted list of used IDs from a list of objects.

Searches for an input object (CV, FL…) by its ID in a list of input elements.

plot_edf(datafile: str, y_var: str) None

Plot an EDF variable value along time.

remove_comments(overwrite=False, new_file: str = None) None

Remove comments from input file.

remove_object(obj_id: str, overwrite: bool = False, new_file: str = None) None

Deletes an object from the input file.

update_object(obj: Object, overwrite: bool = False, new_file: str = None) None

Updates object input information.

used_to_csv(obj_list: List[Object], title='./used.csv') DataFrame

Returns a single-column used IDs DataFrame from an object list. Also exports it as a CSV file.

write_object(obj: Object, overwrite: bool = False, new_file: str = None) None

Writes a new object in the input file.