![]() |
QPMS
Electromagnetic multiple scattering library and toolkit.
|
Reading T-matrices from the community HDF5 format (.tmat.h5). More...


Go to the source code of this file.
Data Structures | |
| struct | qpms_tmatrix_hdf5_t |
| A T-matrix sweep loaded from a community-format .tmat.h5 file. More... | |
| struct | qpms_tmatrix_hdf5_write_params_t |
| Parameters of the community-format .tmat.h5 writer. More... | |
Macros | |
| #define | QPMS_TMATRIX_HDF5_NORM |
| VSWF normalisation convention of the T-matrix community data format. | |
Typedefs | |
| typedef struct qpms_tmatrix_hdf5_t | qpms_tmatrix_hdf5_t |
| A T-matrix sweep loaded from a community-format .tmat.h5 file. | |
| typedef struct qpms_tmatrix_hdf5_write_params_t | qpms_tmatrix_hdf5_write_params_t |
| Parameters of the community-format .tmat.h5 writer. | |
Functions | |
| qpms_tmatrix_hdf5_t * | qpms_tmatrix_hdf5_read (const char *path, char *errbuf, size_t errlen) |
| Reads a T-matrix sweep from a community-format .tmat.h5 file. | |
| void | qpms_tmatrix_hdf5_free (qpms_tmatrix_hdf5_t *h) |
| Frees a T-matrix sweep. | |
| qpms_tmatrix_interpolator_t * | qpms_tmatrix_hdf5_interpolator (const qpms_tmatrix_hdf5_t *h) |
| Creates a frequency interpolator over the loaded sweep. | |
| qpms_errno_t | qpms_tmatrix_hdf5_write (const char *path, const qpms_tmatrix_hdf5_write_params_t *params, char *errbuf, size_t errlen) |
| Writes a T-matrix sweep into a community-format .tmat.h5 file. | |
Reading T-matrices from the community HDF5 format (.tmat.h5).
Implements the reader side of the T-matrix data format described in "T-matrix representation of optical scattering response: Suggestion for a data format" (github.com/tfp-photonics/tmatrix_data_format, storage_format_version "v1"). The file layout is:
/ attributes: name, description, keywords,
storage_format_version ("v1")
/tmatrix dataset (a, b_s, b_i), complex
/modes/l, /modes/m datasets (b_s), integer
/modes/polarization dataset (b_s), strings ("electric"/"magnetic")
/frequency one of /frequency, /angular_frequency,
/vacuum_wavelength, /vacuum_wavenumber,
/angular_vacuum_wavenumber (length a),
with a string attribute "unit"
/embedding group with relative_permittivity (+relative_permeability)
or refractive_index (+relative_impedance) datasets
Limitations of the current implementation:
The mode normalisation convention of the format corresponds to QPMS_TMATRIX_HDF5_NORM; the loaded basis spec uses it directly.
| #define QPMS_TMATRIX_HDF5_NORM |
VSWF normalisation convention of the T-matrix community data format.
The format defines the modes with spherical harmonics including the Condon-Shortley phase and the vector spherical wave functions X_lm = L Y_lm / sqrt(l(l+1)), M = z_l X, N = (grad/k) x M (Jackson-style, as used by treams; see the format description, appendix "Mode normalization").
| typedef struct qpms_tmatrix_hdf5_write_params_t qpms_tmatrix_hdf5_write_params_t |
Parameters of the community-format .tmat.h5 writer.
The file is written with storage_format_version "v1"; the sweep is stored as /angular_frequency with the unit "rad/s"; the embedding as /embedding/relative_permittivity and /embedding/relative_permeability. All the strings may be NULL except software and method. The modes of bspec must form a complete +/-m parity basis (as checked by the reader).
| qpms_tmatrix_interpolator_t * qpms_tmatrix_hdf5_interpolator | ( | const qpms_tmatrix_hdf5_t * | h | ) |
Creates a frequency interpolator over the loaded sweep.
The returned interpolator borrows the basis spec from h and copies the table data into its splines, so it may outlive the raw data array but not h->bspec. Use with qpms_tmatrix_generator_interpolator(). The interpolation variable is the angular frequency in rad/s, matching the convention of the other T-matrix generators.
| qpms_tmatrix_hdf5_t * qpms_tmatrix_hdf5_read | ( | const char * | path, |
| char * | errbuf, | ||
| size_t | errlen | ||
| ) |
Reads a T-matrix sweep from a community-format .tmat.h5 file.
| path | Path to the HDF5 file. |
| errbuf | Buffer for a human readable error message (may be NULL). |
| errlen | Size of errbuf. |
| qpms_errno_t qpms_tmatrix_hdf5_write | ( | const char * | path, |
| const qpms_tmatrix_hdf5_write_params_t * | params, | ||
| char * | errbuf, | ||
| size_t | errlen | ||
| ) |
Writes a T-matrix sweep into a community-format .tmat.h5 file.
The file is truncated if it exists.
| path | Output path. |
| params | The data to write; software and method must be set. |
| errbuf | Buffer for a human readable error message (may be NULL). |
| errlen | Size of errbuf. |