The .ini files that we are using to define processing procedures do not follow standard .ini format. INI files require key/value pairs (we have) separated by unique section headers (we don't have). This makes reading/editing/sharing our .ini files ambiguous and tedious. They're not portable, because they depend on Biomet.net\matlab\TRACEANALYSIS_FIRSTSTAGE\read_ini_file.m for parsing/interpretation and this also adds a layer of complexity to troubleshooting issues with the .ini files. There are libraries in Python and R for handling .ini files, and if you try to read our files with them, they fail because [Trace] ... [End] syntax is not standard. There is also a matlab function for reading standard .ini files.
If we want to stick with the existing procedures, I suggest we change the file extension to .txt, because they are really just text files. Personally, I think it would be a good idea to switch to a standardized format, like the exiting .ini framework. I wrote a python script to translate the exiting .ini files to the standardized format, which is included in a push of my calculation procedures branch here. You can see an example of the standardized file here
- Using the standard format should make expansion, troubleshooting, and future upgrades easier. We could even consider more flexible formats (.json or .yml) which allow for nested sections so that stages 1, 2, & 3 could all be defined in the same file. But lets not put the cart before the horse here.
- Its also more portable, which would make us less platform dependent; procedures could be more easily translated to a different language in the future.
I've created updated .ini files in the standard format for BB, BB2, BBS & DSM for Stages 1 & 2 as examples in my branch here. I'm also working up an example for stage 3 (only BB1/BBS so far), that works in R using the INI package.
Additionally, I wrote an matlab function in Biomet.Net: Biomet.net\matlab\TRACEANALYSIS_FIRSTSTAGE\read_ini_file_updated.m to interpret the standardized .ini files in matlab using an adaption of the above linked function. The pull request can be viewed here. It's not ready for merging, just giving for an example.
- The function to read the updated ini files should produce exactly the same outputs as the original read_ini_file.m function (provided there are no errors in the ini file, e.g., repeated traces or keys). I also created a function to test the ini files by comparing the standardized and original formats, to check that they are equivalent.
- Biomet.net\matlab\TRACEANALYSIS_FIRSTSTAGE\ini_compare.m will test for differences between an original ini file and the standardized translated version, and print where there are issues: which mostly result from issues in the original ini files (like duplicate traces).
- I've tested these files (just locally) for BB, BB2, BBS & DSM and it works fine for Stage 1 & 2. I've also tested stage 3 for BB1 and it works, though there are some more general updates to the stage 3 procedures still to be implemented (removing hard coded calls to CH4. The procedures for implementing the updated ini reader: two conditional calls to the old or updated ini reader, depending on site ID, one in readIniFileDirect.m and one in read_data.m. At least locally, these function the same as the original ini file procedures.
Thoughts??
The pull requests I've submitted aren't complete yet, they're just for example purposes. Still some testing/tweaking that I'd want to do before production level incorporation.
The .ini files that we are using to define processing procedures do not follow standard .ini format. INI files require key/value pairs (we have) separated by unique section headers (we don't have). This makes reading/editing/sharing our .ini files ambiguous and tedious. They're not portable, because they depend on Biomet.net\matlab\TRACEANALYSIS_FIRSTSTAGE\read_ini_file.m for parsing/interpretation and this also adds a layer of complexity to troubleshooting issues with the .ini files. There are libraries in Python and R for handling .ini files, and if you try to read our files with them, they fail because [Trace] ... [End] syntax is not standard. There is also a matlab function for reading standard .ini files.
If we want to stick with the existing procedures, I suggest we change the file extension to .txt, because they are really just text files. Personally, I think it would be a good idea to switch to a standardized format, like the exiting .ini framework. I wrote a python script to translate the exiting .ini files to the standardized format, which is included in a push of my calculation procedures branch here. You can see an example of the standardized file here
I've created updated .ini files in the standard format for BB, BB2, BBS & DSM for Stages 1 & 2 as examples in my branch here. I'm also working up an example for stage 3 (only BB1/BBS so far), that works in R using the INI package.
Additionally, I wrote an matlab function in Biomet.Net: Biomet.net\matlab\TRACEANALYSIS_FIRSTSTAGE\read_ini_file_updated.m to interpret the standardized .ini files in matlab using an adaption of the above linked function. The pull request can be viewed here. It's not ready for merging, just giving for an example.
Thoughts??
The pull requests I've submitted aren't complete yet, they're just for example purposes. Still some testing/tweaking that I'd want to do before production level incorporation.