cheminfo / convert-to-jcamp

Convert strings into JCAMP
https://cheminfo.github.io/convert-to-jcamp/
MIT License
0 stars 3 forks source link

Deal with decimal numbers #37

Closed lpatiny closed 2 years ago

lpatiny commented 2 years ago

I don't think we can create XYData in case we have decimal numbers and currently if we are creating spectra for NMR we obtain something like:

8+304421.27539992967+227763.78848199904+176161.46363725318+147601.5182591817+141401.22181545285+158118.31379412257+200351.9279362584+272671.1593962921
8+381531.6650828854+535519.349586897+744979.6837040224+1021663.639834196+1378118.3075384377+1826849.6303817665+2379275.114835502+3044519.5613476764
8+3828144.034121017+4730930.420916007+5747834.206361939+6867438.352520437+8071507.493693481+9335485.143965598+10629303.052269125

if yFactor is unspecified we need to check if all the numbers are integers or not.

If some numbers are not integer we need to invent a yFactor: we need to calculate one and round the number. We can decide that we would go from -233 to +233 integer numbers. This actually means that the maximum number of digits in 10 which seems reasonable.

lpatiny commented 2 years ago

closed by 15659277c2cab5748fee43fa913df9c27487d325