File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ * .sh text eol =lf
Original file line number Diff line number Diff line change @@ -12,13 +12,22 @@ if [ ! -f "$PATHS_FILE" ]; then
1212fi
1313
1414_yaml_val () {
15- grep -E " ^${1} :" " $PATHS_FILE " | sed ' s/^[^:]*:[[:space:]]*//' | tr -d ' "' \' '
15+ python - " $1 " << 'PYEOF '
16+ import sys
17+ key = sys.argv[1]
18+ with open("configs/paths.local.yaml") as f:
19+ for line in f:
20+ line = line.strip()
21+ if line.startswith(key + ":"):
22+ val = line.split(":", 1)[1].strip().strip('"').strip("'")
23+ print(val)
24+ break
25+ PYEOF
1626}
1727
1828CXR_ROOT=" $( _yaml_val mimic_cxr_root) "
1929IV_ROOT=" $( _yaml_val mimic_iv_root) "
2030ED_ROOT=" $( _yaml_val mimic_iv_ed_root) "
21- LAB_DIR="$(_yaml_val labevents_dir)"
2231
2332if [ -z " $CXR_ROOT " ] || [ -z " $ED_ROOT " ]; then
2433 echo " ERROR: mimic_cxr_root and mimic_iv_ed_root must be set in $PATHS_FILE " >&2
Original file line number Diff line number Diff line change @@ -12,7 +12,17 @@ if [ ! -f "$PATHS_FILE" ]; then
1212fi
1313
1414_yaml_val () {
15- grep -E " ^${1} :" " $PATHS_FILE " | sed ' s/^[^:]*:[[:space:]]*//' | tr -d ' "' \' '
15+ python - " $1 " << 'PYEOF '
16+ import sys
17+ key = sys.argv[1]
18+ with open("configs/paths.local.yaml") as f:
19+ for line in f:
20+ line = line.strip()
21+ if line.startswith(key + ":"):
22+ val = line.split(":", 1)[1].strip().strip('"').strip("'")
23+ print(val)
24+ break
25+ PYEOF
1626}
1727
1828IV_ROOT=" $( _yaml_val mimic_iv_root) "
You can’t perform that action at this time.
0 commit comments