Skip to content

Commit

Permalink
feat(multiwave): Added multiwave generator to metrological_streams.py
Browse files Browse the repository at this point in the history
  • Loading branch information
anupam-prasad committed Mar 11, 2021
1 parent 035d7c9 commit 7b0bf4e
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions agentMET4FOF/metrological_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ class MetrologicalDataStreamMET4FOF(DataStreamMET4FOF):
"""

def __init__(
self,
value_unc: Union[float, Iterable[float]] = 0.0,
time_unc: Union[float, Iterable[float]] = 0.0,
self,
value_unc: Union[float, Iterable[float]] = 0.0,
time_unc: Union[float, Iterable[float]] = 0.0,
):
"""Initialize a MetrologicalDataStreamMET4FOF object
Expand All @@ -68,11 +68,11 @@ def __init__(
self._time_unc: Union[float, Iterable[float]] = time_unc

def set_generator_function(
self,
generator_function: Callable = None,
uncertainty_generator: Callable = None,
sfreq: int = None,
**kwargs: Optional[Any]
self,
generator_function: Callable = None,
uncertainty_generator: Callable = None,
sfreq: int = None,
**kwargs: Optional[Any]
) -> Callable:
"""
Set value and uncertainty generators based on user-defined functions. By
Expand Down Expand Up @@ -125,9 +125,9 @@ def set_generator_function(
return self._generator_function_unc

def _default_uncertainty_generator(
self,
time: Union[List, pd.DataFrame, np.ndarray],
values: Union[List, pd.DataFrame, np.ndarray],
self,
time: Union[List, pd.DataFrame, np.ndarray],
values: Union[List, pd.DataFrame, np.ndarray],
) -> Tuple[np.ndarray, np.ndarray]:
"""Default (standard) uncertainty generator function
Expand Down Expand Up @@ -155,10 +155,10 @@ def _next_sample_generator(self, batch_size: int = 1) -> np.ndarray:
time uncertainty ``ut`` and measurement uncertainty ``uv`` to sample
"""
_time: np.ndarray = (
np.arange(self._sample_idx, self._sample_idx + batch_size, 1.0).reshape(
-1, 1
)
/ self.sfreq
np.arange(self._sample_idx, self._sample_idx + batch_size, 1.0).reshape(
-1, 1
)
/ self.sfreq
)
self._sample_idx += batch_size

Expand Down Expand Up @@ -220,17 +220,17 @@ class MetrologicalSineGenerator(MetrologicalDataStreamMET4FOF):
"""

def __init__(
self,
sfreq: int = 500,
sine_freq: float = 50,
device_id: str = "SineGenerator",
time_name: str = "time",
time_unit: str = "s",
quantity_names: Union[str, Tuple[str, ...]] = "Voltage",
quantity_units: Union[str, Tuple[str, ...]] = "V",
misc: Optional[Any] = "Simple sine wave generator",
value_unc: Union[float, Iterable[float]] = 0.1,
time_unc: Union[float, Iterable[float]] = 0,
self,
sfreq: int = 500,
sine_freq: float = 50,
device_id: str = "SineGenerator",
time_name: str = "time",
time_unit: str = "s",
quantity_names: Union[str, Tuple[str, ...]] = "Voltage",
quantity_units: Union[str, Tuple[str, ...]] = "V",
misc: Optional[Any] = "Simple sine wave generator",
value_unc: Union[float, Iterable[float]] = 0.1,
time_unc: Union[float, Iterable[float]] = 0,
):
super(MetrologicalSineGenerator, self).__init__(
value_unc=value_unc, time_unc=time_unc
Expand Down

0 comments on commit 7b0bf4e

Please sign in to comment.