nexxT.filters.GenericReader module

This module provides a generic reader which can be inherited to use new data formats inside nexxT.

class nexxT.filters.GenericReader.GenericReader(env)[source]

Bases: Filter

Generic harddisk reader which can be used as base class for implementing readers for custom file formats. To create a new input file reader, inherit from this class and reimplement getNameFilter(…) and openFile(…). openFile(…) shall return an instance of an implementation of the interface GenericReaderFile.

See nexxT.filters.hdf5.Hdf5Reader for an example.

__init__(env)[source]

Filter Constructor.

Parameters:
  • dynInPortsSupported – Flag whether this filter supports dynamic input ports

  • dynOutPortsSupported – Flag whether this filter supports dynamic output ports

  • environment – FilterEnvironment instance which shall be passed through from the filter constructor.

currentTimestampChanged
getNameFilter()[source]

Returns the name filter associated with the input files.

Returns:

a list of strings, e.g. [”.h5”, “.hdf5”]

onClose()[source]

overloaded from Filter

Returns:

onOpen()[source]

overloaded from Filter

Returns:

onStart()[source]

overloaded from Filter

Returns:

onStop()[source]

overloaded from Filter

Returns:

onSuggestDynamicPorts()[source]

overloaded from Filter

Returns:

openFile(filename)[source]

Opens the given file and return an instance of GenericReaderFile.

Returns:

an instance of GenericReaderFile

pausePlayback()[source]

slot called when the playback shall be paused

Returns:

playbackPaused
playbackStarted
seekBeginning()[source]

slot called to go to the beginning of the file

Returns:

seekEnd()[source]

slot called to go to the end of the file

Returns:

seekTime(timestamp)[source]

slot called to go to the specified time

Parameters:

timestamp – a timestamp in nanosecond resolution

Returns:

sequenceOpened
setSequence(filename)[source]

slot called to set the sequence file name

Parameters:

filename – a string instance

Returns:

setTimeFactor(factor)[source]

slot called to set the time factor

Parameters:

factor – a float

Returns:

startPlayback()[source]

slot called when the playback shall be started

Returns:

staticMetaObject = PySide6.QtCore.QMetaObject("GenericReader" inherits "Filter": Methods:   #4 type=Signal, signature=playbackStarted()   #5 type=Signal, signature=playbackPaused()   #6 type=Signal, signature=sequenceOpened(QString,qlonglong,qlonglong,QVariantList), parameters=QString, qlonglong, qlonglong, QVariantList   #7 type=Signal, signature=currentTimestampChanged(qlonglong), parameters=qlonglong   #8 type=Signal, signature=timeRatioChanged(double), parameters=double )
stepBackward(stream)[source]

slot called to step one frame in stream backward

Parameters:

stream – a string instance or None (all streams are selected)

Returns:

stepForward(stream)[source]

slot called to step one frame in stream forward

Parameters:

stream – a string instance or None (all streams are selected)

Returns:

timeRatioChanged
class nexxT.filters.GenericReader.GenericReaderFile[source]

Bases: object

Interface for adaptations of new file formats.

For supporting new file formats, inherit from this class and overwrite all of the methods listed here. The constructor of the inherited class usually takes a filename argument. Inherit also from GenericReader to provide a new Filter class and overwrite the methods getNameFilter and openFile, which returns an instance of the GenericReaderFile implementation.

See nexxT.filters.hdf5.Hdf5File and nexxT.filters.hdf5.Hdf5Reader for an example.

allStreams()[source]

Returns the streams in this file.

Returns:

a list of strings

close()[source]

Closes the file.

Returns:

getNumberOfSamples(stream)[source]

Returns the number of samples in the given stream

Parameters:

stream – the name of the stream as a string

Returns:

the number of samples in the stream

getRcvTimestamp(stream, streamIdx)[source]

Returns the recevie timestamp of the given (stream, streamIdx) sample. The default implementation uses readSample(…). It may be replaced by a more efficient implementation.

Parameters:
  • stream – the name of the stream as a string

  • streamIdx – the stream index as an integer

Returns:

the timestamp as an integer (see also getTimestampResolution)

getTimestampResolution()[source]

Returns the resolution of the timestamps in ticks per second.

Returns:

ticks per second as an integer

readSample(stream, streamIdx)[source]

Returns the referenced sample as a tuple (content, dataType, dataTimestamp, rcvTimestamp).

Parameters:
  • stream – the stream

  • idx – the index of the sample in the stream

Returns:

(content: QByteArray, dataType: str, dataTimestamp: int, receiveTimestamp: int)