RecordEvolution / IMCtermite

Enables extraction of measurement data from binary files with extension 'raw' used by proprietary software imcFAMOS/imcSTUDIO and facilitates its storage in open source file formats
MIT License
26 stars 8 forks source link

JSONDecodeError: Expecting ',' delimiter #13

Closed JsphSmth closed 2 years ago

JsphSmth commented 2 years ago

I am not sure if this is a bug, or poorly formatted raw files. IMC allows quotes to be used in Unit of the CR block, e.g.:

|CR,1, 64,1, 1.525925474000000e-004, 0.000000000000000e+000,1,6,"mV/V";

However when using quotes around the unit, an error is returned. JSONDecodeError: Expecting ',' delimiter The reason is that the string passed to json\decoder.py is something like the following:

...,"yname":"N_PB_SG_Uni_11","yunit":""mV/V"","significantbits":"16",...

where the quote around the yunit value corrupts the JSON syntax.

Could IMCtermite be written to handle the quote on the Unit?

--

This error can be corrected, if I rewrite the CR block to the following:

|CR,1, 62,1, 1.525925474000000e-004, 0.000000000000000e+000,1,4,mV/V;

--

full traceback

Traceback (most recent call last):

File "<ipython-input-****>", line 1, in data = imcraw.get_channels(True)[0]

File "cython/py_imc_termite.pyx", line 25, in imc_termite.imctermite.get_channels

File "C:****\lib\json__init__.py", line 357, in loads return _default_decoder.decode(s)

File "C:****\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end())

File "C:****\lib\json\decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx)

JSONDecodeError: Expecting ',' delimiter