def main(fname_data, fname_sorting, sign, outfname, drop_artifacts=False): """ read groups from sorting for conversion """ man = Combinato(fname_data, sign, fname_sorting) # man.set_sign_times_spikes(sign) # res = man.init_sorting(fname_sorting) fn1 = os.path.basename(fname_data) # fn2 = os.path.basename(fname_sorting) joined = man.get_groups_joined() ch_name = man.header['AcqEntName'] # ugly: this works only if you use the CSCxy convention! go_on = False try: ch_num = int(fn1[8:-3]) go_on = True except ValueError as error: print(error) print('Cannot find channel number in' ' filename {}'.format(fn1)) info_row = None if go_on: info_row = [ch_num, ch_name] info_dict = convert_to_mat(joined, outfname, drop_artifacts) info_row += [info_dict[GROUP_ART], info_dict[GROUP_NOCLASS]] del info_dict[GROUP_ART] del info_dict[GROUP_NOCLASS] for key in sorted(info_dict.keys()): info_row.append(info_dict[key]) del man return info_row
def main(sign, label): """ show group sizes in h5files """ files = h5files(os.getcwd()) n_arti_total = 0 for fname in files: man = Combinato(fname, sign, label) if not man.initialized: continue groups = man.get_groups(times=False, spikes=False) if 0 in groups.keys(): n_unassigned = len(groups[0]) if -1 in groups.keys(): n_arti = len(groups[-1]) else: n_arti = 0 print('{} {} groups, {} artifacts'. format(os.path.basename(fname), len(groups), n_arti)) n_arti_total += n_arti return n_arti_total