Skip to content

IO

metasurface_py.io

Import/export utilities.

export_pattern_csv(pattern, path)

Export far-field pattern to CSV.

Exports theta [deg], phi [deg], magnitude, phase [deg] for each observation angle.

Parameters:

Name Type Description Default
pattern DataArray

Far-field pattern with dims (theta, phi).

required
path str | Path

Output file path (.csv).

required

Returns:

Type Description
Path

Path to saved file.

export_state_csv(state, path, nx=None, ny=None)

Export phase state to CSV for MATLAB/external tools.

Parameters:

Name Type Description Default
state SurfaceState

Surface state to export.

required
path str | Path

Output file path (.csv).

required
nx int | None

Number of elements along x (for 2D reshaping).

None
ny int | None

Number of elements along y (for 2D reshaping).

None

Returns:

Type Description
Path

Path to saved file.