コード例 #1
0
def test1():
    bl = generate_block_for_sorting(nb_unit = 6,
                                                        duration = 10.*pq.s,
                                                        noise_ratio = 0.7,
                                                        nb_segment = 2,
                                                        )
    rcg = bl.recordingchannelgroups[0]

    spikesorter = SpikeSorter(rcg)

    spikesorter.ButterworthFilter( f_low = 200.)
    #~ spikesorter.RelativeThresholdDetection(sign= '-', relative_thresh = 3.5,noise_estimation = 'MAD', threshold_mode = 'crossing',
                        #~ consistent_across_channels = False,
                        #~ consistent_across_segments = True,                                                                                
                                                                                #~ )
    #~ print spikesorter
    spikesorter.RelativeThresholdDetection(sign= '-', relative_thresh = 3.5,noise_estimation = 'MAD', threshold_mode = 'peak', peak_span = 0.53*pq.ms)
    print spikesorter.detection_thresholds
    print spikesorter
    #~ spikesorter.RelativeThresholdDetection(sign= '-', relative_thresh = 3.5,noise_estimation = 'STD', threshold_mode = 'crossing', )
    #~ print spikesorter
    #~ spikesorter.RelativeThresholdDetection(sign= '-', relative_thresh = 3.5,noise_estimation = 'STD', threshold_mode = 'peak', peak_span = 0.3*pq.ms )
    #~ print spikesorter
    spikesorter.populate_recordingchannelgroup(with_waveforms = False)
    

    
    spikesorter.check_display_attributes()
    from OpenElectrophy.gui.spikesorting import FilteredBandSignal
    app = QApplication([ ])
    w2 = FilteredBandSignal(spikesorter = spikesorter)
    w2.refresh()
    w2.show()
    app.exec_()
コード例 #2
0
def test1():
    #save  to neo
    bl = generate_block_for_sorting(nb_unit = 6,
                                                        duration = 10.*pq.s,
                                                        noise_ratio = 0.2,
                                                        nb_segment = 2,
                                                        )
    rcg = bl.recordingchannelgroups[0]

    spikesorter = SpikeSorter(rcg)

    spikesorter.ButterworthFilter( f_low = 200.)
    spikesorter.MedianThresholdDetection(sign= '-', median_thresh = 6.,)
    spikesorter.AlignWaveformOnPeak(left_sweep = 1*pq.ms , right_sweep = 2*pq.ms, sign = '-')
    spikesorter.PcaFeature(n_components = 4)
    spikesorter.CombineFeature(use_peak = True, use_peak_to_valley = True, n_pca = 3, n_ica = 3, n_haar = 3, sign = '-')
    spikesorter.SklearnKMeans(n_cluster = 3)


    for u, unit in enumerate(rcg.units):
        for s, seg in enumerate(rcg.block.segments):
            sptr = seg.spiketrains[u]
            print 'u', u, 's', s, seg.spiketrains[u] is unit.spiketrains[s], sptr.size


    rcg = spikesorter.populate_recordingchannelgroup()
    
    print 
    
    for u, unit in enumerate(rcg.units):
        for s, seg in enumerate(rcg.block.segments):
            sptr = seg.spiketrains[u]
            print 'u', u, 's', s, seg.spiketrains[u] is unit.spiketrains[s], sptr.size
コード例 #3
0
def test1():
    bl = generate_block_for_sorting(
        nb_unit=6,
        duration=10. * pq.s,
        noise_ratio=0.7,
        nb_segment=2,
    )
    rcg = bl.recordingchannelgroups[0]

    spikesorter = SpikeSorter(rcg)

    spikesorter.ButterworthFilter(f_low=200.)
    #~ spikesorter.RelativeThresholdDetection(sign= '-', relative_thresh = 3.5,noise_estimation = 'MAD', threshold_mode = 'crossing',
    #~ consistent_across_channels = False,
    #~ consistent_across_segments = True,
    #~ )
    #~ print spikesorter
    spikesorter.RelativeThresholdDetection(sign='-',
                                           relative_thresh=3.5,
                                           noise_estimation='MAD',
                                           threshold_mode='peak',
                                           peak_span=0.53 * pq.ms)
    print spikesorter.detection_thresholds
    print spikesorter
    #~ spikesorter.RelativeThresholdDetection(sign= '-', relative_thresh = 3.5,noise_estimation = 'STD', threshold_mode = 'crossing', )
    #~ print spikesorter
    #~ spikesorter.RelativeThresholdDetection(sign= '-', relative_thresh = 3.5,noise_estimation = 'STD', threshold_mode = 'peak', peak_span = 0.3*pq.ms )
    #~ print spikesorter
    spikesorter.populate_recordingchannelgroup(with_waveforms=False)

    spikesorter.check_display_attributes()
    from OpenElectrophy.gui.spikesorting import FilteredBandSignal
    app = QApplication([])
    w2 = FilteredBandSignal(spikesorter=spikesorter)
    w2.refresh()
    w2.show()
    app.exec_()
コード例 #4
0
def test1():
    #save  to neo
    bl = generate_block_for_sorting(
        nb_unit=6,
        duration=10. * pq.s,
        noise_ratio=0.2,
        nb_segment=2,
    )
    rcg = bl.recordingchannelgroups[0]

    spikesorter = SpikeSorter(rcg)

    spikesorter.ButterworthFilter(f_low=200.)
    spikesorter.MedianThresholdDetection(
        sign='-',
        median_thresh=6.,
    )
    spikesorter.AlignWaveformOnPeak(left_sweep=1 * pq.ms,
                                    right_sweep=2 * pq.ms,
                                    sign='-')
    spikesorter.PcaFeature(n_components=4)
    spikesorter.CombineFeature(use_peak=True,
                               use_peak_to_valley=True,
                               n_pca=3,
                               n_ica=3,
                               n_haar=3,
                               sign='-')
    spikesorter.SklearnKMeans(n_cluster=3)

    for u, unit in enumerate(rcg.units):
        for s, seg in enumerate(rcg.block.segments):
            sptr = seg.spiketrains[u]
            print 'u', u, 's', s, seg.spiketrains[u] is unit.spiketrains[
                s], sptr.size

    rcg = spikesorter.populate_recordingchannelgroup()

    print

    for u, unit in enumerate(rcg.units):
        for s, seg in enumerate(rcg.block.segments):
            sptr = seg.spiketrains[u]
            print 'u', u, 's', s, seg.spiketrains[u] is unit.spiketrains[
                s], sptr.size
コード例 #5
0
    spikesorter = SpikeSorter(rcg)
    
    # display unit before sorting
    for u, unit in enumerate(rcg.units):
        print u, 'unit name', unit.name
        for s, seg in enumerate(rcg.block.segments):
            sptr = seg.spiketrains[u]
            print ' in Segment', s, 'has SpikeTrain with ', sptr.size

    # Apply a chain
    spikesorter.ButterworthFilter( f_low = 200.)
    # equivalent to
    # spikesorter.run_step(ButterworthFilter, f_low = 200.)
    spikesorter.MedianThresholdDetection(sign= '-',median_thresh = 6)
    spikesorter.AlignWaveformOnDetection(left_sweep = 1*pq.ms ,right_sweep = 2*pq.ms)
    spikesorter.PcaFeature(n_components = 6)
    spikesorter.SklearnGaussianMixtureEm(n_cluster = 6, n_iter = 200 )



    print

    # display unit after sorting
    rcg = spikesorter.populate_recordingchannelgroup()
    for u, unit in enumerate(rcg.units):
        print u, 'unit name', unit.name
        for s, seg in enumerate(rcg.block.segments):
            sptr = seg.spiketrains[u]
            print ' in Segment', s, 'has SpikeTrain with ', sptr.size