fix: add numpy and scipy to dynamic_pseudo
This commit is contained in:
parent
45f5c871ad
commit
b66b224cae
3
.gitignore
vendored
3
.gitignore
vendored
@ -11,6 +11,9 @@
|
|||||||
# file writer data
|
# file writer data
|
||||||
**.h5
|
**.h5
|
||||||
|
|
||||||
|
# ignore recover_config files
|
||||||
|
recovery_config*
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
This module provides a class for creating a pseudo signal that is computed from other signals.
|
This module provides a class for creating a pseudo signal that is computed from other signals.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import numpy
|
||||||
|
import scipy
|
||||||
|
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
@ -70,7 +73,18 @@ class ComputedSignal(SignalRO):
|
|||||||
@property
|
@property
|
||||||
def compute_method(self) -> Callable | None:
|
def compute_method(self) -> Callable | None:
|
||||||
"""
|
"""
|
||||||
Set the compute method for the pseudo signal
|
Property that returns the compute method for the pseudo signal.
|
||||||
|
Example:
|
||||||
|
>>> signal.compute_method = "def test(a, b): return a.get() + b.get()"
|
||||||
|
|
||||||
|
"""
|
||||||
|
return self._compute_method_str
|
||||||
|
|
||||||
|
@compute_method.setter
|
||||||
|
def compute_method(self, method: str):
|
||||||
|
"""
|
||||||
|
Set the compute method for the pseudo signal. We import numpy and scipy as packages
|
||||||
|
that are also available for user to use in their compute method.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
compute_method (str): The compute method to be used. This should be a string
|
compute_method (str): The compute method to be used. This should be a string
|
||||||
@ -81,10 +95,6 @@ class ComputedSignal(SignalRO):
|
|||||||
>>> signal.compute_method = "def test(a, b): return a.get() + b.get()"
|
>>> signal.compute_method = "def test(a, b): return a.get() + b.get()"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self._compute_method_str
|
|
||||||
|
|
||||||
@compute_method.setter
|
|
||||||
def compute_method(self, method: str):
|
|
||||||
logger.info(f"Updating compute method for {self.name}.")
|
logger.info(f"Updating compute method for {self.name}.")
|
||||||
method = method.strip()
|
method = method.strip()
|
||||||
if not method.startswith("def"):
|
if not method.startswith("def"):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user