Skip to content

qass.tools.analyzer.search_indicator

Classes:

Name Description
SearchIndicator

The class SearchIndicator provides a simple interface to update Search info markers in the OpenGL area.

SearchIndicator

The class SearchIndicator provides a simple interface to update Search info markers in the OpenGL area. Each SearchIndicator instance creates its own rectangle that will be displayed.

A search info rectangle can be useful to display the progress of the analysis for the current process.

Methods:

Name Description
__init__

Constructor for SearchIndicator.

process_init

The function process_init resets the internal state of the object.

tick

The function tick has to bee called in every iteration of the operator network during the phase process_run().

Source code in src/qass/tools/analyzer/search_indicator.py
class SearchIndicator:
    """
    The class SearchIndicator provides a simple interface to update Search info markers in the OpenGL area.
    Each SearchIndicator instance creates its own rectangle that will be displayed.

    A search info rectangle can be useful to display the progress of the analysis for the current process.
    """

    def __init__(
        self,
        rti: RunTimeInfo_IF,
        out_connector: ConnectorOut_Py_IF,
        duration_ns: int = 1e6,
        label: str = "analysis",
        start_fband: Union[int, None] = None,
        end_fband: Union[int, None] = None,
    ) -> None:
        """
        Constructor for SearchIndicator.

        Parameters
        ----------
        rti : RunTimeInfo_IF
            The runtime information object of the operator network. It provides information about the current analysis.
        out_connector : ConnectorOut_Py_IF
            The connector object of type Search Info that can handle and propagate the created SearchInfo_IF() objet.
        duration_ns : int
            duration of the analysis window (This is the width of the displayed rectangle).
        label : str
            An arbitrary string - displayed next to the rectangle in the OpenGL area.
        start_fband : int, optional
            Optional index for the first frequency band covered by the rectangle.
        end_fband : int, optional
            Optional index for the first frequency band covered by the rectangle.
        """
        self._stream = None
        self._rti = rti
        self._label = label
        self._duration = duration_ns
        self._ref_id = random.randint(1, 2 ^ 31 - 1)
        self._out_connector = out_connector
        self._start_fband = start_fband
        self._end_fband = end_fband

    def process_init(self, stream: Buffer_Py_IF):
        """
        The function process_init resets the internal state of the object.
        It creates a new instance of type SearchInfo_IF fitting the new stream.
        """
        self._stream = stream

        self._si = SearchInfo_IF()
        self._si.setSearchBuffer(self._stream)
        self._si.setDuration(int(self._duration))
        self._si.setLabel(self._label)
        self._si.setRefID(int(self._ref_id))
        self._si.setFStartHz(
            stream.getLowFrequency()
            if not self._start_fband
            else self._start_fband * stream.getFrqPerBand()
        )
        self._si.setFEndHz(
            stream.getHighFrequency()
            if not self._end_fband
            else self._end_fband * stream.getFrqPerBand()
        )

    def tick(self):
        """
        The function tick has to bee called in every iteration of the operator network during the phase process_run().
        """
        self._si.setTrackingTime(self._rti.getCurrentTime())
        self._out_connector.setOutputValue(self._si)

__init__

__init__(rti: RunTimeInfo_IF, out_connector: ConnectorOut_Py_IF, duration_ns: int = 1000000.0, label: str = 'analysis', start_fband: Union[int, None] = None, end_fband: Union[int, None] = None) -> None

Constructor for SearchIndicator.

Parameters:

Name Type Description Default
rti RunTimeInfo_IF

The runtime information object of the operator network. It provides information about the current analysis.

required
out_connector ConnectorOut_Py_IF

The connector object of type Search Info that can handle and propagate the created SearchInfo_IF() objet.

required
duration_ns int

duration of the analysis window (This is the width of the displayed rectangle).

1000000.0
label str

An arbitrary string - displayed next to the rectangle in the OpenGL area.

'analysis'
start_fband int

Optional index for the first frequency band covered by the rectangle.

None
end_fband int

Optional index for the first frequency band covered by the rectangle.

None
Source code in src/qass/tools/analyzer/search_indicator.py
def __init__(
    self,
    rti: RunTimeInfo_IF,
    out_connector: ConnectorOut_Py_IF,
    duration_ns: int = 1e6,
    label: str = "analysis",
    start_fband: Union[int, None] = None,
    end_fband: Union[int, None] = None,
) -> None:
    """
    Constructor for SearchIndicator.

    Parameters
    ----------
    rti : RunTimeInfo_IF
        The runtime information object of the operator network. It provides information about the current analysis.
    out_connector : ConnectorOut_Py_IF
        The connector object of type Search Info that can handle and propagate the created SearchInfo_IF() objet.
    duration_ns : int
        duration of the analysis window (This is the width of the displayed rectangle).
    label : str
        An arbitrary string - displayed next to the rectangle in the OpenGL area.
    start_fband : int, optional
        Optional index for the first frequency band covered by the rectangle.
    end_fband : int, optional
        Optional index for the first frequency band covered by the rectangle.
    """
    self._stream = None
    self._rti = rti
    self._label = label
    self._duration = duration_ns
    self._ref_id = random.randint(1, 2 ^ 31 - 1)
    self._out_connector = out_connector
    self._start_fband = start_fband
    self._end_fband = end_fband

process_init

process_init(stream: Buffer_Py_IF)

The function process_init resets the internal state of the object. It creates a new instance of type SearchInfo_IF fitting the new stream.

Source code in src/qass/tools/analyzer/search_indicator.py
def process_init(self, stream: Buffer_Py_IF):
    """
    The function process_init resets the internal state of the object.
    It creates a new instance of type SearchInfo_IF fitting the new stream.
    """
    self._stream = stream

    self._si = SearchInfo_IF()
    self._si.setSearchBuffer(self._stream)
    self._si.setDuration(int(self._duration))
    self._si.setLabel(self._label)
    self._si.setRefID(int(self._ref_id))
    self._si.setFStartHz(
        stream.getLowFrequency()
        if not self._start_fband
        else self._start_fband * stream.getFrqPerBand()
    )
    self._si.setFEndHz(
        stream.getHighFrequency()
        if not self._end_fband
        else self._end_fband * stream.getFrqPerBand()
    )

tick

tick()

The function tick has to bee called in every iteration of the operator network during the phase process_run().

Source code in src/qass/tools/analyzer/search_indicator.py
def tick(self):
    """
    The function tick has to bee called in every iteration of the operator network during the phase process_run().
    """
    self._si.setTrackingTime(self._rti.getCurrentTime())
    self._out_connector.setOutputValue(self._si)