def cwtMS(X, scales, sampleScale = 1.0, wlet = 'DOG', maxClip = 1000.): ''' X is the INTERPOLATED intensity array from a mass spectrum. interpolation IS necessary especially for TOF data as the m/z domain is non-linear. ''' ans = W.cwt_a(X, scales, sampling_scale = sampleScale)#, wavelet = wlet) scaledCWT=N.clip(N.fabs(ans.real), 0., maxClip)#N.fabs get the element-wise absolute values return scaledCWT
def cwtMS(X, scales, sampleScale=1.0, wlet='DOG', maxClip=1000.): ''' X is the INTERPOLATED intensity array from a mass spectrum. interpolation IS necessary especially for TOF data as the m/z domain is non-linear. ''' ans = W.cwt_a(X, scales, sampling_scale=sampleScale) #, wavelet = wlet) scaledCWT = N.clip(N.fabs(ans.real), 0., maxClip) #N.fabs get the element-wise absolute values return scaledCWT
# print newdl,dl return data[0:newdl] t1 = time.clock() ms = P.load('N3_Norm.txt') #ms = P.load('J15.csv', delimiter = ',') #x, ms = interpolate_spectrum(ms) #ms = normalize(topHat(ms, 0.01)) #ms = roundLen(ms) print len(ms) s = N.arange(2, 32, 2) #changed to 8 from 32 a = W.cwt_a(ms, s**2, sampling_scale=1.0) plotcwt = N.clip(N.fabs(a.real), 0., 1000.) print "wavelet complete" print time.clock() - t1, 'seconds' fig1 = P.figure() ax = fig1.add_subplot(211) im = ax.imshow(plotcwt, vmax=100, cmap=P.cm.jet, aspect='auto') ax2 = fig1.add_subplot(212, sharex=ax) ##ax3 = fig1.add_subplot(313,sharex=ax) #ax.plot(plotcwt[0]) #ax2.plot(ms, 'r') ##ax2.plot(plotcwt[1], ':r') ## ## ##mNoise = plotcwt[0].mean()