def space_integral(self, weights=None): # ToDo: have this checked; including spatial sampling! # ToDo: Figure out how to assign the metadata...buh trace = Trace() trace.stats.sampling_rate = self.stats['Fs'] # ToDo: Thinking about weights if not self.complex: if weights: trace.data = np.trapz(np.multiply(self.data[:], weights[:]), axis=0) else: trace.data = np.trapz(self.data[:], axis=0) #oDo complex wavefield else: if weights: trace.data_i = np.trapz(np.multiply(self.data_i[:], weights[:]), axis=0) trace.data_r = np.trapz(np.multiply(self.data_r[:], weights[:]), axis=0) else: trace.data_i = np.trapz(self.data_i[:], axis=0) trace.data_r = np.trapz(self.data_r[:], axis=0) return trace