nidaqmx.stream_writers
- class nidaqmx.stream_writers.AnalogMultiChannelWriter(task_out_stream, auto_start=<nidaqmx.stream_writers.UnsetAutoStartSentinel object>)[source]
Bases:
ChannelWriterBase
Writes samples to one or more analog output channels in an NI-DAQmx task.
- property auto_start
Specifies if the write method automatically starts the task if you did not explicitly start it with the DAQmx Start Task method.
If you do not specify a value for this parameter, NI-DAQmx determines its value based on the type of write method used. If you use a one sample write method, its value is True; conversely, if you use a many sample write method, its value is False.
- Type:
bool
- property verify_array_shape
Indicates whether the size and shape of the user-defined NumPy arrays passed to read methods are verified. Defaults to True when this object is instantiated.
Setting this property to True may marginally adversely impact the performance of read methods.
- Type:
bool
- write_many_sample(data, timeout=10.0)[source]
Writes one or more floating-point samples to one or more analog output channels in a task.
If the task uses on-demand timing, this method returns only after the device generates all samples. On-demand is the default timing type if you do not use the timing property on the task to configure a sample timing type. If the task uses any timing type other than on-demand, this method returns immediately and does not wait for the device to generate all samples. Your application must determine if the task is done to ensure that the device generated all samples.
- Parameters:
data (numpy.ndarray) –
Contains a 2D NumPy array of floating-point samples to write to the task.
Each row corresponds to a channel in the task. Each column corresponds to a sample to write to each channel. The order of the channels in the array corresponds to the order in which you add the channels to the task.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- Returns:
Specifies the actual number of samples this method successfully wrote to each channel in the task.
- Return type:
int
- write_one_sample(data, timeout=10)[source]
Writes a single floating-point sample to one or more analog output channels in a task.
- Parameters:
data (numpy.ndarray) –
Contains a 1D NumPy array of floating-point samples to write to the task.
Each element of the array corresponds to a channel in the task. The order of the channels in the array corresponds to the order in which you add the channels to the task.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- class nidaqmx.stream_writers.AnalogSingleChannelWriter(task_out_stream, auto_start=<nidaqmx.stream_writers.UnsetAutoStartSentinel object>)[source]
Bases:
ChannelWriterBase
Writes samples to an analog output channel in an NI-DAQmx task.
- property auto_start
Specifies if the write method automatically starts the task if you did not explicitly start it with the DAQmx Start Task method.
If you do not specify a value for this parameter, NI-DAQmx determines its value based on the type of write method used. If you use a one sample write method, its value is True; conversely, if you use a many sample write method, its value is False.
- Type:
bool
- property verify_array_shape
Indicates whether the size and shape of the user-defined NumPy arrays passed to read methods are verified. Defaults to True when this object is instantiated.
Setting this property to True may marginally adversely impact the performance of read methods.
- Type:
bool
- write_many_sample(data, timeout=10.0)[source]
Writes one or more floating-point samples to a single analog output channel in a task.
If the task uses on-demand timing, this method returns only after the device generates all samples. On-demand is the default timing type if you do not use the timing property on the task to configure a sample timing type. If the task uses any timing type other than on-demand, this method returns immediately and does not wait for the device to generate all samples. Your application must determine if the task is done to ensure that the device generated all samples.
- Parameters:
data (numpy.ndarray) – Contains a 1D NumPy array of floating-point samples to write to the task. Each element of the array corresponds to a sample to write.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- Returns:
Specifies the actual number of samples this method successfully wrote.
- Return type:
int
- write_one_sample(data, timeout=10)[source]
Writes a single floating-point sample to a single analog output channel in a task.
- Parameters:
data (float) – Specifies the floating-point sample to write to the task.
auto_start (Optional[bool]) – Specifies if this method automatically starts the task if you did not explicitly start it with the DAQmx Start Task method.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- class nidaqmx.stream_writers.AnalogUnscaledWriter(task_out_stream, auto_start=<nidaqmx.stream_writers.UnsetAutoStartSentinel object>)[source]
Bases:
ChannelWriterBase
Writes unscaled samples to one or more analog output channels in an NI-DAQmx task.
- property auto_start
Specifies if the write method automatically starts the task if you did not explicitly start it with the DAQmx Start Task method.
If you do not specify a value for this parameter, NI-DAQmx determines its value based on the type of write method used. If you use a one sample write method, its value is True; conversely, if you use a many sample write method, its value is False.
- Type:
bool
- property verify_array_shape
Indicates whether the size and shape of the user-defined NumPy arrays passed to read methods are verified. Defaults to True when this object is instantiated.
Setting this property to True may marginally adversely impact the performance of read methods.
- Type:
bool
- write_int16(data, timeout=10.0)[source]
Writes one or more unscaled 16-bit integer samples to one or more analog output channels in a task.
If the task uses on-demand timing, this method returns only after the device generates all samples. On-demand is the default timing type if you do not use the timing property on the task to configure a sample timing type. If the task uses any timing type other than on-demand, this method returns immediately and does not wait for the device to generate all samples. Your application must determine if the task is done to ensure that the device generated all samples.
- Parameters:
data (numpy.ndarray) –
Contains a 2D NumPy array of unscaled 16-bit integer samples to write to the task.
Each row corresponds to a channel in the task. Each column corresponds to a sample to write to each channel.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- Returns:
Specifies the actual number of samples this method successfully wrote to each channel in the task.
- Return type:
int
- write_int32(data, timeout=10.0)[source]
Writes one or more unscaled 32-bit integer samples to one or more analog output channels in a task.
If the task uses on-demand timing, this method returns only after the device generates all samples. On-demand is the default timing type if you do not use the timing property on the task to configure a sample timing type. If the task uses any timing type other than on-demand, this method returns immediately and does not wait for the device to generate all samples. Your application must determine if the task is done to ensure that the device generated all samples.
- Parameters:
data (numpy.ndarray) –
Contains a 2D NumPy array of unscaled 32-bit integer samples to write to the task.
Each row corresponds to a channel in the task. Each column corresponds to a sample to write to each channel.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- Returns:
Specifies the actual number of samples this method successfully wrote to each channel in the task.
- Return type:
int
- write_uint16(data, timeout=10.0)[source]
Writes one or more unscaled 16-bit unsigned integer samples to one or more analog output channels in a task.
If the task uses on-demand timing, this method returns only after the device generates all samples. On-demand is the default timing type if you do not use the timing property on the task to configure a sample timing type. If the task uses any timing type other than on-demand, this method returns immediately and does not wait for the device to generate all samples. Your application must determine if the task is done to ensure that the device generated all samples.
- Parameters:
data (numpy.ndarray) –
Contains a 2D NumPy array of unscaled 16-bit unsigned integer samples to write to the task.
Each row corresponds to a channel in the task. Each column corresponds to a sample to write to each channel.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- Returns:
Specifies the actual number of samples this method successfully wrote to each channel in the task.
- Return type:
int
- write_uint32(data, timeout=10.0)[source]
Writes one or more unscaled 32-bit unsigned integer samples to one or more analog output channels in a task.
If the task uses on-demand timing, this method returns only after the device generates all samples. On-demand is the default timing type if you do not use the timing property on the task to configure a sample timing type. If the task uses any timing type other than on-demand, this method returns immediately and does not wait for the device to generate all samples. Your application must determine if the task is done to ensure that the device generated all samples.
- Parameters:
data (numpy.ndarray) –
Contains a 2D NumPy array of unscaled 32-bit unsigned integer samples to write to the task.
Each row corresponds to a channel in the task. Each column corresponds to a sample to write to each channel.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- Returns:
Specifies the actual number of samples this method successfully wrote to each channel in the task.
- Return type:
int
- class nidaqmx.stream_writers.CounterWriter(task_out_stream, auto_start=<nidaqmx.stream_writers.UnsetAutoStartSentinel object>)[source]
Bases:
ChannelWriterBase
Writes samples to a counter output channel in an NI-DAQmx task.
- property auto_start
Specifies if the write method automatically starts the task if you did not explicitly start it with the DAQmx Start Task method.
If you do not specify a value for this parameter, NI-DAQmx determines its value based on the type of write method used. If you use a one sample write method, its value is True; conversely, if you use a many sample write method, its value is False.
- Type:
bool
- property verify_array_shape
Indicates whether the size and shape of the user-defined NumPy arrays passed to read methods are verified. Defaults to True when this object is instantiated.
Setting this property to True may marginally adversely impact the performance of read methods.
- Type:
bool
- write_many_sample_pulse_frequency(frequencies, duty_cycles, timeout=10.0)[source]
Writes one or more pulse samples in terms of frequency to a single counter output channel in a task.
If the task uses on-demand timing, this method returns only after the device generates all samples. On-demand is the default timing type if you do not use the timing property on the task to configure a sample timing type. If the task uses any timing type other than on-demand, this method returns immediately and does not wait for the device to generate all samples. Your application must determine if the task is done to ensure that the device generated all samples.
- Parameters:
frequencies (numpy.ndarray) – Contains a 1D NumPy array of floating-point values that holds the frequency portion of the pulse samples to write to the task. Each element of the array corresponds to a sample to write.
duty_cycles (numpy.ndarray) – Contains a 1D NumPy array of floating-point values that holds the duty cycle portion of the pulse samples to write to the task. Each element of the array corresponds to a sample to write.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- Returns:
Specifies the actual number of samples this method successfully wrote.
- Return type:
int
- write_many_sample_pulse_ticks(high_ticks, low_ticks, timeout=10.0)[source]
Writes one or more pulse samples in terms of ticks to a single counter output channel in a task.
If the task uses on-demand timing, this method returns only after the device generates all samples. On-demand is the default timing type if you do not use the timing property on the task to configure a sample timing type. If the task uses any timing type other than on-demand, this method returns immediately and does not wait for the device to generate all samples. Your application must determine if the task is done to ensure that the device generated all samples.
- Parameters:
high_ticks (numpy.ndarray) – Contains a 1D NumPy array of 32-bit unsigned integer values that holds the high ticks portion of the pulse samples to write to the task. Each element of the array corresponds to a sample to write.
low_ticks (numpy.ndarray) – Contains a 1D NumPy array of 32-bit unsigned integer values that holds the low ticks portion of the pulse samples to write to the task. Each element of the array corresponds to a sample to write.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- Returns:
Specifies the actual number of samples this method successfully wrote.
- Return type:
int
- write_many_sample_pulse_time(high_times, low_times, timeout=10.0)[source]
Writes one or more pulse samples in terms of time to a single counter output channel in a task.
If the task uses on-demand timing, this method returns only after the device generates all samples. On-demand is the default timing type if you do not use the timing property on the task to configure a sample timing type. If the task uses any timing type other than on-demand, this method returns immediately and does not wait for the device to generate all samples. Your application must determine if the task is done to ensure that the device generated all samples.
- Parameters:
high_times (numpy.ndarray) – Contains a 1D NumPy array of floating-point values that holds the high time portion of the pulse samples to write to the task. Each element of the array corresponds to a sample to write.
low_times (numpy.ndarray) – Contains a 1D NumPy array of floating-point values that holds the low time portion of the pulse samples to write to the task. Each element of the array corresponds to a sample to write.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- Returns:
Specifies the actual number of samples this method successfully wrote.
- Return type:
int
- write_one_sample_pulse_frequency(frequency, duty_cycle, timeout=10)[source]
Writes a new pulse frequency and duty cycle to a single counter output channel in a task.
- Parameters:
frequency (float) – Specifies at what frequency to generate pulses.
duty_cycle (float) – Specifies the width of the pulse divided by the pulse period. NI-DAQmx uses this ratio combined with frequency to determine pulse width and the interval between pulses.
auto_start (Optional[bool]) – Specifies if this method automatically starts the task if you did not explicitly start it with the DAQmx Start Task method.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- write_one_sample_pulse_ticks(high_ticks, low_ticks, timeout=10)[source]
Writes a new pulse high tick count and low tick count to a single counter output channel in a task.
- Parameters:
high_ticks (float) – Specifies the number of ticks the pulse is high.
low_ticks (float) – Specifies the number of ticks the pulse is low.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- write_one_sample_pulse_time(high_time, low_time, timeout=10)[source]
Writes a new pulse high time and low time to a single counter output channel in a task.
- Parameters:
high_time (float) – Specifies the amount of time the pulse is high.
low_time (float) – Specifies the amount of time the pulse is low.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- class nidaqmx.stream_writers.DigitalMultiChannelWriter(task_out_stream, auto_start=<nidaqmx.stream_writers.UnsetAutoStartSentinel object>)[source]
Bases:
ChannelWriterBase
Writes samples to one or more digital output channels in an NI-DAQmx task.
- property auto_start
Specifies if the write method automatically starts the task if you did not explicitly start it with the DAQmx Start Task method.
If you do not specify a value for this parameter, NI-DAQmx determines its value based on the type of write method used. If you use a one sample write method, its value is True; conversely, if you use a many sample write method, its value is False.
- Type:
bool
- property verify_array_shape
Indicates whether the size and shape of the user-defined NumPy arrays passed to read methods are verified. Defaults to True when this object is instantiated.
Setting this property to True may marginally adversely impact the performance of read methods.
- Type:
bool
- write_many_sample_port_byte(data, timeout=10.0)[source]
Writes one or more 8-bit unsigned integer samples to one or more digital output channels in a task.
Use this method for devices with up to 8 lines per port.
If the task uses on-demand timing, this method returns only after the device generates all samples. On-demand is the default timing type if you do not use the timing property on the task to configure a sample timing type. If the task uses any timing type other than on-demand, this method returns immediately and does not wait for the device to generate all samples. Your application must determine if the task is done to ensure that the device generated all samples.
- Parameters:
data (numpy.ndarray) –
Contains a 2D NumPy array of 8-bit unsigned integer samples to write to the task.
Each row corresponds to a channel in the task. Each column corresponds to a sample to write to each channel. The order of the channels in the array corresponds to the order in which you add the channels to the task.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- Returns:
Specifies the actual number of samples this method successfully wrote to each channel in the task.
- Return type:
int
- write_many_sample_port_uint16(data, timeout=10.0)[source]
Writes one or more 16-bit unsigned integer samples to one or more digital output channels in a task.
Use this method for devices with up to 16 lines per port.
If the task uses on-demand timing, this method returns only after the device generates all samples. On-demand is the default timing type if you do not use the timing property on the task to configure a sample timing type. If the task uses any timing type other than on-demand, this method returns immediately and does not wait for the device to generate all samples. Your application must determine if the task is done to ensure that the device generated all samples.
- Parameters:
data (numpy.ndarray) –
Contains a 2D NumPy array of 16-bit unsigned integer samples to write to the task.
Each row corresponds to a channel in the task. Each column corresponds to a sample to write to each channel. The order of the channels in the array corresponds to the order in which you add the channels to the task.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- Returns:
Specifies the actual number of samples this method successfully wrote to each channel in the task.
- Return type:
int
- write_many_sample_port_uint32(data, timeout=10.0)[source]
Writes one or more 32-bit unsigned integer samples to one or more digital output channels in a task.
Use this method for devices with up to 32 lines per port.
If the task uses on-demand timing, this method returns only after the device generates all samples. On-demand is the default timing type if you do not use the timing property on the task to configure a sample timing type. If the task uses any timing type other than on-demand, this method returns immediately and does not wait for the device to generate all samples. Your application must determine if the task is done to ensure that the device generated all samples.
- Parameters:
data (numpy.ndarray) –
Contains a 2D NumPy array of 32-bit unsigned integer samples to write to the task.
Each row corresponds to a channel in the task. Each column corresponds to a sample to write to each channel. The order of the channels in the array corresponds to the order in which you add the channels to the task.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- Returns:
Specifies the actual number of samples this method successfully wrote to each channel in the task.
- Return type:
int
- write_one_sample_multi_line(data, timeout=10)[source]
Writes a single boolean sample to one or more digital output channels in a task. The channel can contain multiple digital lines.
- Parameters:
data (numpy.ndarray) –
Contains a 2D NumPy array of boolean samples to write to the task.
Each row corresponds to a channel in the task. Each column corresponds to a line from each channel. The order of the channels in the array corresponds to the order in which you add the channels to the task.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- write_one_sample_one_line(data, timeout=10)[source]
Writes a single boolean sample to one or more digital output channels in a task. The channel can contain only one digital line.
- Parameters:
data (numpy.ndarray) –
Contains a 1D NumPy array of boolean samples to write to the task.
Each element in the array corresponds to a channel in the task. The order of the channels in the array corresponds to the order in which you add the channels to the task.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- write_one_sample_port_byte(data, timeout=10)[source]
Writes a single 8-bit unsigned integer sample to one or more digital output channels in a task.
Use this method for devices with up to 8 lines per port.
- Parameters:
data (numpy.ndarray) –
Contains a 1D NumPy array of 8-bit unsigned integer samples to write to the task.
Each element in the array corresponds to a channel in the task. The order of the channels in the array corresponds to the order in which you add the channels to the task.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- write_one_sample_port_uint16(data, timeout=10)[source]
Writes a single 16-bit unsigned integer sample to one or more digital output channels in a task.
Use this method for devices with up to 16 lines per port.
- Parameters:
data (numpy.ndarray) –
Contains a 1D NumPy array of 16-bit unsigned integer samples to write to the task.
Each element in the array corresponds to a channel in the task. The order of the channels in the array corresponds to the order in which you add the channels to the task.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- write_one_sample_port_uint32(data, timeout=10)[source]
Writes a single 32-bit unsigned integer sample to one or more digital output channels in a task.
Use this method for devices with up to 32 lines per port.
- Parameters:
data (numpy.ndarray) –
Contains a 1D NumPy array of 32-bit unsigned integer samples to write to the task.
Each element in the array corresponds to a channel in the task. The order of the channels in the array corresponds to the order in which you add the channels to the task.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- class nidaqmx.stream_writers.DigitalSingleChannelWriter(task_out_stream, auto_start=<nidaqmx.stream_writers.UnsetAutoStartSentinel object>)[source]
Bases:
ChannelWriterBase
Writes samples to a single digital output channel in an NI-DAQmx task.
- property auto_start
Specifies if the write method automatically starts the task if you did not explicitly start it with the DAQmx Start Task method.
If you do not specify a value for this parameter, NI-DAQmx determines its value based on the type of write method used. If you use a one sample write method, its value is True; conversely, if you use a many sample write method, its value is False.
- Type:
bool
- property verify_array_shape
Indicates whether the size and shape of the user-defined NumPy arrays passed to read methods are verified. Defaults to True when this object is instantiated.
Setting this property to True may marginally adversely impact the performance of read methods.
- Type:
bool
- write_many_sample_port_byte(data, timeout=10.0)[source]
Writes one or more 8-bit unsigned integer samples to a single digital output channel in a task.
Use this method for devices with up to 8 lines per port.
If the task uses on-demand timing, this method returns only after the device generates all samples. On-demand is the default timing type if you do not use the timing property on the task to configure a sample timing type. If the task uses any timing type other than on-demand, this method returns immediately and does not wait for the device to generate all samples. Your application must determine if the task is done to ensure that the device generated all samples.
- Parameters:
data (numpy.ndarray) – Contains a 1D NumPy array of 8-bit unsigned integer samples to write to the task. Each element of the array corresponds to a sample to write.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- Returns:
Specifies the actual number of samples this method successfully wrote.
- Return type:
int
- write_many_sample_port_uint16(data, timeout=10.0)[source]
Writes one or more 16-bit unsigned integer samples to a single digital output channel in a task.
Use this method for devices with up to 16 lines per port.
If the task uses on-demand timing, this method returns only after the device generates all samples. On-demand is the default timing type if you do not use the timing property on the task to configure a sample timing type. If the task uses any timing type other than on-demand, this method returns immediately and does not wait for the device to generate all samples. Your application must determine if the task is done to ensure that the device generated all samples.
- Parameters:
data (numpy.ndarray) – Contains a 1D NumPy array of 16-bit unsigned integer samples to write to the task. Each element of the array corresponds to a sample to write.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- Returns:
Specifies the actual number of samples this method successfully wrote.
- Return type:
int
- write_many_sample_port_uint32(data, timeout=10.0)[source]
Writes one or more 32-bit unsigned integer samples to a single digital output channel in a task.
Use this method for devices with up to 32 lines per port.
If the task uses on-demand timing, this method returns only after the device generates all samples. On-demand is the default timing type if you do not use the timing property on the task to configure a sample timing type. If the task uses any timing type other than on-demand, this method returns immediately and does not wait for the device to generate all samples. Your application must determine if the task is done to ensure that the device generated all samples.
- Parameters:
data (numpy.ndarray) – Contains a 1D NumPy array of 32-bit unsigned integer samples to write to the task. Each element of the array corresponds to a sample to write.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- Returns:
Specifies the actual number of samples this method successfully wrote.
- Return type:
int
- write_one_sample_multi_line(data, timeout=10)[source]
Writes a single boolean sample to a single digital output channel in a task. The channel can contain multiple digital lines.
- Parameters:
data (numpy.ndarray) – Contains a 1D NumPy array of boolean samples to write to the task. Each element of the array corresponds to a line in the channel.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- write_one_sample_one_line(data, timeout=10)[source]
Writes a single boolean sample to a single digital output channel in a task. The channel can contain only one digital line.
- Parameters:
data (int) – Specifies the boolean sample to write to the task.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- write_one_sample_port_byte(data, timeout=10)[source]
Writes a single 8-bit unsigned integer sample to a single digital output channel in a task.
Use this method for devices with up to 8 lines per port.
- Parameters:
data (int) – Specifies the 8-bit unsigned integer sample to write to the task.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- write_one_sample_port_uint16(data, timeout=10)[source]
Writes a single 16-bit unsigned integer sample to a single digital output channel in a task.
Use this method for devices with up to 16 lines per port.
- Parameters:
data (int) – Specifies the 16-bit unsigned integer sample to write to the task.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.
- write_one_sample_port_uint32(data, timeout=10)[source]
Writes a single 32-bit unsigned integer sample to a single digital output channel in a task.
Use this method for devices with up to 32 lines per port.
- Parameters:
data (int) – Specifies the 32-bit unsigned integer sample to write to the task.
timeout (Optional[float]) – Specifies the amount of time in seconds to wait for the method to write all samples. NI-DAQmx performs a timeout check only if the method must wait before it writes data. This method returns an error if the time elapses. The default timeout is 10 seconds. If you set timeout to nidaqmx.constants.WAIT_INFINITELY, the method waits indefinitely. If you set timeout to 0, the method tries once to write the submitted samples. If the method could not write all the submitted samples, it returns an error and the number of samples successfully written.