def store_switch_times(self, models=None): models = self._get_models(models) out = [] for instance in models.values(): out.extend(instance.get_times()) out = np.ravel(np.array(out)) out = np.unique(out) out = out[np.where(out >= 0)] out = np.sort(out) self.switch_times = out return self.switch_times
def store_switch_times(self, models=None): """ Store event switching time in a sorted Numpy array at ``System.switch_times``. Returns ------- array-like self.switch_times """ models = self._get_models(models) out = [] for instance in models.values(): out.extend(instance.get_times()) out = np.ravel(np.array(out)) out = np.unique(out) out = out[np.where(out >= 0)] out = np.sort(out) self.switch_times = out return self.switch_times
def store_switch_times(self, models): """ Store event switching time in a sorted Numpy array at ``System.switch_times``. Returns ------- array-like self.switch_times """ out = [] for instance in models.values(): out.extend(instance.get_times()) out = np.ravel(np.array(out)) out = np.append(out, out + 1e-4) out = np.unique(out) out = out[np.where(out >= 0)] out = np.sort(out) self.switch_times = out self.n_switches = len(self.switch_times) return self.switch_times