get_fields_at_wavelengths#

FdtdSession.get_fields_at_wavelengths(sim_result, filename=None, *, monitor_name='optimization_dft', result_name='E', value='E') list#

Extract monitor values from a simulation at each requested wavelength.

Parameters:
sim_resultBaseResults

Simulation result object specifying the requested wavelengths and tolerance.

filenamestr, optional

Path to an FDTD simulation file (.fsp) to load before querying the monitor. If None, the current state of the FDTD session is used without loading a new file (default: None).

monitor_namestr, optional

Name of the monitor to query (default: 'optimization_dft').

result_namestr, optional

Result key to pass to getresult() (default: 'E').

valuestr, optional

Key within the result dictionary whose data is extracted and sliced along the wavelength axis (default: 'E').

Returns:
list

List of values extracted at each requested wavelength, one entry per wavelength in sim_result.wavelengths. For spatial field results with shape (nx, ny, nz, nlambda, 3), each entry has shape (nx, ny, nz, 3). For scalar or vector results, each entry is a scalar or lower-dimensional array.

Raises:
RuntimeError

If the simulation file cannot be loaded or the monitor result is unavailable.

RuntimeError

If the result contains neither a 'lambda' nor an 'f' key for wavelength matching.

ValueError

If no wavelength in the simulation is within sim_result.tolerance of a requested wavelength.