Esempio n. 1
0
 def get_waveforms(self):
     """ Return the recorded waveform (in time domain) """
     if len(self.t) <= 1:
         t, result_wform = np.array(self.t), np.array(self.waveform)
     else:
         t = np.array(self.t[:-1])
         if meep.is_magnetic(self.comp) or meep.is_B(self.comp):
             result_wform = np.array(self.waveform[:-1])/2. + np.array(self.waveform[1:])/2.
         else: 
             result_wform = np.array(self.waveform[:-1])
     return t, result_wform 
 def get_waveforms(self):
     """ Return the recorded waveform (in time domain) """
     if len(self.t) <= 1:
         t, result_wform = np.array(self.t), np.array(self.waveform)
     else:
         t = np.array(self.t[:-1])
         ## The FDTD calculation introduces half-step time shift between Ex and Hy. Compensated by averaging the Hy field
         ## with its value in a next timestep. The error is reduced from O1 to O2.
         ## See http://ab-initio.mit.edu/wiki/index.php/Synchronizing_the_magnetic_and_electric_fields
         if meep.is_magnetic(self.comp) or meep.is_B(self.comp):
             result_wform = np.array(self.waveform[:-1])/2. + np.array(self.waveform[1:])/2.
         else: 
             result_wform = np.array(self.waveform[:-1])
         
     return t, result_wform