Bugfix in Measurement.exportAsWave, throughput of sensitivity value into final measurement object in Recording class, added lasp_record and lasp_playback scripts.
This commit is contained in:
parent
0475b7a60b
commit
473de073a6
@ -254,6 +254,7 @@ class Measurement:
|
||||
blocks = blocks.reshape(self.nblocks*self.blocksize,
|
||||
self.nchannels)
|
||||
|
||||
# Apply scaling (sensitivity, integer -> float)
|
||||
blocks = self.scaleBlock(blocks)
|
||||
return blocks
|
||||
|
||||
@ -323,7 +324,7 @@ class Measurement:
|
||||
if os.path.exists(fn) and not force:
|
||||
raise RuntimeError(f'File already exists: {fn}')
|
||||
with self.file() as f:
|
||||
audio = self.f['audio'][:]
|
||||
audio = f['audio'][:]
|
||||
|
||||
if isinstance(audio.dtype, float):
|
||||
if sampwidth is None:
|
||||
|
@ -17,6 +17,10 @@ class Recording:
|
||||
def __init__(self, fn, stream, rectime=None):
|
||||
"""
|
||||
|
||||
Args:
|
||||
fn: Filename to record to. extension is added
|
||||
stream: AvStream instance to record from
|
||||
rectime: Recording time, None for infinite
|
||||
"""
|
||||
ext = '.h5'
|
||||
if ext not in fn:
|
||||
@ -58,6 +62,7 @@ class Recording:
|
||||
f.attrs['samplerate'] = stream.samplerate
|
||||
f.attrs['nchannels'] = stream.nchannels
|
||||
f.attrs['blocksize'] = stream.blocksize
|
||||
f.attrs['sensitivity'] = stream.sensitivity
|
||||
f.attrs['time'] = time.time()
|
||||
self._running <<= True
|
||||
# Videothread is going to start
|
||||
|
@ -1,7 +1,11 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
from lasp.lasp_playback import Playback
|
||||
import argparse
|
||||
|
||||
fn = sys.argv[1]
|
||||
p = Playback(fn)
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Playback recorded measurement'
|
||||
)
|
||||
parser.add_argument('filename', help='Filename of measurement', type=str)
|
||||
args = parser.parse_args()
|
||||
p = Playback(args.filename)
|
||||
p.start()
|
||||
|
21
scripts/lasp_record
Normal file
21
scripts/lasp_record
Normal file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/python
|
||||
import argparse
|
||||
from lasp.lasp_record import Recording
|
||||
from lasp.lasp_avstream import AvStream
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Acquire data and store a measurement file'
|
||||
)
|
||||
parser.add_argument('filename', type=str,
|
||||
help='File name to record to.'
|
||||
' Extension is automatically added.')
|
||||
parser.add_argument('--duration', '-d', type=float,
|
||||
help='The recording duration in [s]')
|
||||
parser.add_argument('--comment', '-c', type=str,
|
||||
help='Add a measurement comment, optionally')
|
||||
args = parser.parse_args()
|
||||
|
||||
stream = AvStream()
|
||||
rec = Recording(args.filename, stream, args.duration)
|
||||
rec.start()
|
||||
stream.stop()
|
Loading…
Reference in New Issue
Block a user