agora.io.bridge.BridgeH5

class BridgeH5(filename, flag='r')[source]

Bases: object

Base class to interact with h5 files.

It includes functions that predict how long segmentation will take.

Attributes
cell_tree
meta_h5

Return metadata, defining it if necessary.

Methods

close()

Close the h5 file.

get_consecutives(tree, nstepsback)

Receives a sorted tree and returns the keys of consecutive elements.

get_info_tree([fields])

Return traps, time points and labels for this position in the form of a tree in the hierarchy determined by the argument fields.

get_npairs

get_npairs_over_time

Initialise with the name of the h5 file.

Attributes
cell_tree
meta_h5

Return metadata, defining it if necessary.

Methods

close()

Close the h5 file.

get_consecutives(tree, nstepsback)

Receives a sorted tree and returns the keys of consecutive elements.

get_info_tree([fields])

Return traps, time points and labels for this position in the form of a tree in the hierarchy determined by the argument fields.

get_npairs

get_npairs_over_time

__init__(filename, flag='r')[source]

Initialise with the name of the h5 file.

Methods

__init__(filename[, flag])

Initialise with the name of the h5 file.

close()

Close the h5 file.

get_consecutives(tree, nstepsback)

Receives a sorted tree and returns the keys of consecutive elements.

get_info_tree([fields])

Return traps, time points and labels for this position in the form of a tree in the hierarchy determined by the argument fields.

get_npairs([nstepsback, tree])

get_npairs_over_time([nstepsback])

Attributes

cell_tree

meta_h5

Return metadata, defining it if necessary.

close()[source]

Close the h5 file.

static get_consecutives(tree, nstepsback)[source]

Receives a sorted tree and returns the keys of consecutive elements.

get_info_tree(fields=('trap', 'timepoint', 'cell_label'))[source]

Return traps, time points and labels for this position in the form of a tree in the hierarchy determined by the argument fields.

Note that it is compressed to non-empty elements and timepoints.

Default hierarchy is: - trap - time point - cell label

This function currently produces trees of depth 3, but it can easily be extended for deeper trees if needed (e.g. considering groups, chambers and/or positions).

Parameters
fields: list of strs

Fields to fetch from ‘cell_info’ inside the h5 file.

Returns
Nested dictionary where keys (or branches) are the upper levels and the leaves are the last element of :fields:.
property meta_h5: Dict[str, Any]

Return metadata, defining it if necessary.

Return type

Dict[str, Any]