Skip to content

Commit

Permalink
raise runtime error in get_dft_array and output_dft if monitor is uni…
Browse files Browse the repository at this point in the history
…nitialized (#1669)
  • Loading branch information
oskooi authored Jul 13, 2021
1 parent 9d979ed commit 89c9349
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2446,6 +2446,9 @@ def output_dft(self, dft_fields, fname):
if self.fields is None:
self.init_sim()

if not self.dft_objects:
raise RuntimeError('DFT monitor dft_fields must be initialized before calling output_dft')

if hasattr(dft_fields, 'swigobj'):
dft_fields_swigobj = dft_fields.swigobj
else:
Expand Down Expand Up @@ -3228,6 +3231,9 @@ def get_dft_array(self, dft_obj, component, num_freq):
where `nfreq` is the number of frequencies stored in `dft_obj` as set by the
`nfreq` parameter to `add_dft_fields`, `add_flux`, etc.
"""
if not self.dft_objects:
raise RuntimeError('DFT monitor dft_obj must be initialized before calling get_dft_array')

if hasattr(dft_obj, 'swigobj'):
dft_swigobj = dft_obj.swigobj
else:
Expand Down

0 comments on commit 89c9349

Please sign in to comment.