redvox.api900.sensors.light_sensor API documentation
Description: This module contains classes and methods for working with light sensors.

# Module `redvox.api900.sensors.light_sensor`

This module contains classes and methods for working with light sensors.

Expand source code

    """
    This module contains classes and methods for working with light sensors.
    """

    import typing

    import numpy

    import redvox.api900.constants as constants
    import redvox.api900.lib.api900_pb2 as api900_pb2
    from redvox.api900.sensors.unevenly_sampled_channel import UnevenlySampledChannel
    from redvox.api900.sensors.unevenly_sampled_sensor import UnevenlySampledSensor

    class LightSensor(UnevenlySampledSensor):
        """High-level wrapper around light channels."""

        def __init__(self, unevenly_sampled_channel: UnevenlySampledChannel = None):
            """
            Initializes this class
            :param unevenly_sampled_channel: Instance of UnevenlySampledChannel with light sensor payload
            """
            super().__init__(unevenly_sampled_channel)
            self._unevenly_sampled_channel.set_channel_types([api900_pb2.LIGHT])

        def payload_values(self) -> numpy.ndarray:
            """
            Returns a numpy ndarray of floats representing this light sensor's payload.
            :return: A numpy ndarray of floats representing this light sensor's payload.
            """
            return self._unevenly_sampled_channel.get_payload(api900_pb2.LIGHT)

        def set_payload_values(self, values: typing.Union[typing.List[float], numpy.ndarray]) -> 'LightSensor':
            """
            Sets this channel's payload values.
            :param values: Payload values.
            :return: An instance of the sensor.
            """
            self._unevenly_sampled_channel.set_payload(values, constants.PayloadType.FLOAT64_PAYLOAD)
            return self

        def payload_mean(self) -> float:
            """
            The mean of this channel's payload.
            :return: Mean of this channel's payload.
            """
            return self._unevenly_sampled_channel.get_value_mean(api900_pb2.LIGHT)

        def payload_median(self) -> float:
            """
            The median of this channel's payload.
            :return: Median of this channel's payload.
            """
            return self._unevenly_sampled_channel.get_value_median(api900_pb2.LIGHT)

        def payload_std(self) -> float:
            """
            The standard deviation of this channel's payload.
            :return: Standard deviation of this channel's payload.
            """
            return self._unevenly_sampled_channel.get_value_std(api900_pb2.LIGHT)

## Classes

`class LightSensor (unevenly_sampled_channel: UnevenlySampledChannel = None)`

  High-level wrapper around light channels.

  Initializes this class :param unevenly_sampled_channel: Instance of UnevenlySampledChannel with light sensor payload

  Expand source code

      class LightSensor(UnevenlySampledSensor):
          """High-level wrapper around light channels."""

          def __init__(self, unevenly_sampled_channel: UnevenlySampledChannel = None):
              """
              Initializes this class
              :param unevenly_sampled_channel: Instance of UnevenlySampledChannel with light sensor payload
              """
              super().__init__(unevenly_sampled_channel)
              self._unevenly_sampled_channel.set_channel_types([api900_pb2.LIGHT])

          def payload_values(self) -> numpy.ndarray:
              """
              Returns a numpy ndarray of floats representing this light sensor's payload.
              :return: A numpy ndarray of floats representing this light sensor's payload.
              """
              return self._unevenly_sampled_channel.get_payload(api900_pb2.LIGHT)

          def set_payload_values(self, values: typing.Union[typing.List[float], numpy.ndarray]) -> 'LightSensor':
              """
              Sets this channel's payload values.
              :param values: Payload values.
              :return: An instance of the sensor.
              """
              self._unevenly_sampled_channel.set_payload(values, constants.PayloadType.FLOAT64_PAYLOAD)
              return self

          def payload_mean(self) -> float:
              """
              The mean of this channel's payload.
              :return: Mean of this channel's payload.
              """
              return self._unevenly_sampled_channel.get_value_mean(api900_pb2.LIGHT)

          def payload_median(self) -> float:
              """
              The median of this channel's payload.
              :return: Median of this channel's payload.
              """
              return self._unevenly_sampled_channel.get_value_median(api900_pb2.LIGHT)

          def payload_std(self) -> float:
              """
              The standard deviation of this channel's payload.
              :return: Standard deviation of this channel's payload.
              """
              return self._unevenly_sampled_channel.get_value_std(api900_pb2.LIGHT)

  ### Ancestors

  - UnevenlySampledSensor

  ### Methods

  `def payload_mean(self) ‑> float`

    The mean of this channel's payload. :return: Mean of this channel's payload.

    Expand source code

        def payload_mean(self) -> float:
            """
            The mean of this channel's payload.
            :return: Mean of this channel's payload.
            """
            return self._unevenly_sampled_channel.get_value_mean(api900_pb2.LIGHT)

  `def payload_median(self) ‑> float`

    The median of this channel's payload. :return: Median of this channel's payload.

    Expand source code

        def payload_median(self) -> float:
            """
            The median of this channel's payload.
            :return: Median of this channel's payload.
            """
            return self._unevenly_sampled_channel.get_value_median(api900_pb2.LIGHT)

  `def payload_std(self) ‑> float`

    The standard deviation of this channel's payload. :return: Standard deviation of this channel's payload.

    Expand source code

        def payload_std(self) -> float:
            """
            The standard deviation of this channel's payload.
            :return: Standard deviation of this channel's payload.
            """
            return self._unevenly_sampled_channel.get_value_std(api900_pb2.LIGHT)

  `def payload_values(self) ‑> numpy.ndarray`

    Returns a numpy ndarray of floats representing this light sensor's payload. :return: A numpy ndarray of floats representing this light sensor's payload.

    Expand source code

        def payload_values(self) -> numpy.ndarray:
            """
            Returns a numpy ndarray of floats representing this light sensor's payload.
            :return: A numpy ndarray of floats representing this light sensor's payload.
            """
            return self._unevenly_sampled_channel.get_payload(api900_pb2.LIGHT)

  `def set_payload_values(self, values: Union[List[float], numpy.ndarray]) ‑> LightSensor`

    Sets this channel's payload values. :param values: Payload values. :return: An instance of the sensor.

    Expand source code

        def set_payload_values(self, values: typing.Union[typing.List[float], numpy.ndarray]) -> 'LightSensor':
            """
            Sets this channel's payload values.
            :param values: Payload values.
            :return: An instance of the sensor.
            """
            self._unevenly_sampled_channel.set_payload(values, constants.PayloadType.FLOAT64_PAYLOAD)
            return self

  ### Inherited members

  - `UnevenlySampledSensor`:
    - `diff`
    - `metadata`
    - `metadata_as_dict`
    - `payload_type`
    - `sample_interval_mean`
    - `sample_interval_median`
    - `sample_interval_std`
    - `sensor_name`
    - `set_metadata`
    - `set_metadata_as_dict`
    - `set_sensor_name`
    - `set_timestamps_microseconds_utc`
    - `timestamps_microseconds_utc`