Skip to content

Sample rate monitoring

This class is accessed via the rate property on a CamillaClient instance.

It provides methods for reading the output of the sample rate monitoring.

class: RateMonitor

Bases: _CommandGroup

Methods for rate monitoring

Source code in camilladsp/camilladsp.py
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
class RateMonitor(_CommandGroup):
    """
    Methods for rate monitoring
    """

    def capture_raw(self) -> int:
        """
        Get current capture rate, raw value.

        Returns:
            int: The current raw capture rate.
        """
        rate = self.client.query("GetCaptureRate")
        return int(rate)

    def capture(self) -> Optional[int]:
        """
        Get current capture rate.
        Returns the nearest common rate, as long as it's within +-4% of the measured value.

        Returns:
            int: The current capture rate.
        """
        rate = self.capture_raw()
        if 0.96 * _STANDARD_RATES[0] < rate < 1.04 * _STANDARD_RATES[-1]:
            nearest = min(_STANDARD_RATES, key=lambda val: abs(val - rate))
            if 0.96 < rate / nearest < 1.04:
                return nearest
        return None

capture()

Get current capture rate. Returns the nearest common rate, as long as it's within +-4% of the measured value.

Returns:

Name Type Description
int Optional[int]

The current capture rate.

Source code in camilladsp/camilladsp.py
689
690
691
692
693
694
695
696
697
698
699
700
701
702
def capture(self) -> Optional[int]:
    """
    Get current capture rate.
    Returns the nearest common rate, as long as it's within +-4% of the measured value.

    Returns:
        int: The current capture rate.
    """
    rate = self.capture_raw()
    if 0.96 * _STANDARD_RATES[0] < rate < 1.04 * _STANDARD_RATES[-1]:
        nearest = min(_STANDARD_RATES, key=lambda val: abs(val - rate))
        if 0.96 < rate / nearest < 1.04:
            return nearest
    return None

capture_raw()

Get current capture rate, raw value.

Returns:

Name Type Description
int int

The current raw capture rate.

Source code in camilladsp/camilladsp.py
679
680
681
682
683
684
685
686
687
def capture_raw(self) -> int:
    """
    Get current capture rate, raw value.

    Returns:
        int: The current raw capture rate.
    """
    rate = self.client.query("GetCaptureRate")
    return int(rate)