Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Probe file should be in JSON format #2

Open
thesamovar opened this issue Mar 19, 2013 · 3 comments
Open

Probe file should be in JSON format #2

thesamovar opened this issue Mar 19, 2013 · 3 comments
Assignees

Comments

@thesamovar
Copy link
Member

No description provided.

@ghost ghost assigned thesamovar and rossant Mar 19, 2013
@rossant
Copy link
Member

rossant commented Mar 31, 2013

@thesamovar @shabnamkadir Another option is to use YAML, a superset of JSON.

JSON example:

{
    "nchannels": 8,
    "shanks": [
        {
            "geometry": [[0, 0], [1, 1]]
        }
    ]
}

The same in YAML:

nchannels: 8
shanks:
    # Some comments
    - geometry: [[0, 0], [1, 1]]
    • More human-readable format, especially for a non-computer scientist. There are less ways of making a parse error with a missing } or ].
    • One can write comments (no comments in JSON).
    • Less widely used than JSON
    • Parsing libraries exist for most languages but are not native (need to add new external dependency). A pure Python library exists.

Here is an interesting link.

What do you think?

@thesamovar
Copy link
Member Author

The benefit of JSON is its wide readability. I'd say if we were thinking about using YAML we may as well use the existing Python solution, which is just as readable. Certainly, the value stored in the HDF5 file should be in JSON I think.

@kylerbrown
Copy link

One issue with python .probe file is that, in my experience, they behave unpredictably, for example I can generate the graph like so:

probes = { 1: [(nexus32toRHD2132[a], nexus32toRHD2132[b])
               for a,b in A1x32_Poly3_50[1]]}

but the same won't work for geometry,

geometry = {nexus32toRHD2132[a]: b for a,b in A1x32_Poly3_50_geometry.items()

so I need to paste the output from a terminal.

Similarly, I generate the .params file, but I need to suppress the unicode u'prepended' to strings by casting to ascii, otherwise the program crashes, e.g.

f.write('RAW_DATA_FILES = {}\n'.format([x.encode('ascii') for x in dat_fnames]))

Therefore, I would prefer JSON or some similar format which is easy to write by hand or programatically generate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants