philbull / cosmoparams

Specification for a base cosmological parameter class
MIT License
2 stars 0 forks source link

Use '=' separator instead of ':'? #3

Open philbull opened 6 years ago

philbull commented 6 years ago

Section 3 of the spec currently uses ':' to separate parameter names from their values in the standard interchange file format. This makes the files similar in appearance to a Python dictionary.

An alternative would be to use '=' as the separator. This will make it possible for the files to be read in as .ini files, which are already supported by many codes. This will reduce some of the development and maintenance burden of supporting the standard interchange format.

A possible disadvantage is that people might try to use .ini file syntax that isn't supported by this format. This should be caught by the validation routines, however.

yymao commented 6 years ago

Could be an option for the sterilization (e.g. .dump) function?

philbull commented 6 years ago

Comment from Mike Jarvis:

I'd use YAML as the file structure. It's highly readable by humans as well as computers, and there are easy to use packages for reading them in all languages (at least python and c -- I'm sure more though).

I think this is reasonable. The current standard format looks like a subset of YAML anyway, if we disallow arbitrary whitespace at the beginning of lines.

rmjarvis commented 6 years ago

I recommend not using =. The yaml structure is equally able to handle everything an ini structure can handle (but using : rather than = as noted). But if you decide that it makes sense to have any kind of hierarchy for something (a parameter that in turn is a dict with several parameters), then IMO, the yaml notation for this is far cleaner than the ini notation.