Пример #1
0
def tdc_helper(*, tmpdir, params, recording):

    import tridesclous as tdc

    # nb_chan = recording.get_num_channels()

    # check params and OpenCL when many channels
    use_sparse_template = False
    use_opencl_with_sparse = False
    # if nb_chan > 64:  # this limit depend on the platform of course
    #     if tdc.cltools.HAVE_PYOPENCL:
    #         # force opencl
    #         self.params['fullchain_kargs']['preprocessor']['signalpreprocessor_engine'] = 'opencl'
    #         use_sparse_template = True
    #         use_opencl_with_sparse = True
    #     else:
    #         print('OpenCL is not available processing will be slow, try install it')

    tdc_dataio = tdc.DataIO(dirname=str(tmpdir))
    # make catalogue
    chan_grps = list(tdc_dataio.channel_groups.keys())
    for chan_grp in chan_grps:
        cc = tdc.CatalogueConstructor(dataio=tdc_dataio, chan_grp=chan_grp)
        tdc.apply_all_catalogue_steps(cc, verbose=True, **params)
        cc.make_catalogue_for_peeler()

        # apply Peeler (template matching)
        initial_catalogue = tdc_dataio.load_catalogue(chan_grp=chan_grp)
        peeler = tdc.Peeler(tdc_dataio)
        peeler.change_params(
            catalogue=initial_catalogue,
            use_sparse_template=use_sparse_template,
            sparse_threshold_mad=1.5,
            use_opencl_with_sparse=use_opencl_with_sparse,
        )
        peeler.run(duration=None, progressbar=False)

    sorting = se.TridesclousSortingExtractor(tmpdir)
    return sorting
Пример #2
0
 def get_result_from_folder(output_folder):
     sorting = se.TridesclousSortingExtractor(output_folder)
     return sorting