EGS Brachy
An egs++ user code for rapid brachytherapy calculations
Loading...
Searching...
No Matches
gen_specs.py
Go to the documentation of this file.
1import os
2
3root = os.path.join("..", "lib")
4abs_root = os.path.abspath(root)
5specs = os.path.join(abs_root, "spectra")
6
7
9 items = []
10
11 for root, dirs, files in os.walk(specs):
12 for f in sorted(files):
13 if not f.endswith("spectrum"):
14 continue
15
16 f = os.path.relpath(os.path.join(root, f))
17 description = open(f, "r").readline().strip()
18 fname = os.path.split(f)[1]
19 description = """## %s\n**File Location:** %s\n\n%s\n""" % (fname, f.strip("./"), description)
20
21 items.append(description)
22
23 return "\n".join(items)
24
25
26def gen_docs(fname):
27
28 docs = """@anchor egs_brachy_spectra_lib
29
30[TOC]
31
32egs_brachy Spectra
33==================
34
35The current list of spectra available in the egs_brachy geometry
36library.
37
38%s
39
40""" % (get_spectra())
41
42
43 open(fname, "w").write(docs)
44
45if __name__ == "__main__":
46 outfile = "spectra.md"
47 gen_docs(outfile)
48
49
string join(const vector< string > &v, string delim)
Definition ginfo.cpp:56
get_spectra()
Definition gen_specs.py:8