pygauss.file_io module

Created on Mon May 18 21:01:25 2015

@author: chris sewell

class pygauss.file_io.Folder(path, server=None, username=None, passwrd=None)[source]

Bases: object

an object intended to act as an entry point to a folder path

Parameters:
  • path (str) – the path to the folder (absolute or relative)
  • server (str) – the server name
  • username (str) – the username to connect to the server
  • passwrd (str) – server password, if not present it will be asked for during initialisation
__enter__()[source]

use with statement to open ssh connection once

__exit__(type, value, traceback)[source]

use with statement to open ssh connection once

active()[source]

if folder is active

get_path()[source]

get folder path

islocal()[source]

if folder is local

list_files(pattern=None, one_file=False)[source]

list files in folder

Parameters:pattern (str) – a pattern the file must match that can include * wildcards
read_file(file_name)[source]

return an open file ready for reading

save_ipyimg(img, img_name)[source]

a function for outputing an IPython Image to a file

Parameters:
save_mplfig(fig, fig_name, dpi=256, format='png')[source]

a function for outputing a matplotlib figure to a file

Parameters:
save_pilimg(img, img_name)[source]
write_file(file_name, overwrite=False)[source]

return an open file ready for writing to

class pygauss.file_io.NoOutputFolder(*args, **kwargs)[source]

Bases: pygauss.file_io.Folder

a folder object which will not output any data

save_ipyimg(*arg, **kwargs)[source]
save_mplfig(*arg, **kwargs)[source]
save_pilimg(*arg, **kwargs)[source]
write_file(*arg, **kwargs)[source]