lspestrip / striptease

Strip TEst Analysis for System Evaluation
MIT License
4 stars 3 forks source link

Improve the formatting of JSON procedures #57

Closed ziotom78 closed 2 years ago

ziotom78 commented 2 years ago

With this PR, JSON procedures are now formatted with one command per line. This permits to use grep more effectively to find commands in procedures.

Here are a few examples, which show that now the output of grep includes the boards, polarimeters, parameters and data passed to the command:

# Assume that we have created a procedure named `open_closed_loop_B6.json`
$ grep POL_RCL open_closed_loop_B6.json
  {"path": "/rest/slo", "kind": "command", "command": {"board": "B", "pol": "BOARD", "type": "BIAS", "method": "SET", "timeout": 500, "base_addr": "POL_RCL", "data": [23295]}},
$ grep VG0_SET open_closed_loop_B6.json
  {"path": "/rest/slo", "kind": "command", "command": {"board": "B", "type": "BIAS", "method": "SET", "timeout": 500, "pol": "B6", "base_addr": "VG0_SET", "data": [1204]}}, 
  {"path": "/rest/slo", "kind": "command", "command": {"board": "B", "pol": "B6", "base_addr": "VG0_SET", "type": "BIAS", "method": "SET", "timeout": 500, "data": [2500]}}, 

Before this PR, this would have been the output:

$ grep POL_RCL open_closed_loop_B6.json
      "base_addr": "POL_RCL",
$ grep VG0_SET open_closed_loop_B6.json
      "base_addr": "VG0_SET",
      "base_addr": "VG0_SET",
ziotom78 commented 2 years ago

Now the script join_scripts.py uses the new formatting, and it is possible to convert existing JSON files with it. (It does not require to pass two or more scripts: passing just one JSON file is fine.)