chembee.utils package
Submodules
chembee.utils.file_utils module
- chembee.utils.file_utils.check_file_name(file_name: str, ending: str)[source]
The check_name_plot function checks that the file_name ends with .png. If it does not, then check_name_plot appends .png to the end of the file_name.
- Parameters
file_name – Used to Specify the name of the file to be plotted.
- Returns
The file_name with the correct file extension.
- Doc-author
Trelent
- chembee.utils.file_utils.check_make_dir(dir_name: str) None [source]
The check_make_dir function checks if a directory exists. If it does not exist, the function creates it.
- Parameters
dir_name:str – Used to Specify the folder name.
- Returns
None.
- Doc-author
Trelent
- chembee.utils.file_utils.insert_string_in_file_name(file_name: str, insertion: str, ending: str)[source]
- chembee.utils.file_utils.make_date_file_name(prefix: str = '', file_name: str = '', suffix: str = '')[source]
The make_date_file_name function creates a file name with the date and time stamp in the format YYYY-MM-DD_HH:MM:SS.out. The prefix, file_name, and suffix are optional arguments that can be used to specify what string should precede the date stamp in the file_name (prefix), what string should be appended after the date stamp (suffix), or both (file_name). If no arguments are provided, then make_date_file_name will use default values for all three arguments.
- Parameters
prefix:str="" – Used to Add a prefix to the file name.
file_name:str="" – Used to Specify the name of the file.
suffix:str=".out" – Used to Specify the file extension.
- Returns
A string that is the combination of prefix, file_name and suffix.
- Doc-author
Trelent
- chembee.utils.file_utils.make_full_filename(prefix, file_name)[source]
The make_full_filename function takes a prefix and a file_name as input. If the prefix is None, then the file_name is returned unchanged. Otherwise, if the file name starts with ‘http://’ or ‘ftp://’, then it’s assumed to be an URL and the full_filename will contain both the prefix and file_name; otherwise, only return full_filename = file_name.
- Parameters
prefix – Used to Add a prefix to the file_name.
file_name – Used to Create a full file_name for the file to be downloaded.
- Returns
The full file_name with the prefix added to the beginning of the file_name.
- Doc-author
Trelent
- chembee.utils.file_utils.prepare_data_decicion_lib(data_set: object, columns: Optional[list] = None)[source]
The prepare_data_decicion_lib function takes in a data set from scikitlearn and returns the X and y values for the decision boundary plot. The function can also take in a list of columns to use as features, but if no input is given then it will default to using all the features.
- Parameters
data_set:object – Used to Pass the data set to the function.
columns:list=None – Used to Select the columns of the data set that are used for training.
- Returns
A tuple containing the x and y values.
- Doc-author
Trelent
- chembee.utils.file_utils.prepare_file_name_saving(prefix: str, file_name: str, ending: str) str [source]
The prepare_file_name_saving function takes a prefix and file name as input. It checks to see if the directory exists, and makes it if not. Then it returns the full path of the file.
- Parameters
prefix:str – Used to Specify the folder where the file will be saved.
file_name:str – Used to Specify the name of the file to be saved.
- Returns
The full path of the file name.
- Doc-author
Trelent
- chembee.utils.file_utils.save_json_to_file(dictionary, file_name: Optional[str] = None, suffix: str = '.json')[source]
The save_json function saves a dictionary to a json file.
- Parameters
dictionary – Used to store the data that will be saved.
file_name:str=None – Used to specify a file name.
- Returns
A string with the name of the file that was just created.
- Doc-author
Julian M. Kleber