ophyd.areadetector.filestore_mixins.FileStoreBase

class ophyd.areadetector.filestore_mixins.FileStoreBase(*args, write_path_template, root='/', path_semantics='posix', read_path_template=None, reg=None, **kwargs)

Base class for FileStore mixin classes

This class provides

  • python side path management (root, seperate write / read paths)

  • provides generate_datum() to work with dispatch()

  • cooperative stage / unstage methods

  • cooperative read / describe methods that inject datums

Separate read and write paths are supported because the IOC that writes the files may not have the data storage mounted at the same place as the computers that are expected to access it later (for example, if the IOC is running on a windows machine and mounting a NFS share via samba).

write_path_template must always be provided, only provide read_path_template if the writer and reader will not have the same mount point.

The properties read_path_template and write_path_template do the following check against root

  • if the only write_path_template is provided

    • Used to generate read and write paths (which are identical)

    • verify that the path starts with root or the path is a relative, prepend root

  • if read_path_template is also provided then the above checks are applied to it, but write_path_template is returned without any validation.

This mixin assumes that it’s peers provide an enable signal

Parameters
write_path_templatestr

Template feed to strftime() to generate the path to set the IOC to write saved files to.

See above for interactions with root and read_path_template

rootstr, optional

The ‘root’ of the file path. This is inserted into filestore and enables files to be renamed or re-mounted with only some pain.

This represents the part of the full path that is not ‘semantic’. For example in the path ‘/data/XF42ID/2248/05/01/’, the first two parts, ‘/data/XF42ID/’, would be part of the ‘root’, where as the final 3 parts, ‘2248/05/01’ is the date the data was taken. If the files were to be renamed, it is likely that only the ‘root’ will be changed (for example of the whole file tree is copied to / mounted on another system or external hard drive).

path_semantics{‘posix’, ‘windows’}, optional
read_path_templatestr, optional

The read path template, if different from the write path. See the docstings for write_path_template and root.

regRegistry

If None provided, try to import the top-level api from filestore.api This will be deprecated 17Q3.

This object must provide:

def register_resource(spec: str,
                      root: str, rpath: str,
                      rkwargs: dict,
                      path_semantics: Optional[str]) -> str:
    ...

def register_datum(resource_uid: str, datum_kwargs: dict) -> str:
    ...

Notes

This class in cooperative and expected to particpate in multiple inheritance, all *args and extra **kwargs are passed up the MRO chain.

This class may be collapsed with FileStorePluginBase

__init__(*args, write_path_template, root='/', path_semantics='posix', read_path_template=None, reg=None, **kwargs)

Methods

__init__(*args, write_path_template[, root, ...])

collect_asset_docs()

describe()

Provide schema and meta-data for read().

generate_datum(key, timestamp, datum_kwargs)

Generate a uid and cache it with its key for later insertion.

pause()

Attempt to 'pause' the device.

read()

Read data from the device.

resume()

Resume a device from a 'paused' state.

stage()

Stage the device for data collection.

trigger()

Trigger the device and return status object.

unstage()

Unstage the device.

Attributes

fs_root

DEPRECATED: The 'root' put into the Asset registry, use reg_root

read_path_template

Returns write_path_template if read_path_template is not set

reg_root

The 'root' put into the Asset Registry

write_path_template