Skip to content

Commit

Permalink
Add Offset Nulling Calibration API support for nidaqmx-python (#468)
Browse files Browse the repository at this point in the history
* Add Offset Nulling Calibration API support for nidaqmx-python

* Address comments

* Address comments

* Add indent and fix documentation

* Fix styleguide

* Add proto file to pass PR build

* Add proto file to pass PR build 2

* Fix Pr build 3

* Fix PR build 4

---------

Co-authored-by: Deborah Ooi Yee Hui <deborah.ooi@ni.com>
  • Loading branch information
DeborahOoi96 and Deborah Ooi Yee Hui committed Jan 15, 2024
1 parent 8f1b610 commit c5fddf5
Show file tree
Hide file tree
Showing 13 changed files with 1,482 additions and 995 deletions.
10 changes: 10 additions & 0 deletions generated/nidaqmx/_base_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,11 @@ def is_task_done(self, task):
def load_task(self, session_name):
raise NotImplementedError

@abc.abstractmethod
def perform_bridge_offset_nulling_cal_ex(
self, task, channel, skip_unsupported_channels):
raise NotImplementedError

@abc.abstractmethod
def perform_bridge_shunt_cal_ex(
self, task, channel, shunt_resistor_value,
Expand All @@ -1155,6 +1160,11 @@ def perform_strain_shunt_cal_ex(
shunt_resistor_source, skip_unsupported_channels):
raise NotImplementedError

@abc.abstractmethod
def perform_thrmcpl_lead_offset_nulling_cal(
self, task, channel, skip_unsupported_channels):
raise NotImplementedError

@abc.abstractmethod
def read_analog_f64(
self, task, num_samps_per_chan, timeout, fill_mode, read_array):
Expand Down
16 changes: 16 additions & 0 deletions generated/nidaqmx/_grpc_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2260,6 +2260,14 @@ def load_task(self, session_name):
metadata=metadata)
return response.task, response.new_session_initialized

def perform_bridge_offset_nulling_cal_ex(
self, task, channel, skip_unsupported_channels):
response = self._invoke(
self._client.PerformBridgeOffsetNullingCalEx,
grpc_types.PerformBridgeOffsetNullingCalExRequest(
task=task, channel=channel,
skip_unsupported_channels=skip_unsupported_channels))

def perform_bridge_shunt_cal_ex(
self, task, channel, shunt_resistor_value,
shunt_resistor_location, shunt_resistor_select,
Expand Down Expand Up @@ -2290,6 +2298,14 @@ def perform_strain_shunt_cal_ex(
shunt_resistor_source_raw=shunt_resistor_source,
skip_unsupported_channels=skip_unsupported_channels))

def perform_thrmcpl_lead_offset_nulling_cal(
self, task, channel, skip_unsupported_channels):
response = self._invoke(
self._client.PerformThrmcplLeadOffsetNullingCal,
grpc_types.PerformThrmcplLeadOffsetNullingCalRequest(
task=task, channel=channel,
skip_unsupported_channels=skip_unsupported_channels))

def read_analog_f64(
self, task, num_samps_per_chan, timeout, fill_mode, read_array):
_validate_array_dtype(read_array, numpy.float64)
Expand Down
26 changes: 26 additions & 0 deletions generated/nidaqmx/_library_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3877,6 +3877,19 @@ def load_task(self, session_name):
self.check_for_error(error_code)
return task, new_session_initialized

def perform_bridge_offset_nulling_cal_ex(
self, task, channel, skip_unsupported_channels):
cfunc = lib_importer.windll.DAQmxPerformBridgeOffsetNullingCalEx
if cfunc.argtypes is None:
with cfunc.arglock:
if cfunc.argtypes is None:
cfunc.argtypes = [
lib_importer.task_handle, ctypes_byte_str, c_bool32]

error_code = cfunc(
task, channel, skip_unsupported_channels)
self.check_for_error(error_code)

def perform_bridge_shunt_cal_ex(
self, task, channel, shunt_resistor_value,
shunt_resistor_location, shunt_resistor_select,
Expand Down Expand Up @@ -3916,6 +3929,19 @@ def perform_strain_shunt_cal_ex(
skip_unsupported_channels)
self.check_for_error(error_code)

def perform_thrmcpl_lead_offset_nulling_cal(
self, task, channel, skip_unsupported_channels):
cfunc = lib_importer.windll.DAQmxPerformThrmcplLeadOffsetNullingCal
if cfunc.argtypes is None:
with cfunc.arglock:
if cfunc.argtypes is None:
cfunc.argtypes = [
lib_importer.task_handle, ctypes_byte_str, c_bool32]

error_code = cfunc(
task, channel, skip_unsupported_channels)
self.check_for_error(error_code)

def read_analog_f64(
self, task, num_samps_per_chan, timeout, fill_mode, read_array):
samps_per_chan_read = ctypes.c_int()
Expand Down
1,994 changes: 1,001 additions & 993 deletions generated/nidaqmx/_stubs/nidaqmx_pb2.py

Large diffs are not rendered by default.

76 changes: 76 additions & 0 deletions generated/nidaqmx/_stubs/nidaqmx_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -21264,6 +21264,44 @@ class LoadTaskResponse(google.protobuf.message.Message):

global___LoadTaskResponse = LoadTaskResponse

@typing_extensions.final
class PerformBridgeOffsetNullingCalExRequest(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor

TASK_FIELD_NUMBER: builtins.int
CHANNEL_FIELD_NUMBER: builtins.int
SKIP_UNSUPPORTED_CHANNELS_FIELD_NUMBER: builtins.int
@property
def task(self) -> session_pb2.Session: ...
channel: builtins.str
skip_unsupported_channels: builtins.bool
def __init__(
self,
*,
task: session_pb2.Session | None = ...,
channel: builtins.str = ...,
skip_unsupported_channels: builtins.bool = ...,
) -> None: ...
def HasField(self, field_name: typing_extensions.Literal["task", b"task"]) -> builtins.bool: ...
def ClearField(self, field_name: typing_extensions.Literal["channel", b"channel", "skip_unsupported_channels", b"skip_unsupported_channels", "task", b"task"]) -> None: ...

global___PerformBridgeOffsetNullingCalExRequest = PerformBridgeOffsetNullingCalExRequest

@typing_extensions.final
class PerformBridgeOffsetNullingCalExResponse(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor

STATUS_FIELD_NUMBER: builtins.int
status: builtins.int
def __init__(
self,
*,
status: builtins.int = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["status", b"status"]) -> None: ...

global___PerformBridgeOffsetNullingCalExResponse = PerformBridgeOffsetNullingCalExResponse

@typing_extensions.final
class PerformBridgeShuntCalExRequest(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
Expand Down Expand Up @@ -21397,6 +21435,44 @@ class PerformStrainShuntCalExResponse(google.protobuf.message.Message):

global___PerformStrainShuntCalExResponse = PerformStrainShuntCalExResponse

@typing_extensions.final
class PerformThrmcplLeadOffsetNullingCalRequest(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor

TASK_FIELD_NUMBER: builtins.int
CHANNEL_FIELD_NUMBER: builtins.int
SKIP_UNSUPPORTED_CHANNELS_FIELD_NUMBER: builtins.int
@property
def task(self) -> session_pb2.Session: ...
channel: builtins.str
skip_unsupported_channels: builtins.bool
def __init__(
self,
*,
task: session_pb2.Session | None = ...,
channel: builtins.str = ...,
skip_unsupported_channels: builtins.bool = ...,
) -> None: ...
def HasField(self, field_name: typing_extensions.Literal["task", b"task"]) -> builtins.bool: ...
def ClearField(self, field_name: typing_extensions.Literal["channel", b"channel", "skip_unsupported_channels", b"skip_unsupported_channels", "task", b"task"]) -> None: ...

global___PerformThrmcplLeadOffsetNullingCalRequest = PerformThrmcplLeadOffsetNullingCalRequest

@typing_extensions.final
class PerformThrmcplLeadOffsetNullingCalResponse(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor

STATUS_FIELD_NUMBER: builtins.int
status: builtins.int
def __init__(
self,
*,
status: builtins.int = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["status", b"status"]) -> None: ...

global___PerformThrmcplLeadOffsetNullingCalResponse = PerformThrmcplLeadOffsetNullingCalResponse

@typing_extensions.final
class ReadAnalogF64Request(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor
Expand Down
66 changes: 66 additions & 0 deletions generated/nidaqmx/_stubs/nidaqmx_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,11 @@ def __init__(self, channel):
request_serializer=nidaqmx__pb2.LoadTaskRequest.SerializeToString,
response_deserializer=nidaqmx__pb2.LoadTaskResponse.FromString,
)
self.PerformBridgeOffsetNullingCalEx = channel.unary_unary(
'/nidaqmx_grpc.NiDAQmx/PerformBridgeOffsetNullingCalEx',
request_serializer=nidaqmx__pb2.PerformBridgeOffsetNullingCalExRequest.SerializeToString,
response_deserializer=nidaqmx__pb2.PerformBridgeOffsetNullingCalExResponse.FromString,
)
self.PerformBridgeShuntCalEx = channel.unary_unary(
'/nidaqmx_grpc.NiDAQmx/PerformBridgeShuntCalEx',
request_serializer=nidaqmx__pb2.PerformBridgeShuntCalExRequest.SerializeToString,
Expand All @@ -1224,6 +1229,11 @@ def __init__(self, channel):
request_serializer=nidaqmx__pb2.PerformStrainShuntCalExRequest.SerializeToString,
response_deserializer=nidaqmx__pb2.PerformStrainShuntCalExResponse.FromString,
)
self.PerformThrmcplLeadOffsetNullingCal = channel.unary_unary(
'/nidaqmx_grpc.NiDAQmx/PerformThrmcplLeadOffsetNullingCal',
request_serializer=nidaqmx__pb2.PerformThrmcplLeadOffsetNullingCalRequest.SerializeToString,
response_deserializer=nidaqmx__pb2.PerformThrmcplLeadOffsetNullingCalResponse.FromString,
)
self.ReadAnalogF64 = channel.unary_unary(
'/nidaqmx_grpc.NiDAQmx/ReadAnalogF64',
request_serializer=nidaqmx__pb2.ReadAnalogF64Request.SerializeToString,
Expand Down Expand Up @@ -3429,6 +3439,12 @@ def LoadTask(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def PerformBridgeOffsetNullingCalEx(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def PerformBridgeShuntCalEx(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
Expand All @@ -3441,6 +3457,12 @@ def PerformStrainShuntCalEx(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def PerformThrmcplLeadOffsetNullingCal(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ReadAnalogF64(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
Expand Down Expand Up @@ -5556,6 +5578,11 @@ def add_NiDAQmxServicer_to_server(servicer, server):
request_deserializer=nidaqmx__pb2.LoadTaskRequest.FromString,
response_serializer=nidaqmx__pb2.LoadTaskResponse.SerializeToString,
),
'PerformBridgeOffsetNullingCalEx': grpc.unary_unary_rpc_method_handler(
servicer.PerformBridgeOffsetNullingCalEx,
request_deserializer=nidaqmx__pb2.PerformBridgeOffsetNullingCalExRequest.FromString,
response_serializer=nidaqmx__pb2.PerformBridgeOffsetNullingCalExResponse.SerializeToString,
),
'PerformBridgeShuntCalEx': grpc.unary_unary_rpc_method_handler(
servicer.PerformBridgeShuntCalEx,
request_deserializer=nidaqmx__pb2.PerformBridgeShuntCalExRequest.FromString,
Expand All @@ -5566,6 +5593,11 @@ def add_NiDAQmxServicer_to_server(servicer, server):
request_deserializer=nidaqmx__pb2.PerformStrainShuntCalExRequest.FromString,
response_serializer=nidaqmx__pb2.PerformStrainShuntCalExResponse.SerializeToString,
),
'PerformThrmcplLeadOffsetNullingCal': grpc.unary_unary_rpc_method_handler(
servicer.PerformThrmcplLeadOffsetNullingCal,
request_deserializer=nidaqmx__pb2.PerformThrmcplLeadOffsetNullingCalRequest.FromString,
response_serializer=nidaqmx__pb2.PerformThrmcplLeadOffsetNullingCalResponse.SerializeToString,
),
'ReadAnalogF64': grpc.unary_unary_rpc_method_handler(
servicer.ReadAnalogF64,
request_deserializer=nidaqmx__pb2.ReadAnalogF64Request.FromString,
Expand Down Expand Up @@ -10416,6 +10448,23 @@ def LoadTask(request,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def PerformBridgeOffsetNullingCalEx(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/nidaqmx_grpc.NiDAQmx/PerformBridgeOffsetNullingCalEx',
nidaqmx__pb2.PerformBridgeOffsetNullingCalExRequest.SerializeToString,
nidaqmx__pb2.PerformBridgeOffsetNullingCalExResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def PerformBridgeShuntCalEx(request,
target,
Expand Down Expand Up @@ -10450,6 +10499,23 @@ def PerformStrainShuntCalEx(request,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def PerformThrmcplLeadOffsetNullingCal(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/nidaqmx_grpc.NiDAQmx/PerformThrmcplLeadOffsetNullingCal',
nidaqmx__pb2.PerformThrmcplLeadOffsetNullingCalRequest.SerializeToString,
nidaqmx__pb2.PerformThrmcplLeadOffsetNullingCalResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def ReadAnalogF64(request,
target,
Expand Down
28 changes: 28 additions & 0 deletions generated/nidaqmx/_stubs/nidaqmx_pb2_grpc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,10 @@ class NiDAQmxStub:
nidaqmx_pb2.LoadTaskRequest,
nidaqmx_pb2.LoadTaskResponse,
]
PerformBridgeOffsetNullingCalEx: grpc.UnaryUnaryMultiCallable[
nidaqmx_pb2.PerformBridgeOffsetNullingCalExRequest,
nidaqmx_pb2.PerformBridgeOffsetNullingCalExResponse,
]
PerformBridgeShuntCalEx: grpc.UnaryUnaryMultiCallable[
nidaqmx_pb2.PerformBridgeShuntCalExRequest,
nidaqmx_pb2.PerformBridgeShuntCalExResponse,
Expand All @@ -992,6 +996,10 @@ class NiDAQmxStub:
nidaqmx_pb2.PerformStrainShuntCalExRequest,
nidaqmx_pb2.PerformStrainShuntCalExResponse,
]
PerformThrmcplLeadOffsetNullingCal: grpc.UnaryUnaryMultiCallable[
nidaqmx_pb2.PerformThrmcplLeadOffsetNullingCalRequest,
nidaqmx_pb2.PerformThrmcplLeadOffsetNullingCalResponse,
]
ReadAnalogF64: grpc.UnaryUnaryMultiCallable[
nidaqmx_pb2.ReadAnalogF64Request,
nidaqmx_pb2.ReadAnalogF64Response,
Expand Down Expand Up @@ -2562,6 +2570,10 @@ class NiDAQmxAsyncStub:
nidaqmx_pb2.LoadTaskRequest,
nidaqmx_pb2.LoadTaskResponse,
]
PerformBridgeOffsetNullingCalEx: grpc.aio.UnaryUnaryMultiCallable[
nidaqmx_pb2.PerformBridgeOffsetNullingCalExRequest,
nidaqmx_pb2.PerformBridgeOffsetNullingCalExResponse,
]
PerformBridgeShuntCalEx: grpc.aio.UnaryUnaryMultiCallable[
nidaqmx_pb2.PerformBridgeShuntCalExRequest,
nidaqmx_pb2.PerformBridgeShuntCalExResponse,
Expand All @@ -2570,6 +2582,10 @@ class NiDAQmxAsyncStub:
nidaqmx_pb2.PerformStrainShuntCalExRequest,
nidaqmx_pb2.PerformStrainShuntCalExResponse,
]
PerformThrmcplLeadOffsetNullingCal: grpc.aio.UnaryUnaryMultiCallable[
nidaqmx_pb2.PerformThrmcplLeadOffsetNullingCalRequest,
nidaqmx_pb2.PerformThrmcplLeadOffsetNullingCalResponse,
]
ReadAnalogF64: grpc.aio.UnaryUnaryMultiCallable[
nidaqmx_pb2.ReadAnalogF64Request,
nidaqmx_pb2.ReadAnalogF64Response,
Expand Down Expand Up @@ -4621,6 +4637,12 @@ class NiDAQmxServicer(metaclass=abc.ABCMeta):
context: _ServicerContext,
) -> typing.Union[nidaqmx_pb2.LoadTaskResponse, collections.abc.Awaitable[nidaqmx_pb2.LoadTaskResponse]]: ...
@abc.abstractmethod
def PerformBridgeOffsetNullingCalEx(
self,
request: nidaqmx_pb2.PerformBridgeOffsetNullingCalExRequest,
context: _ServicerContext,
) -> typing.Union[nidaqmx_pb2.PerformBridgeOffsetNullingCalExResponse, collections.abc.Awaitable[nidaqmx_pb2.PerformBridgeOffsetNullingCalExResponse]]: ...
@abc.abstractmethod
def PerformBridgeShuntCalEx(
self,
request: nidaqmx_pb2.PerformBridgeShuntCalExRequest,
Expand All @@ -4633,6 +4655,12 @@ class NiDAQmxServicer(metaclass=abc.ABCMeta):
context: _ServicerContext,
) -> typing.Union[nidaqmx_pb2.PerformStrainShuntCalExResponse, collections.abc.Awaitable[nidaqmx_pb2.PerformStrainShuntCalExResponse]]: ...
@abc.abstractmethod
def PerformThrmcplLeadOffsetNullingCal(
self,
request: nidaqmx_pb2.PerformThrmcplLeadOffsetNullingCalRequest,
context: _ServicerContext,
) -> typing.Union[nidaqmx_pb2.PerformThrmcplLeadOffsetNullingCalResponse, collections.abc.Awaitable[nidaqmx_pb2.PerformThrmcplLeadOffsetNullingCalResponse]]: ...
@abc.abstractmethod
def ReadAnalogF64(
self,
request: nidaqmx_pb2.ReadAnalogF64Request,
Expand Down
Loading

0 comments on commit c5fddf5

Please sign in to comment.