cgeniepy.utils#

Functions#

check_rm(path)

Check and delete file

file_exists(path)

Check if file exists. If not, raise FileNotFoundError.

is_empty(path)

Check if file is empty. If the file does not exist, then create one.

efficient_log(data[, replace_zero])

A shortcut to efficiently calculate log10 of data.

download_zenodo_file(record_id, filename[, download_path])

Downloads a specific file from a Zenodo record.

Module Contents#

cgeniepy.utils.check_rm(path)#

Check and delete file

Parameters:

path – path string of target file

cgeniepy.utils.file_exists(path)#

Check if file exists. If not, raise FileNotFoundError.

Parameters:

path – path string of target file

Returns:

True if file exists

cgeniepy.utils.is_empty(path)#

Check if file is empty. If the file does not exist, then create one.

Parameters:

path – path string of target file

Returns:

boolean operator

cgeniepy.utils.efficient_log(data, replace_zero=10)#

A shortcut to efficiently calculate log10 of data.

Parameters:
  • data – data to calculate log10

  • replace_zero – value to replace zero in data

Returns:

log10 of data

cgeniepy.utils.download_zenodo_file(record_id, filename, download_path='~/.cgeniepy/')#

Downloads a specific file from a Zenodo record. Skips download if file already exists.

Args:

record_id (str): The Zenodo record ID (the numeric part of the DOI). filename (str): The name of the file to download. download_path (str): The directory to save the file in.