def set_idx(self, obs): if self._idx is None: self._idx = nested_map( lambda n: obs.index(n), [[f'lc1.inductor{k}.i' for k in '123'], 'master.phase', [f'master.SPI{k}' for k in 'dq0'], [f'lc1.capacitor{k}.v' for k in '123'], [f'master.SPV{k}' for k in 'dq0']])
def _set_hist_cols(self, cols): """ prefixes column names with controller name and append a entry for the clipped values :param cols: :return: """ self.history.cols = nested_map(lambda col: '.'.join([self.name, col]), cols + [f'm{s}_clipped' for s in 'abc'])
def set_idx(self, obs): if self._idx is None: self._idx = nested_map( lambda n: obs.index(n), [[f'slave.freq'], [f'master.CVV{s}' for s in 'dq0']])
def test_nested_map1(): assert np.array_equal(nested_map(len, np.array(['a', 'b', 'c'])), np.array([1, 1, 1]))
def test_nested_map(): assert nested_map(lambda x: 'p' + x, ['a', 'b', 'c']) == ['pa', 'pb', 'pc']
def set_idx(self, obs): if self._idx is None: self._idx = nested_map(lambda n: obs.index(n), self.obs_dict)
def _set_hist_cols(self, cols): self.history.cols = nested_map(lambda col: '.'.join([self.name, col]), cols)