PYME.IO.h5rFile module

class PYME.IO.h5rFile.H5RFile(filename, mode='r', keep_alive_timeout=20.0)

Bases: object

FLUSH_INTERVAL = 1
addEvents(events)
appendToTable(tablename, data)
property events
fileFitResult(fitResult)

Legacy handling for fitResult objects as returned by remFitBuf

Parameters
fitResult
Returns
flush()

Wait until our IO loop has flushed. Currently only used in testing to make sure our data has hit the disk before we try and read it back in. Times out after twice our flush interval.

getTableData(tablename, _slice)

Retrieves a tables.table.Table from the file and returns it as a structured numpy array

Parameters
tablename: str

name of table to return

_slice: slice

slice object to index the table

Returns
table_part: numpy.ndarray
property mdh
updateMetadata(mdh)

Update the metadata, acquiring the necessary locks

wait_close()
PYME.IO.h5rFile.openH5R(filename, mode='r', keep_alive_timeout=20.0)

Open an H5R file in a threadsafe and optimised way. Looks to see if the file is already open in our cache and returns the open file if present, otherwise opens the file and adds to the cache. Files are kept open for keep_alive_timeout seconds after the last read or write operation to avoid IO overhead in repeatedly opening and closing a file for many short writes (such as saving incoming localisation results during analysis) whilst also ensuring that files do eventually get closed (the previous strategy had been to leave files open until program exit, but this becomes problematic for long-running processes in a high-throughput scenario).

Parameters
filename: string
mode: string, one of ‘r’, ‘w’, ‘a’
keep_alive_timeout: float

a timeout hint for how long to keep the file open for after the last operation on the file. NOTE: this parameter is only respected if the file is not already in the cache - if in the cache the timeout will be the timeout set by the openH5R call that initially placed it there.

Returns