Menu

#277 Taurustrend export to ascii rounds off numbers

I['Jul16', '']
resolved
taurus4 (70)
bug
2016-07-15
2016-04-06
Ludvig K
No

Data exported with taurustrend is rounded off but the data is clearly visible in the plot.
For example:

Data is exported as

    2016-03-23_16:30:06.418375  1
    2016-03-23_16:30:09.418396  1
    2016-03-23_16:30:12.418492  1
    2016-03-23_16:30:15.418351  1
    2016-03-23_16:30:57.418210  1

When it should be

    2016-03-23_17:05:43.190242  1.0
    2016-03-23_17:05:46.190838  1.0000000000001
    2016-03-23_17:05:49.190763  1.0000000000001998
    2016-03-23_17:05:52.190034  1.0000000000002998
    2016-03-23_17:05:55.190817  1.0000000000003997
    2016-03-23_17:05:58.190714  1.0000000000004996
    2016-03-23_17:06:01.190875  1.0000000000005995
    2016-03-23_17:06:04.190881  1.0000000000006994
    2016-03-23_17:06:07.190186  1.0000000000007994
    2016-03-23_17:06:10.190832  1.0000000000008993
    2016-03-23_17:06:13.188450  1.0000000000009992

Steps for reproduction
1. Open up taurustrend and read sys/tg_test/1/double_scalar_w
2. Write data to double_scalar_w using python

at = pt.AttributeProxy("sys/tg_test/1/double_scalar_w")
ydata = np.arange(1,1.000000000001,0.0000000000001)
for a in ydata:
    at.write(a)
    time.sleep(3)
    print a
  1. Export the data to ascii and you will get the results printed above, with and without patch.

Proposed fix
Changing %g to repr() in QDataExportDialog will not round off the python objects but instead export the string representation. Also see attached patch.

1 Attachments

Discussion

  • Carlos Falcon

    Carlos Falcon - 2016-05-27

    Hi Ludvig,
    I could reproduce the bug and reviewed the patch, and I'm agree with your solution.

    As a comment for the integrator, I will prefer create the string without using the append command, and fix the PEP8.

    Thanks so much!!

     
  • Carlos Falcon

    Carlos Falcon - 2016-06-09
    • labels: --> taurus4
    • assigned_to: Carlos Falcon
    • Milestone: unassigned --> taurus4
     
  • Carlos Falcon

    Carlos Falcon - 2016-06-09

    The patch has been applied in Taurus 3.7.2. It is still pending do it in develop (Taurus 4).

    Thanks,
    Carlos

     
  • Carlos Pascual

    Carlos Pascual - 2016-07-14
    • status: waiting --> resolved
     
  • Carlos Pascual

    Carlos Pascual - 2016-07-14

    Fixed in develop.

    Thanks for the contribution!

     
  • Carlos Pascual

    Carlos Pascual - 2016-07-15
    • Category: taurus4 --> Jul16,