lapy.io

Functions to read and write spectra and vertex functions.

lapy.io.read_ev(filename)[source]

Load EV file.

Parameters:
filenamestr

Filename of input.

Returns:
dict

Dictionary of eigenvalues, eigenvectors (optional), and associated information. Contains keys like ‘Eigenvalues’ (np.ndarray), ‘Eigenvectors’ (np.ndarray, optional), and metadata fields.

Raises:
OSError

If file is not readable.

lapy.io.read_vfunc(filename)[source]

Import vertex functions from txt file.

Values can be separated by ; or , and surrounded by {} or () brackets. Also first line can have the keyword “Solution:”, i.e. the PSOL format from ShapeDNA.

Parameters:
filenamestr

Filename of input.

Returns:
list of float

List of vfunc parameters.

Raises:
OSError

If file is not found or not readable.

ValueError

If ‘Solution:’ marker is not found or no vertex function data exists.

lapy.io.write_ev(filename, d)[source]

Save EV data structures as txt file (format from ShapeDNA).

Parameters:
filenamestr

Filename to save to.

ddict

Dictionary of eigenvalues, eigenvectors (optional), and associated information. Must contain key ‘Eigenvalues’ (np.ndarray). Optional keys include ‘Eigenvectors’ (np.ndarray) and various metadata fields.

Raises:
OSError

If file is not writable.

ValueError

If ‘Eigenvalues’ key is missing from dictionary.

lapy.io.write_vfunc(filename, vfunc)[source]

Save vertex function in PSOL txt file.

First line “Solution:”, “,” separated values inside ()

Parameters:
filenamestr

Filename to save to.

vfuncnp.ndarray

Array of vfunc parameters, shape (n_vertices,).

Raises:
OSError

If file is not writable.