edlio package#

Module contents#

Module to work with data in an Experiment Directory Layout (EDL) structure

class edlio.EDLCollection(name=None)#

Bases: EDLGroup

An EDL Collection

__init__(name=None)#

Create a new EDL collection.

If the collection has no name and path set, it can not be saved to disk.

Parameters:

name – Name of this collection, or None

property collection_idname: str#

Retrieve a human-readable string for this collection which is most likely (but not guaranteed to be) unique. If this collection has no properties set, the value of this property may be None or empty. The format of the returned string is arbitrary and should not be parsed.

property generator_id: str#

Identification string of the software which generated this EDL unit.

class edlio.EDLDataset(name=None)#

Bases: EDLUnit

An EDL Dataset

__init__(name=None)#

Create a new EDL dataset.

If the dataset has no name and path set, it can not be saved to disk.

Parameters:

name – Name of this dataset, or None

add_aux_data(adf)#
property aux_data: list[EDLDataFile]#
property data: EDLDataFile#
load(path, mf=None)#

Load an EDL dataset from a path.

Parameters:
read_aux_data(key=None)#

Read auxiliary data from this dataset.

Parameters:

key (Optional[str]) – Identifier key for the auxiliary dataset to load. Will look for a substring match in file_type/media_type properties of the data first, then look for a summary text match to determine which data was requested. If not set, the first dataset is loaded.

Return type:

The data, or None in case no aux-data or aux-data entry was found.

read_data(**kwargs)#

Read data from this dataset.

Returns a generator to read data from this dataset by individual chunks, taking auxiliary data into account.

save()#

Save dataset changes to their current location on disk.

exception edlio.EDLError(message)#

Bases: Exception

Exception raised for errors in the input.

Attributes:

message – explanation of the error

class edlio.EDLGroup(name=None)#

Bases: EDLUnit

An EDL Group

__init__(name=None)#

Create a new EDL group.

If the group has no name and path set, it can not be saved to disk.

Parameters:

name (str) – Name of this group, or None

add_child(child)#
change_name(new_name)#
property children#
property collection_id: UUID#
dataset_by_name(name, *, create=False)#
property datasets#
group_by_name(name, *, create=False)#
property groups#
load(path, mf=None)#

Load an EDL unit from a path or path/data combination.

Parameters:
  • path – Filesystem path of this dataset.

  • mf – Manifest file data as dictionary, if data from :path should not be used.

property root_path: str#
save()#
edlio.Q_#

alias of Quantity

edlio.load(path)#

Open an EDL unit via its filesystem path.

This function will read an EDL unit on the filesystem and return an object representing it. Depending on the type of the EDL unit, the returned datatype may be a collection, group or dataset.

Parameters:

path (Union[str, PathLike[str]]) – The filesystem location of the EDL unit.

Returns:

An EDL unit.

Return type:

EDLCollection, EDLGroup, EDLDataset

Submodules#

edlio.collection module#

class edlio.collection.EDLCollection(name=None)#

Bases: EDLGroup

An EDL Collection

__init__(name=None)#

Create a new EDL collection.

If the collection has no name and path set, it can not be saved to disk.

Parameters:

name – Name of this collection, or None

property collection_idname: str#

Retrieve a human-readable string for this collection which is most likely (but not guaranteed to be) unique. If this collection has no properties set, the value of this property may be None or empty. The format of the returned string is arbitrary and should not be parsed.

property generator_id: str#

Identification string of the software which generated this EDL unit.

edlio.dataset module#

class edlio.dataset.EDLDataFile(base_path, media_type=None, file_type=None, unit_attrs=None)#

Bases: object

A data file, associated with a dataset

property data_type#
property file_type: str | None#

´ The filetype, in case no media type was available.

property media_type: str | None#

The media (MIME) type of this data.

new_part(fname, index=-1, *, allow_exists=False)#
part_paths()#

Return a generator for the path of each file-part, in their correct sorting order.

parts: list[EDLDataPart] = []#
read(aux_data_entries=None, **kwargs)#

Read all data parts in this set.

This returns a generator which reads all the individual data parts in this data file. The data reader may take auxiliary data into account, if :aux_data is passed.

property summary: str | None#

A human-readable summary of what this data is about.

class edlio.dataset.EDLDataPart(fname, index=-1)#

Bases: object

Describes a part of a data file that has been split

fname: str = None#
index: int = -1#
class edlio.dataset.EDLDataset(name=None)#

Bases: EDLUnit

An EDL Dataset

__init__(name=None)#

Create a new EDL dataset.

If the dataset has no name and path set, it can not be saved to disk.

Parameters:

name – Name of this dataset, or None

add_aux_data(adf)#
property aux_data: list[EDLDataFile]#
property data: EDLDataFile#
load(path, mf=None)#

Load an EDL dataset from a path.

Parameters:
read_aux_data(key=None)#

Read auxiliary data from this dataset.

Parameters:

key (Optional[str]) – Identifier key for the auxiliary dataset to load. Will look for a substring match in file_type/media_type properties of the data first, then look for a summary text match to determine which data was requested. If not set, the first dataset is loaded.

Return type:

The data, or None in case no aux-data or aux-data entry was found.

read_data(**kwargs)#

Read data from this dataset.

Returns a generator to read data from this dataset by individual chunks, taking auxiliary data into account.

save()#

Save dataset changes to their current location on disk.

edlio.group module#

class edlio.group.EDLGroup(name=None)#

Bases: EDLUnit

An EDL Group

__init__(name=None)#

Create a new EDL group.

If the group has no name and path set, it can not be saved to disk.

Parameters:

name (str) – Name of this group, or None

add_child(child)#
change_name(new_name)#
property children#
property collection_id: UUID#
dataset_by_name(name, *, create=False)#
property datasets#
group_by_name(name, *, create=False)#
property groups#
load(path, mf=None)#

Load an EDL unit from a path or path/data combination.

Parameters:
  • path – Filesystem path of this dataset.

  • mf – Manifest file data as dictionary, if data from :path should not be used.

property root_path: str#
save()#

edlio.unit module#

exception edlio.unit.EDLError(message)#

Bases: Exception

Exception raised for errors in the input.

Attributes:

message – explanation of the error

class edlio.unit.EDLUnit(name=None)#

Bases: object

Generic base class for all EDL unit types.

property attributes: dict#
property authors#
change_name(new_name)#
property collection_id: UUID#
load(path, mf=None)#

Load an EDL unit from a path or path/data combination.

Parameters:
property name#
property parent#
property path: str#
property root_path: str#
property time_created: datetime#
property unit_type#

edlio.utils module#

edlio.utils.sanitize_name(name)#

Sanitize a string for use as an EDL unit name, by stripping or replacing invalid characters.

Parameters:

name (str) – A string to sanitize.

Returns:

The sanitized name.

Return type:

str

Subpackages#