PYME.IO.FileUtils.nameUtils module

A selection of tools for automatically generating paths to either save or find data

PYME.IO.FileUtils.nameUtils.baseconvert(number, todigits)

Converts a number to an arbtrary base.

Parameters
numberint

The number to convert

todigitsiterable or string

The digits of the base e.g. ‘0123456’ (base 7) or ‘ABCDEFGHIJK’ (non-numeric base 11)

PYME.IO.FileUtils.nameUtils.genClusterDataFilepath()

Generates a default path for saving raw data on the cluster

PYME.IO.FileUtils.nameUtils.genClusterResultFileName(dataFileName, create=True)

Generates a filename for saving fit results based on the original image filename

PYME.IO.FileUtils.nameUtils.genHDFDataFilepath(create=True)

Generate a default path for saving HDF formatted raw data on the local hard drive

PYME.IO.FileUtils.nameUtils.genResultDirectoryPath()

Returns the default destination for saving fit reults

PYME.IO.FileUtils.nameUtils.genResultFileName(dataFileName, create=True)

Generates a filename for saving fit results based on the original image filename

PYME.IO.FileUtils.nameUtils.genShiftFieldDirectoryPath()

Returns the default directory for shiftmaps

PYME.IO.FileUtils.nameUtils.getCalibrationDir(serialNum, create=True)

Returns the default directory where we would expect to find calibration data - e.g. sCMOS calibration maps

PYME.IO.FileUtils.nameUtils.getFullExistingFilename(relFilename)

returns a fully resolved filename given a filename relative to the environment variable PYMEDATADIR. If environment variable not defined, or the absolute path exists, assumes path is absolute.

PYME.IO.FileUtils.nameUtils.getFullFilename(relFilename)

returns a fully resolved filename given a filename relative to the environment variable PYMEDATADIR. If environment variable not defined, assumes path is absolute.

PYME.IO.FileUtils.nameUtils.getRelFilename(filename, datadir='/home/runner/PYMEData')

returns the tail of filename - ie that portion which is underneath the PYMEDATADIR directory

PYME.IO.FileUtils.nameUtils.getUsername()

Returns the user name in a platform independant way

PYME.IO.FileUtils.nameUtils.get_local_data_directory()
PYME.IO.FileUtils.nameUtils.get_service_name(process_name)

Generate an appropriate service name for zeroconf, pyro, etc.

Parameters
process_namestr

name of the process, e.g. ‘PYMEDataServer [serverfilter]’

Returns
str

service name including process ID and as much of the process name and computer as possible given length constraints. Something like PYMEDataServer [trout]:cutthroat - PID:2020

PYME.IO.FileUtils.nameUtils.get_spool_subdir()
PYME.IO.FileUtils.nameUtils.numToAlpha(num)

Convert a number to an alphabetic code

PYME.IO.FileUtils.nameUtils.rel_path_as_posix(path)

Translate any separators to ‘/’ and drop drive letters

#FIXME - do something sensible with drive letters?

PYME.IO.FileUtils.nameUtils.translateSeparators(filename)

Convert a filename which might use mixed separators / slashes to os native form.