Skip to content

Labview64¤

Communicates with the labview_lib library via the Labview32 class that is running on a server.

Attention

This example requires that a 32-bit LabVIEW Run-Time Engine ≥ 2017 is installed and that the operating system is Windows.

Labview64 ¤

Labview64()

Bases: Client64

Communicates with a 32-bit LabVIEW library, labview_lib.

This class demonstrates how to communicate with a 32-bit LabVIEW library if an instance of this class is created within a 64-bit Python interpreter.

Source code in src/msl/examples/loadlib/labview64.py
23
24
25
26
27
28
29
30
31
def __init__(self) -> None:
    """Communicates with a 32-bit LabVIEW library, [labview_lib][labview-lib].

    This class demonstrates how to communicate with a 32-bit LabVIEW library if an
    instance of this class is created within a 64-bit Python interpreter.
    """
    # specify the name of the corresponding 32-bit server module, labview32, which hosts
    # the 32-bit LabVIEW library -- labview_lib32.dll
    super().__init__(module32="labview32", append_sys_path=Path(__file__).parent)

stdev ¤

stdev(x, weighting=0)

Calculates the mean, variance and standard deviation of the values in the input x.

See the corresponding Labview32.stdev method.

Parameters:

Name Type Description Default
x Sequence[float]

The data to calculate the mean, variance and standard deviation of.

required
weighting int

Whether to calculate the sample (weighting = 0) or the population (weighting = 1) standard deviation and variance.

0

Returns:

Type Description
tuple[float, float, float]

The mean, variance and standard deviation.

Source code in src/msl/examples/loadlib/labview64.py
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
def stdev(self, x: Sequence[float], weighting: int = 0) -> tuple[float, float, float]:
    """Calculates the mean, variance and standard deviation of the values in the input `x`.

    See the corresponding [Labview32.stdev][msl.examples.loadlib.labview32.Labview32.stdev] method.

    Args:
        x: The data to calculate the mean, variance and standard deviation of.
        weighting: Whether to calculate the sample (`weighting = 0`) or the
            population (`weighting = 1`) standard deviation and variance.

    Returns:
        The mean, variance and standard deviation.
    """
    if weighting not in {0, 1}:
        msg = f"The weighting must be either 0 or 1, got {weighting}"
        raise ValueError(msg)

    reply: tuple[float, float, float] = self.request32("stdev", x, weighting)
    return reply