# DF's definition of significant figures

## Recommended Posts

From logging and export, I haven't been able to determine how DF defines significant figures.

I was taught:

100, 10, 1, 0.01 have one sig figure

110 has two

111 has three

111.1 has four

111.10 has five, etc.

if I have a value that is "66.6", I have to set "Figs" to 1 to get "66.6" logged or exported to csv file.

if set "Figs" to 2, I get "66.60" in output.

##### Share on other sites

I'm not really getting that, though I will say that you get 1 more figure than you specify. Here's what I did to test: I created an export set (selecting Fixed interval/ Snapshot) and created 7 columns. The expression for all 7 columns was 123.456789 but the figs went from 1 to 7. I then got:

Sig figs = value

1 = 120

2 = 123

3 = 123.5

4 = 123.46

5 = 123.457

6 = 123.4568

7 = 123.45679

So as you can see it is giving you the sig figs, plus one figure which is the rounded figure.

##### Share on other sites

I slipped several cogs here.

0.01 two sig figs

111.10 should have been type 111.01 for five sig figs.

The other cog, evidently read the wrong export file when doing this.

x =0 sig, etc.

Output

TheTime, R_date_time, 0 sig, 1 sig, 2 sig, 3 sig, 4 sig, 5 sig, 6 sig

39827.18064,"01/14/09 04:24", 67, 67, 66.7, 66.67, 66.667, 66.6667, 66.66666

with RdToDig(66.66666, x) call

39827.18876,"01/14/09 04:36", 67, 67, 66.7, 66.67, 66.667, 66.6667, 66.66666

with RdToDig(66.66666, x+1)

39827.18953,"01/14/09 04:36", 67, 67, 66.7, 66.67, 66.667, 66.6667, 66.66666

Wrote the RdToDig sequence because I had channels putting out more digits than expected. I didn't think to write the above test export set. Also, it was before I found out that you could put something other than channels in export sets.

Sorry

##### Share on other sites

• 2 weeks later...

Finally got some data for rain. Value 0.01 inches.

Exported as value with 2 for figs.

Output to *.csv file was 0.0100!!!!!!

Granted, that is 2 significant figures, but this value overflows my available column width for the *.html table generated from the *.csv file what with the 2 empty 0's at end.

Any suggestions for truncating this output ??????

Help

eka

##### Share on other sites

Use the format() function, perhaps in combination with the left() function. This means you'd actually be logging a string, but it doesn't really matter. In an export set you can just put the functions in the export set. If using a logging set, you'll either need to use a conversion (which might not like the numeric to string conversion), or create a second channel, and in the first channel's event, have it stick the string data into the second channel, then log that second channel.

##### Share on other sites

• 1 year later...

So quick follow-up questions concerning the creation of a second channel that uses an 'event' in the 1st channel to log the data in a different channel.

Basically, I have a mass flow meter with 3 4-20mA outputs (mass, temp and pressure), going into a current-shunt on a U6 LabJack board, that should convert it to a voltage between 0.472 V (4mA) and 2.360 V (20mA).

Q1 - first, when the VFM has zero flow through it, and displays 0.0000 lbs/hr on the screen, the voltage read by the labjack is actually lower than the 0.472 V minimum; when there's no flow, it reads "~0.465 V". Any ideas how that's possible? I suppose I can calibrate that error out, but it still surprising that a voltage lower than the 4mA-equivalent is being read.

Q2 - I want to log the mass flow in lbs/hr and thus was using a conversion I entered. I want to be able to display the mass flow (in lbs/hr) on the screen, as well as display the received channel voltage (so it would be a quick 'check' to confirm that the voltage being read was within the expected 0.472 - 2.36 V range).

So I made another channel and assumed that I could have one channel merely reading and displaying the voltage, and the other with the conversion applied displaying and logging the lbs/hr mass flow.

However, it seems like both channels were intrinsically-linked, i.e. even though I have the conversion applied to one channel looking at the AIN1 input, it displays exactly the same value as the other channel that didn't have the conversion applied. So even though DAQFactory was definitely applying a conversion to one of the channels, it didn't make a difference.

I spoke with someone from Labjack, and they recommended I set-up a "virtual channel", using the "test" under device and "string" under I/O. Which leads me to my next question:

Q3 - having set-up this "virtual channel", where an event in the 'voltage' channel basically writes to the 'mass flow' channel:

VFM_mass[0] = VFM_mass_voltage[0] * 173 - 60

However, when I display the "VFM_mass" channel on the screen, it doesn't allow me to format it, it displays it with 14 sig figs (I think I counted).

The VFM_mass_voltage displays fine, allowing me to reduce the decimal places down to 2, but the VFM_mass can't be formatted.

Is this because it is a string?

Do I need to try a "StringToDouble" or something so it can be converted back to number for formatting?

FYI - I've attached the code I'm working on and a sample of the data stored, which also needs some work as all the data is being saved to different lines.

Daniel

SierraE_DAQExpress_Config_1.ctl

##### Share on other sites

I think you are making this way more complicated than needed. The rest of this post is about formatting data, not converting it. To format data in a specific way for use in a logging set requires the second string channel. In your case, you are just trying to convert the data. So, you should be able to use a combination of a conversion on the main channel to convert it into whatever units you want to log, and additional math on any screen components to convert it to other units.

And yes, it is displaying 14 sig figs because it is a string channel and you didn't format it otherwise. But let that go and just use normal math.

##### Share on other sites

• 6 months later...

So how could I specify precision to a certain decimal place? I have an instrument outputting atmospheric temperature but only to the tenth of a degree. In the winter, the values are two digits (1 "SF") but in the summer values are three-digits wide. Measurements of rainfall are similar - only outputting to the tenth but the possible range of digits is higher and could vary much faster than the seasons. Am I limited to using the highest expected # of digits - 1 as my SF value?

##### Share on other sites

You kind of can't, but you can simply log extra precision and let your data analysis tool handle it. If you really want to control formatting that much you have to do one of three things:

1) create a string channel, and have the numeric channel set the string channel with the properly formatted data, then log the string channel instead

2) use an export set and format the data in the expression for the export set

3) use the File. functions and log in whatever format you want