nidaqmx.utils

nidaqmx.utils.flatten_channel_string(channel_names)[source]

Converts a list of channel names to a comma-delimited list of names.

You can use this method to convert a list of physical or virtual channel names to a single string prior to using the DAQmx Create Channel methods or instantiating a DAQmx Task object.

Note: For simplicity, this implementation is not fully compatible with the NI-DAQmx driver implementation, which is generally more permissive. For example, the driver is more graceful with whitespace padding. It was deemed valuable to implement this natively in Python, so it can be leveraged in workflows that don’t have the driver installed. If we have specific examples where this approximation is a problem, we can revisit this in the future.

Parameters

channel_names (List[str]) – The list of physical or virtual channel names.

Returns

The resulting comma-delimited list of physical or virtual channel names.

Return type

str

nidaqmx.utils.unflatten_channel_string(channel_names)[source]

Converts a comma-delimited list of channel names to a list of names.

You can use this method to convert a comma-delimited list or range of physical or virtual channels into a list of physical or virtual channel names.

Note: For simplicity, this implementation is not fully compatible with the NI-DAQmx driver implementation, which is generally more permissive. For example, the driver is more graceful with whitespace padding. It was deemed valuable to implement this natively in Python, so it can be leveraged in workflows that don’t have the driver installed. If we have specific examples where this approximation is a problem, we can revisit this in the future.

Parameters

channel_names (str) – The list or range of physical or virtual channels.

Returns

The list of physical or virtual channel names. Each element of the list contains a single channel.

Return type

List[str]