Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ndarray.size instead of numpy.prod #180

Merged
merged 1 commit into from
Jun 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions nidaqmx/_task_modules/read_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def _read_analog_f_64(

error_code = cfunc(
task_handle, num_samps_per_chan, timeout, fill_mode.value,
read_array, numpy.prod(read_array.shape),
read_array, read_array.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand Down Expand Up @@ -71,7 +71,7 @@ def _read_power_f_64(

error_code = cfunc(
task_handle, num_samps_per_chan, timeout, fill_mode.value,
read_voltage_array, read_current_array, numpy.prod(read_voltage_array.shape),
read_voltage_array, read_current_array, read_voltage_array.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand Down Expand Up @@ -120,7 +120,7 @@ def _read_power_i_16(

error_code = cfunc(
task_handle, num_samps_per_chan, timeout, fill_mode.value,
read_voltage_array, read_current_array, numpy.prod(read_voltage_array.shape),
read_voltage_array, read_current_array, read_voltage_array.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand All @@ -145,7 +145,7 @@ def _read_binary_i_16(

error_code = cfunc(
task_handle, num_samps_per_chan, timeout, fill_mode.value,
read_array, numpy.prod(read_array.shape),
read_array, read_array.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand All @@ -170,7 +170,7 @@ def _read_binary_u_16(

error_code = cfunc(
task_handle, num_samps_per_chan, timeout, fill_mode.value,
read_array, numpy.prod(read_array.shape),
read_array, read_array.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand All @@ -195,7 +195,7 @@ def _read_binary_i_32(

error_code = cfunc(
task_handle, num_samps_per_chan, timeout, fill_mode.value,
read_array, numpy.prod(read_array.shape),
read_array, read_array.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand All @@ -220,7 +220,7 @@ def _read_binary_u_32(

error_code = cfunc(
task_handle, num_samps_per_chan, timeout, fill_mode.value,
read_array, numpy.prod(read_array.shape),
read_array, read_array.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand All @@ -245,7 +245,7 @@ def _read_digital_u_8(

error_code = cfunc(
task_handle, num_samps_per_chan, timeout, fill_mode.value,
read_array, numpy.prod(read_array.shape),
read_array, read_array.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand All @@ -270,7 +270,7 @@ def _read_digital_u_16(

error_code = cfunc(
task_handle, num_samps_per_chan, timeout, fill_mode.value,
read_array, numpy.prod(read_array.shape),
read_array, read_array.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand All @@ -295,7 +295,7 @@ def _read_digital_u_32(

error_code = cfunc(
task_handle, num_samps_per_chan, timeout, fill_mode.value,
read_array, numpy.prod(read_array.shape),
read_array, read_array.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand Down Expand Up @@ -339,7 +339,7 @@ def _read_digital_lines(

error_code = cfunc(
task_handle, num_samps_per_chan, timeout, fill_mode.value,
read_array, numpy.prod(read_array.shape),
read_array, read_array.size,
ctypes.byref(samps_per_chan_read),
ctypes.byref(num_bytes_per_samp), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)
Expand Down Expand Up @@ -368,7 +368,7 @@ def _read_counter_f_64(task_handle, read_array, num_samps_per_chan, timeout):

error_code = cfunc(
task_handle, num_samps_per_chan, timeout,
read_array, numpy.prod(read_array.shape),
read_array, read_array.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand All @@ -390,7 +390,7 @@ def _read_counter_u_32(task_handle, read_array, num_samps_per_chan, timeout):

error_code = cfunc(
task_handle, num_samps_per_chan, timeout,
read_array, numpy.prod(read_array.shape),
read_array, read_array.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand All @@ -415,7 +415,7 @@ def _read_counter_f_64_ex(

error_code = cfunc(
task_handle, num_samps_per_chan, timeout, fill_mode.value,
read_array, numpy.prod(read_array.shape),
read_array, read_array.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand All @@ -440,7 +440,7 @@ def _read_counter_u_32_ex(

error_code = cfunc(
task_handle, num_samps_per_chan, timeout, fill_mode.value,
read_array, numpy.prod(read_array.shape),
read_array, read_array.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand Down Expand Up @@ -502,7 +502,7 @@ def _read_ctr_freq(

error_code = cfunc(
task_handle, num_samps_per_chan, timeout, interleaved.value,
freq, duty_cycle, numpy.prod(freq.shape),
freq, duty_cycle, freq.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand All @@ -528,7 +528,7 @@ def _read_ctr_time(

error_code = cfunc(
task_handle, num_samps_per_chan, timeout, interleaved.value,
high_time, low_time, numpy.prod(high_time.shape),
high_time, low_time, high_time.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand All @@ -554,7 +554,7 @@ def _read_ctr_ticks(

error_code = cfunc(
task_handle, num_samps_per_chan, timeout, interleaved.value,
high_tick, low_tick, numpy.prod(high_tick.shape),
high_tick, low_tick, high_tick.size,
ctypes.byref(samps_per_chan_read), None)
check_for_error(error_code, samps_per_chan_read=samps_per_chan_read.value)

Expand Down