incf-nidash / nidmresults-fsl

A python library to export FSL's feat results to NIDM-Results
http://nidm.nidash.org/specs/nidm-results.html
MIT License
3 stars 10 forks source link

Output not JSON-compliant #152

Open mih opened 5 years ago

mih commented 5 years ago

From https://www.ietf.org/rfc/rfc4627.txt

2.4. Numbers [...] Numeric values that cannot be represented as sequences of digits (such as Infinity and NaN) are not permitted.

but I do get:

        {
          "@id": "niiri:69b8b19c-4935-49db-84f9-af5c861cd18b",
          "@type": [
            "nidm_StatisticMap",
            "prov:Entity"
          ],
          "crypto:sha512": "6e716b6d6b0f506e35733bcae079ce4ad05df1fc213959bcef4774dbe48c568200a088eef874b694b23ededfdfe228c4ec668a9a9571b4d70302cc23b5bf6b87",
          "dct:format": "image/nifti",
          "nfo:fileName": "ZStatistic.nii.gz",
          "nidm_contrastName": "group mean",
          "nidm_effectDegreesOfFreedom": 1.0,
          "nidm_errorDegreesOfFreedom": Infinity,
          "nidm_inCoordinateSpace": {
            "@id": "niiri:795dccdb-9b92-4b4d-ac43-51a4a5a50e73"
          },

This breaks JSON toolchains.

From https://stackoverflow.com/a/14627638

One solution is to encode +inf as +1e9999 as that will naturally overflow to +inf in most decoders, and same with -inf as -1e9999.