def select(): spec = Collate(*Collate.from_log(path)) sel = Select(spec, float_keys=['cortex_density', 'retina_density']) data = np.random.rand(9) selection = (sel.retina_density > 3.0) & (sel.cortex_density > 5) assert set(sel[selection].tid) == set([5, 8]) assert repr(sel.select(selection, data)) == repr(data[selection]) list_data = [None, 3, False, object, 3.4, '32', np.int64, unicode, lambda x: x] list_selection = [True, True, False, True] + [False]*5 assert repr(sel.select(list_selection, list_data)) == repr([None, 3,object]) new_sel = Select(sel.tolist(selection), float_keys=['cortex_density', 'retina_density']) return new_sel
def collate(): collation = Collate(*Collate.from_log(path), activity=[1,2,3,4,5,6,7,8,9]) collation.extract_filelist('AllORPrefs', ['*_t{tid}_*/*Orientation_Preference.png']) # Partition these files by topo.sim.time() collation.partition_by_filename('AllORPrefs', 'ORPrefs', '*__{time:0>9.2f}_*', time=[1.0,5.0,10.0]) collation.extract_filelist('ORSel', ['*_t{tid}_*/*_{time:0>9.2f}_*Orientation_Selectivity.png'], key_type={'time':float}) collation.extract_filelist('ColKey', ['*_t{tid}_*/*_{time:0>9.2f}_*Color_Key.png'], key_type={'time':float}) collation.show() return collation