National Instrument RecorderΒΆ
This module contains the class to record data from a National Instrument. It uses PyDAQmx to do so, but requires NIDAQmx drivers to function. Please check the PyDAQMx and NIDAQmx C API reference for more information.
- Typical example of using the module:
- >>>import myRecorder as NIR>>>recorder = NIR.Recorder()Channels: 1Rate: 30000Chunk size: 1000Number of chunks: 4You are using National Instrument for recordingInput device name not found, using the first deviceSelected devices: Dev3>>>recorder.stream_init()Channels Name: Dev3/ai0True>>>recorder.record_init()Recording function is ready! Use record_start() to startTrue>>>recorder.record_start()stream already startedRecording Start!True>>>Recording Done! Please flush the data with flush_record_data().data = recorder.flush_record_data()Data flushed>>>recorder.close()
-
class
cued_datalogger.acquisition.NIRecorder.
Recorder
(channels=1, rate=30000.0, chunk_size=1000, num_chunk=4, device_name=None) Bases:
cued_datalogger.acquisition.RecorderParent.RecorderParent
Sets up the recording stream through a National InstrumentAttributes
device_name: str Name of the device to be used for recording max_value: float Maximum value of recorded data Methods
-
audiodata_to_array
(data) Re-implemented from RecorderParent
-
available_devices
() Get all the available input National Instrument devices.
Returns: devices_name: List of str
Name of the device, e.g. Dev0
device_type: List of str
Type of device, e.g. USB-6003
-
current_device_info
() Prints information about the current device set
-
set_channels
() Create the string to initiate the channels when assigning a Task
Returns: channelname: str
The channel names to be used when assigning Task e.g. Dev0/ai0:Dev0/ai1
-
set_device_by_name
(name) Set the recording audio device by name. Uses the first device found if no such device found.
-
stream_audio_callback
() Callback function for audio streaming. First, it writes data to the circular buffer, then record data if it is recording, finally check for any trigger.
Returns 0 as part of the callback format. More info can be found in PyDAQmx documentation on Task class
-
stream_close
() Re-implemented from RecorderParent.
-
stream_init
(playback=False) Re-implemented from RecorderParent.
-
stream_start
() Re-implemented from RecorderParent.
-
stream_stop
() Re-implemented from RecorderParent.
-