示例#1
0
def convert(size, srcunit, trgunit):
    value = size
    if srcunit != trgunit:
        sizeinbytes = size * Factor[srcunit]
        trgfact = Factor[trgunit]
        value = round(float(sizeinbytes) / trgfact, int(log10(trgfact)))
    return value
示例#2
0
def getHumanUnit(size, unit="B"):
    size = convert(size, unit, "B")
    hu = "B"
    for u in Factor.keys():
        if size > 10**(int(log10(Factor[u]))):
            if Factor[u] > Factor[hu]:
                hu = u
    return hu
示例#3
0
    """Load Nicolet BMSI data."""
    if tmin < 0: tmin = 0
    fh = file(filename, 'rb')
    indmin = Fs * tmin
    numsamples = os.path.getsize(filename) / (channels * 2)
    indmax = min(numsamples, Fs * tmax)

    byte0 = int(indmin * channels * 2)
    numbytes = int((indmax - indmin) * channels * 2)

    fh.seek(byte0)
    data = fromstring(fh.read(numbytes), Int16).astype(Float)
    data.shape = -1, channels

    t = (1 / Fs) * arange(indmin, indmax)

    return t, data


t, data = read_nicolet(0, 10)

x = data[:, 5]

Pxx, freqs, t = specgram(x, NFFT=512, Fs=Fs, noverlap=412)

T, F = meshgrid(t, freqs)
pcolor(T, F, 10 * log10(Pxx), shading='flat')
set(gca(), 'ylim', [0, 100])
#print Pxx.shape, freqs.shape, t.shape
show()
示例#4
0
    indmax = min(numsamples, Fs*tmax)



    byte0 = int(indmin*channels*2)
    numbytes = int( (indmax-indmin)*channels*2 )

    fh.seek(byte0)
    data = fromstring(fh.read(numbytes), Int16).astype(Float)
    data.shape = -1, channels



    t = (1/Fs)*arange(indmin, indmax)

    return t, data



t, data = read_nicolet(0,10)

x = data[:,5] 

Pxx, freqs, t = specgram(x, NFFT=512, Fs=Fs, noverlap=412)

T, F = meshgrid(t,freqs)
pcolor(T, F, 10*log10(Pxx), shading='flat')
set(gca(), 'ylim', [0,100])
#print Pxx.shape, freqs.shape, t.shape
show()
示例#5
0
文件: tv.py 项目: eddienko/SamPy
    def log10Image(self):
	if self.fname == '': return
	from Numeric import log10
	data = self.data
	da = log10(data)
	self.createImage(da)
示例#6
0
 def log10Image(self):
     if self.fname == '': return
     from Numeric import log10
     data = self.data
     da = log10(data)
     self.createImage(da)