markummitchell / engauge-digitizer

Extracts data points from images of graphs
GNU General Public License v2.0
1.23k stars 212 forks source link

force decimal separator '.'? #442

Open randfee opened 4 months ago

randfee commented 4 months ago

Hi,

I would appreciate an option to force '.' as decimal separator. I tried to set settings/mainwindow/locale, which was described here: .. but that didn't work. The field appears empty with no list to choose from and no ability to input something. When I start and start adding the three axes points I see that it states 'Germany' but that also can't be changed.

Therefore my recommendation would be to simply offer an option to force '.' as decimal separator somewhere (maybe the export format window OR a simple addition to the "edit axis point" window?

2024-04-25 09_57_25-Window 2024-04-25 09_56_03-Window

aa956 commented 3 months ago

Same problem with locale having ',' as a decimal separator: image

One more note: CSV is exported broken as both decimal and list separators used are , (comma), although as far as I know list separator for et-EE locale should be ; (semicolon).

So CSV export results are unusable without extensive postprocessing (as just a subset of the numeric values are in quotes):

x,curve,curve-1
"1,01099","99,553","99,105"
"1,27795","99,532","99,1"
"1,6169","99,554","99,089"
"3,0781","99,514","99,035"
4127,"83,818","82,533"
"5022,7","81,882","82,537"

As a work-around TSV export that is run through sed replacing first , with . and then \t with , yields usable result without too much work to parse the CSV export results.

aa956 commented 3 months ago

One more problem probably with the same cause: broken localization.

Export of negative numbers to TSV results in "?" instead of "-" prefix for a number (sample data with x starting at -180):

x   Sample1 Sample2
?180,093    44,266  32,049
?180,061    44,267  32,049
?165,112    44,568  32,049

So at the moment workaround to prepare CSV from TSV looks like:

For example:

sed -e 's/\?/\-/g' -e 's/\,/\./g' -e 's/\t/\,/g' data.tsv > data.csv