fix antenna order post refactor
This commit is contained in:
parent
66c893b50b
commit
990baee908
@ -7,6 +7,7 @@ from typing import Any, Callable, NamedTuple
|
|||||||
import numpy.typing as npt
|
import numpy.typing as npt
|
||||||
|
|
||||||
from where_fi.collection import CSIMatrix, ingest
|
from where_fi.collection import CSIMatrix, ingest
|
||||||
|
from where_fi.collection.csi_frame import CSI
|
||||||
from where_fi.collection.protocols import CSIProducer, MergedCSI
|
from where_fi.collection.protocols import CSIProducer, MergedCSI
|
||||||
from where_fi.config import config
|
from where_fi.config import config
|
||||||
from where_fi.processing.preprocess import Preprocessor
|
from where_fi.processing.preprocess import Preprocessor
|
||||||
@ -125,12 +126,13 @@ class CSIApplication:
|
|||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
def on_pre_merge(
|
def on_pre_merge(
|
||||||
self,
|
self, func: Callable[[dict[ingest.Host, CSI]], None]
|
||||||
) -> Callable[[Callable[[dict[ingest.Host, ingest.CSI]], None]], None]:
|
) -> Callable[[dict[ingest.Host, CSI]], None]:
|
||||||
def decorator(func: Callable[[dict[ingest.Host, ingest.CSI]], None]) -> None:
|
"""
|
||||||
|
Decorator to register a callback for the samples before merging.
|
||||||
|
"""
|
||||||
self.pre_merge_callback = func
|
self.pre_merge_callback = func
|
||||||
|
return func
|
||||||
return decorator
|
|
||||||
|
|
||||||
def on_process(
|
def on_process(
|
||||||
self, func: Callable[[CSIMatrix], None]
|
self, func: Callable[[CSIMatrix], None]
|
||||||
|
|||||||
@ -2,6 +2,8 @@ import logging
|
|||||||
from collections import deque
|
from collections import deque
|
||||||
from typing import Any, Collection
|
from typing import Any, Collection
|
||||||
|
|
||||||
|
from where_fi.application import CSIApplication
|
||||||
|
|
||||||
from ..collection import ingest
|
from ..collection import ingest
|
||||||
from ..config import config
|
from ..config import config
|
||||||
|
|
||||||
@ -32,6 +34,10 @@ def average(data: Collection[Any]) -> float:
|
|||||||
return sum(data) / len(data)
|
return sum(data) / len(data)
|
||||||
|
|
||||||
|
|
||||||
|
app = CSIApplication(ingest.RealtimeCSIProducer())
|
||||||
|
|
||||||
|
|
||||||
|
@app.on_pre_merge
|
||||||
def callback(antenna_data: dict[ingest.Host, ingest.CSI]) -> None:
|
def callback(antenna_data: dict[ingest.Host, ingest.CSI]) -> None:
|
||||||
global prev_unplugged
|
global prev_unplugged
|
||||||
global antenna_average
|
global antenna_average
|
||||||
@ -73,4 +79,4 @@ def callback(antenna_data: dict[ingest.Host, ingest.CSI]) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
ingest.start_processing(pre_merge_callback=callback)
|
app.start()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user