Utils

ecopann.utils

class ecopann.utils.Logger(path='logs', fileName='log', stream=<open file '<stdout>', mode 'w'>)[source]

Bases: object

Record the output of the terminal and write it to disk.

flush()[source]
write(message)[source]
ecopann.utils.logger(path='logs', fileName='log')[source]
ecopann.utils.makeList(roots)[source]

Checks if the given parameter is a list. If not, creates a list with the parameter as an item in it.

Parameters:roots (object) – The parameter to check.
Returns:A list containing the parameter.
Return type:list
ecopann.utils.mkdir(path)[source]

Make a directory in a particular location if it is not exists, otherwise, do nothing.

Parameters:path (str) – The path of a file.

Examples

>>> mkdir('/home/UserName/test')
>>> mkdir('test/one')
>>> mkdir('../test/one')
ecopann.utils.saveTorchPt(path, FileName, File)[source]

Save the .pt files using torch.save() funtion.

Parameters:
  • path (str) – The path of the file to be saved.
  • FileName (str) – The name of the file to be saved.
  • File (object) – The file to be saved.
ecopann.utils.savenpy(path, FileName, File, dtype=<type 'numpy.float32'>)[source]

Save an array to a binary file in .npy format using numpy.save() function.

Parameters:
  • path (str) – The path of the file to be saved.
  • FileName (str) – The name of the file to be saved.
  • File (object) – The file to be saved.
  • dtype (str or object) – The type of the data to be saved. Default: numpy.float32.
ecopann.utils.savetxt(path, FileName, File)[source]

Save the .txt files using numpy.savetxt() funtion.

Parameters:
  • path (str) – The path of the file to be saved.
  • FileName (str) – The name of the file to be saved.
  • File (object) – The file to be saved.

ecopann.coplot

CoPlot is a personal plotting library inserted into ecopann, which can plot contours from the ANN chain. The code coplot is available for free from GitHub and can be installed independently.