DataPipeline/Testing.py
def peakDetectionTest(path=None, noise=0.08):
    """Use pre-processing funcs to detect peaks"""
    if path == None:
        path = "testfiles"
    names = Utilities.createRandomStrings(8,6)
    fname = os.path.join(path,'spectraldata.txt')
    peaks = Utilities.createSimulatedSpectralData(fname, names, noise=noise)
    conf = {'format':'databycolumn', 'saveplots':1, 'marker':'-',
            'markers':'-,x','alpha':0.7,'normalise':1,
            'function1':'smooth', 'function2':'baselinecorrection',
            'function3':'detectpeaks'}
    p = Pipeline()
    p.createConfig('temp.conf',**conf)
    p.openRaw(fname)
    results = p.run()

    #compare predicted peaks
    successrates=[]
    res  = results[results.keys()[0]]
    for name in peaks:
        #print name, sorted(peaks[name]), results[name][0]
        orig = set(peaks[name])
        pred = set(res[name][0])
        s = float(len(orig.intersection(pred)))/(len(orig))
        successrates.append(s)
    return np.mean(successrates)
Use pre-processing funcs to detect peaks
Use pre-processing funcs to detect peaks
Use pre - processing funcs to detect peaks
def peakDetectionTest(path=None, noise=0.08):
    if path == None:
        path = "testfiles"
    names = Utilities.createRandomStrings(8,6)
    fname = os.path.join(path,'spectraldata.txt')
    peaks = Utilities.createSimulatedSpectralData(fname, names, noise=noise)
    conf = {'format':'databycolumn', 'saveplots':1, 'marker':'-',
            'markers':'-,x','alpha':0.7,'normalise':1,
            'function1':'smooth', 'function2':'baselinecorrection',
            'function3':'detectpeaks'}
    p = Pipeline()
    p.createConfig('temp.conf',**conf)
    p.openRaw(fname)
    results = p.run()
    successrates=[]
    res  = results[results.keys()[0]]
    for name in peaks:
        orig = set(peaks[name])
        pred = set(res[name][0])
        s = float(len(orig.intersection(pred)))/(len(orig))
        successrates.append(s)
    return np.mean(successrates)
def peakDetectionTest ( path = None , noise = 0.08 ) : if path == None : path = "testfiles" names = Utilities . createRandomStrings ( 8 , 6 ) fname = os . path . join ( path , 'spectraldata.txt' ) peaks = Utilities . createSimulatedSpectralData ( fname , names , noise = noise ) conf = { 'format' : 'databycolumn' , 'saveplots' : 1 , 'marker' : '-' , 'markers' : '-,x' , 'alpha' : 0.7 , 'normalise' : 1 , 'function1' : 'smooth' , 'function2' : 'baselinecorrection' , 'function3' : 'detectpeaks' } p = Pipeline ( ) p . createConfig ( 'temp.conf' , ** conf ) p . openRaw ( fname ) results = p . run ( ) successrates = [ ] res = results [ results . keys ( ) [ 0 ] ] for name in peaks : orig = set ( peaks [ name ] ) pred = set ( res [ name ] [ 0 ] ) s = float ( len ( orig . intersection ( pred ) ) ) / ( len ( orig ) ) successrates . append ( s ) return np . mean ( successrates )
Use pre-processing funcs to detect peaks
Use pre - processing funcs to detect peaks
"""Use pre-processing funcs to detect peaks""" #compare predicted peaks #print name, sorted(peaks[name]), results[name][0]
path
noise