29 lines
701 B
Python
29 lines
701 B
Python
import logging
|
|
from datetime import datetime
|
|
from pathlib import Path
|
|
|
|
import h5py
|
|
import numpy as np
|
|
import numpy.typing as npt
|
|
import typer
|
|
|
|
from . import globals
|
|
|
|
|
|
app = typer.Typer()
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
@app.command()
|
|
def capture(output_path: Path) -> None:
|
|
"""Capture CSI data to a file"""
|
|
logger.info(f"Capturing data to {output_path}")
|
|
|
|
with h5py.File(output_path, "w") as file:
|
|
|
|
def callback(antenna_data: npt.NDArray[np.complex128]) -> None:
|
|
logger.info(f"Got final CSI data with shape {antenna_data.shape}")
|
|
file.create_dataset(datetime.now().isoformat(), data=antenna_data)
|
|
|
|
globals.csi_producer(csi_callback=callback)
|