def create_ICA(self, timeseries): """ :returns: persisted entity IndependentComponents """ operation, _, storage_path = self.__create_operation() partial_ts = TimeSeries(use_storage=False) partial_ts.data = numpy.random.random((10, 10, 10, 10)) partial_ica = IndependentComponents(source=partial_ts, component_time_series=numpy.random.random((10, 10, 10, 10)), prewhitening_matrix=numpy.random.random((10, 10, 10, 10)), unmixing_matrix=numpy.random.random((10, 10, 10, 10)), n_components=10, use_storage=False) ica = IndependentComponents(source=timeseries, n_components=10, storage_path=storage_path) ica.write_data_slice(partial_ica) adapter_instance = StoreAdapter([ica]) OperationService().initiate_prelaunch(operation, adapter_instance, {}) return ica
def launch(self, time_series, n_components=None): """ Launch algorithm and build results. """ ##--------- Prepare a IndependentComponents object for result ----------## ica_result = IndependentComponents(source=time_series, n_components=int( self.algorithm.n_components), 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) 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_ica = self.algorithm.evaluate() ica_result.write_data_slice(partial_ica) ica_result.close_file() return ica_result
def launch(self, time_series, n_components=None): """ Launch algorithm and build results. """ ##--------- Prepare a IndependentComponents object for result ----------## ica_result = IndependentComponents(source=time_series, n_components=int(self.algorithm.n_components), 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) 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_ica = self.algorithm.evaluate() ica_result.write_data_slice(partial_ica) ica_result.close_file() return ica_result