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_result
BaseResults Simulation result object specifying the requested wavelengths and tolerance.
- filename
str,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_name
str,optional Name of the monitor to query (default:
'optimization_dft').- result_name
str,optional Result key to pass to
getresult()(default:'E').- value
str,optional Key within the result dictionary whose data is extracted and sliced along the wavelength axis (default:
'E').
- sim_result
- Returns:
listList 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:
RuntimeErrorIf the simulation file cannot be loaded or the monitor result is unavailable.
RuntimeErrorIf the result contains neither a
'lambda'nor an'f'key for wavelength matching.ValueErrorIf no wavelength in the simulation is within
sim_result.toleranceof a requested wavelength.