def create_crosscoherence(self, time_series):
     """
     :returns: a stored entity of type CoherenceSpectrum
     """
     operation, _, storage_path = self.__create_operation()
     partial_coh = CoherenceSpectrum(array_data=numpy.random.random((10, 10, 10, 10)), use_storage=False)
     coherence = CoherenceSpectrum(source=time_series, storage_path=storage_path, frequency=0.1, nfft=256)
     coherence.write_data_slice(partial_coh)
     coherence.close_file()
     adapter_instance = StoreAdapter([coherence])
     OperationService().initiate_prelaunch(operation, adapter_instance, {})
     return coherence
示例#2
0
 def launch(self, time_series, nfft=None):
     """ 
     Launch algorithm and build results. 
     """
     ##--------- Prepare a CoherenceSpectrum object for result ------------##
     coherence = CoherenceSpectrum(source=time_series,
                                   nfft=self.algorithm.nfft,
                                   storage_path=self.storage_path)
     
     ##------------- NOTE: Assumes 4D, Simulator timeSeries. --------------##
     node_slice = [slice(self.input_shape[0]), None, slice(self.input_shape[2]), slice(self.input_shape[3])]
     
     ##---------- Iterate over slices and compose final result ------------##
     small_ts = TimeSeries(use_storage=False)
     small_ts.sample_rate = time_series.sample_rate
     partial_coh = None
     for var in range(self.input_shape[1]):
         node_slice[1] = slice(var, var + 1)
         small_ts.data = time_series.read_data_slice(tuple(node_slice))
         self.algorithm.time_series = small_ts
         partial_coh = self.algorithm.evaluate()
         coherence.write_data_slice(partial_coh)
     coherence.frequency = partial_coh.frequency
     coherence.close_file()
     return coherence
示例#3
0
 def create_crosscoherence(self, time_series):
     """
     :returns: a stored entity of type CoherenceSpectrum
     """
     operation, _, storage_path = self.__create_operation()
     partial_coh = CoherenceSpectrum(array_data=numpy.random.random((10, 10, 10, 10)), use_storage=False)
     coherence = CoherenceSpectrum(source=time_series, storage_path=storage_path, frequency=0.1, nfft=256)
     coherence.write_data_slice(partial_coh)
     coherence.close_file()
     adapter_instance = StoreAdapter([coherence])
     OperationService().initiate_prelaunch(operation, adapter_instance, {})
     return coherence