From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Collecting TC measurements with nidaqmx python module - rounding decimal place during measurement

I've been following this (https://www.youtube.com/watch?v=NMMRbPvkzFs) video to use the python nidaqmx module to collect TC measurements with a cDAQ-9172 chassis and 9211 card.

 

The following code is directly from the video (except I'm using my own DAQ):

 

with nidaqmx.Task() as task:

    task.ai_channels.add_ai_thrmcpl_chan("cDAQ1Mod3/ai3")

    while i < 30:

        data = task.read()

        print(data)

 

 

This prints out temperature values like this:

24.983256110305593

 

Does any one know if there is built in support via the module to round the collected data point down to 24.98? I can do this downstream if really need be, but I am specifically interested in knowing if I can record data points at 2 decimal places with the nidaqmx module instead.

 

thanks!

 

 

0 Kudos
Message 1 of 2
(892 Views)

Probably not. The API will return the data as a double precision floating point value. You'll have to do whatever kind of formatting you want later on, as suspected. 

Nathan Murphy
0 Kudos
Message 2 of 2
(827 Views)