Pattern I/O Module

The pattern_io module provides utilities for reading and writing antenna radiation pattern data in various formats.

spacelink.core.pattern_io.load_radiation_pattern_npz(source)[source]

Load a radiation pattern from a NumPy NPZ file or file-like object.

Parameters:

source (pathlib.Path or file-like object) – Path to the NPZ file containing the radiation pattern data, or a file-like object (such as BytesIO) containing NPZ data. This allows loading from files, databases, or in-memory buffers.

Returns:

A new RadiationPattern object reconstructed from the saved data.

Return type:

RadiationPattern

Raises:
  • FileNotFoundError – If the specified file does not exist (when source is a path).

  • KeyError – If required keys are missing from the NPZ file.

spacelink.core.pattern_io.save_radiation_pattern_npz(pattern, destination)[source]

Save the radiation pattern data to a NumPy NPZ file or file-like object.

Parameters:
  • pattern (RadiationPattern) – The radiation pattern to save.

  • destination (pathlib.Path or file-like object) – Path to the output NPZ file, or a file-like object (such as BytesIO) to write NPZ data to. This allows saving to files, databases, or in-memory buffers.

Return type:

None

spacelink.core.pattern_io.import_hfss_csv(hfss_csv_path, *, carrier_frequency, rad_efficiency)[source]

Create a radiation pattern from an HFSS exported CSV file.

This expects the CSV file to contain the following columns in any order: - Freq [GHz] - Theta [deg] - Phi [deg] - dB(RealizedGainLHCP) [] - dB(RealizedGainRHCP) [] - ang_deg(rELHCP) [deg] - ang_deg(rERHCP) [deg]

Any other columns will be ignored. There must be exactly one header row with the column names.

The Theta and Phi values must form a regular grid.

Parameters:
  • hfss_csv_path (pathlib.Path) – Path to the HFSS CSV file.

  • carrier_frequency (Frequency) – Pattern data corresponding to this carrier frequency will be imported from the CSV file. Only a single frequency is currently supported.

  • rad_efficiency (Dimensionless) – Radiation efficiency \(\eta\) in [0, 1].

Returns:

Radiation pattern constructed from the CSV.

Return type:

RadiationPattern