wavetools¶
Submodules¶
Classes¶
Scan metadata reported by WaveAnalyzer. |
|
WaveAnalyzer scan data class. |
|
WaveAnalyzer base class. This is an abstract class which should not be instantiated directly. Use create_waveanalyzer() factory function to create device-specific instances. |
|
WaveAnalyzer1500S device class. This class implements the specific methods for the 1500S model. |
|
WaveAnalyzer200A device class. This class implements the specific methods for the 200A model. |
|
WaveAnalyzer400A device class. This class implements the specific methods for the 400A model. |
|
WaveAnalyzer1500B device class. This class implements the specific methods for the 1500B model. |
Functions¶
|
Factory method to create model-specific WaveAnalyzer instance. |
Package Contents¶
- class wavetools.WAScanInfo(/, **data: Any)¶
Bases:
pydantic.BaseModelScan metadata reported by WaveAnalyzer.
- scanid: int¶
- center: int¶
- span: int¶
- startfreq: int¶
- stopfreq: int¶
- port: str¶
- class wavetools.WAScan(/, **data: Any)¶
Bases:
pydantic.BaseModelWaveAnalyzer scan data class.
- scanid: int¶
- is_valid: bool¶
- power_unit: str = 'mW'¶
- frequency_unit: str = 'MHz'¶
- rbw: float¶
- data: numpy.ndarray = None¶
- metadata: dict = None¶
- model_config¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod check_data_structure(v)¶
Validate the structure of the data field.
- Args:
v: The value to validate.
- Returns:
The validated value.
- Raises:
ValueError: If the value is not a numpy array or has an incorrect dtype.
- classmethod check_metadata_structure(v)¶
Validate the structure of the metadata field.
- Args:
v: The value to validate.
- Returns:
The validated value.
- Raises:
ValueError: If the value is not a dictionary.
- property frequency_THz: numpy.ndarray¶
Convert frequency from MHz to THz.
- Returns:
np.ndarray: Frequency in THz.
- property power_dBm: numpy.ndarray¶
Convert power from mW to dBm.
- Returns:
np.ndarray: Power in dBm.
- property power_mW: numpy.ndarray¶
Return power in mW.
- Returns:
np.ndarray: Power in mW.
- property power_x_pol_dBm: numpy.ndarray¶
Convert power from mW to dBm for X-Polarization.
- Returns:
np.ndarray: Power in dBm for X-Polarization.
- property power_x_pol_mW: numpy.ndarray¶
Return power in mW for X-Polarization.
- Returns:
np.ndarray: Power in mW for X-Polarization.
- property power_y_pol_dBm: numpy.ndarray¶
Convert power from mW to dBm for Y-Polarization.
- Returns:
np.ndarray: Power in dBm for Y-Polarization.
- property power_y_pol_mW: numpy.ndarray¶
Return power in mW for Y-Polarization.
- Returns:
np.ndarray: Power in mW for Y-Polarization.
- property flags: numpy.ndarray¶
Return flags as a numpy array.
- Returns:
np.ndarray: Flags.
- class wavetools.WaveAnalyzer(address: str, preset: bool = True)¶
Bases:
abc.ABCWaveAnalyzer base class. This is an abstract class which should not be instantiated directly. Use create_waveanalyzer() factory function to create device-specific instances. This class defines the common interface for all WaveAnalyzer devices. It provides methods for connecting to the device, configuring scans, and retrieving scan data.
- classmethod get_model(address: str) str¶
Get the model name of the WaveAnalyzer device at the given address.
- Args:
address (str): The network address of the device.
- Returns:
str: The model name of the device (e.g., “1500S”, “WA400A”).
- Raises:
httpx.RequestError: If the HTTP request fails. json.JSONDecodeError: If the response is not valid JSON. KeyError: If the ‘model’ key is missing in the response.
- base_url = 'http://Uninferable/wanl'¶
- model¶
- serial_number¶
- version¶
- vendor¶
- abstract get_scan_modes() list[str]¶
Get the list of available scan modes. Returns:
list[str]: List of available scan modes. “Normal” is guranteed to be supported by all models
- set_scan(center: int = _default_center, span: int | Literal['full'] = 'full', scan_mode: str | None = None) bool¶
Configure the device to perform a scan.
- Args:
center (int): Center frequency in MHz. span (Union[int, “full”]): Span in MHz or “full”. scan_mode (str, optional): Optional scan mode identifier (e.g., “Normal”). This method may raise an error (model-specific) if the scan mode is not recognized. The scan modes are model-specific, but “Normal” is guaranteed to work.
- Returns:
bool: True if the scan was successfully configured, False otherwise.
- property scan_info: WAScanInfo¶
Get information about the current scan.
- Returns:
WAScanInfo: Information about the current scan.
- abstract measure(force_new: bool = False) WAScan¶
Fetch measurement data from the device.
- Args:
- force_new (bool): If True, the returned measurement is guaranteed
to be captured after this function call. If False, the device may return a previously captured scan if available.
- Returns:
WAScan: Measurement data.
- class wavetools.WaveAnalyzer1500S(address: str, preset: bool = True)¶
Bases:
WaveAnalyzerWaveAnalyzer1500S device class. This class implements the specific methods for the 1500S model.
- scanmodes¶
- rbw = 150¶
- get_scan_modes() list[str]¶
Get the list of available scan modes for the 1500S model.
- Returns:
list[str]: List of available scan modes.
- class wavetools.WaveAnalyzer200A(address: str, preset: bool = True)¶
Bases:
_WaveAnalyzerNewAPIWaveAnalyzer200A device class. This class implements the specific methods for the 200A model. Note that WaveAnalyzer200A has a fixed scan profile and does not support scan mode changes.
- get_scan_modes() list[str]¶
Get the list of available scan modes. Returns:
list[str]: List of available scan modes. “Normal” is guranteed to be supported by all models
- set_scan(center: int = 193700000, span: int | Literal['full'] = 'full', scan_mode: str | None = None) bool¶
WaveAnalyzer200A has a fixed scan profile, therefore, only supports full scans. This method ignores center and scan_mode parameters.
- class wavetools.WaveAnalyzer400A(address: str, preset: bool = True)¶
Bases:
_WaveAnalyzerNewAPIWaveAnalyzer400A device class. This class implements the specific methods for the 400A model.
- scanmodes¶
- get_scan_modes() list[str]¶
Get the list of available scan modes for the 400A model.
- Returns:
list[str]: List of available scan modes.
- class wavetools.WaveAnalyzer1500B(address: str, preset: bool = True)¶
Bases:
_WaveAnalyzerNewAPIWaveAnalyzer1500B device class. This class implements the specific methods for the 1500B model.
- scanmodes¶
- get_scan_modes() list[str]¶
Get the list of available scan modes for the 1500B model.
- Returns:
list[str]: List of available scan modes.
- wavetools.create_waveanalyzer(address: str, preset: bool = True) WaveAnalyzer¶
Factory method to create model-specific WaveAnalyzer instance.
- Args:
address (str): Device network address (e.g., “wa000186.local”). preset (bool): If True, the device is set default scan profile.
- Returns:
WaveAnalyzerAPI: Instance of the appropriate API class.