2018-07-31 11:09:42 +00:00
|
|
|
#!/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')
|
2018-09-13 11:56:05 +00:00
|
|
|
|
|
|
|
device_help = 'DAQ Device to record from'
|
2018-12-28 12:55:09 +00:00
|
|
|
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')
|
2018-09-13 11:56:05 +00:00
|
|
|
|
2018-07-31 11:09:42 +00:00
|
|
|
args = parser.parse_args()
|
|
|
|
|
2018-09-13 11:56:05 +00:00
|
|
|
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
|
|
|
|
|
2018-09-13 11:56:05 +00:00
|
|
|
if 'roga' == device_str:
|
|
|
|
device = roga_plugndaq
|
|
|
|
elif 'default' == device_str:
|
|
|
|
device = default_soundcard
|
|
|
|
elif 'umik' == device_str:
|
|
|
|
device = umik
|
|
|
|
|
|
|
|
stream = AvStream(device)
|
2018-07-31 11:09:42 +00:00
|
|
|
rec = Recording(args.filename, stream, args.duration)
|
|
|
|
rec.start()
|
|
|
|
stream.stop()
|