lasp/scripts/lasp_record

46 lines
1.4 KiB
Plaintext
Raw Normal View History

#!/usr/bin/python
import argparse
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')
device_help = 'DAQ Device to record from'
parser.add_argument('--input-daq', '-i', help=device_help, type=str,
2019-10-27 13:19:26 +00:00
choices=['roga', 'umik', 'nidaq', 'default'], default='roga')
args = parser.parse_args()
device_str = args.input_daq
2019-10-27 13:19:26 +00:00
if device_str == 'nidaq':
# Not-integrated way to record with the NI USB 4431 DAQ device
from lasp.device.record_ni import USBDAQRecording
rec = USBDAQRecording(args.filename, [0, 1])
rec.start()
exit(0)
from lasp.lasp_record import Recording
from lasp.lasp_avstream import AvStream
from lasp.device.lasp_daqconfig import default_soundcard, roga_plugndaq, umik
if 'roga' == device_str:
device = roga_plugndaq
elif 'default' == device_str:
device = default_soundcard
elif 'umik' == device_str:
device = umik
stream = AvStream(device)
rec = Recording(args.filename, stream, args.duration)
rec.start()
stream.stop()