34 parser = argparse.ArgumentParser(
35 description=
"Profile along a line through a single black hole checkpoint",
36 formatter_class=argparse.ArgumentDefaultsHelpFormatter,
41 help=
"Directory holding the checkpoints, i.e. the output directory of single-black-hole.py.",
45 default=
"solution-CCZ4.peano-patch-file",
46 help=
"Meta file of the checkpoints within --directory.",
52 help=
"Index of the checkpoint (0 is the first one). Negative values count from the end, i.e. -1 is the latest checkpoint.",
58 default=[-20.0, 0.1, 0.1],
59 metavar=(
"X",
"Y",
"Z"),
60 help=
"Start of the line.",
66 default=[20.0, 0.1, 0.1],
67 metavar=(
"X",
"Y",
"Z"),
68 help=
"End of the line.",
70 parser.add_argument(
"--samples", type=int, default=200, help=
"Points along the line.")
73 default=
"profile.csv",
74 help=
"Name of the csv file with the profile.",
79 help=
"Only list the time stamps of the checkpoints.",
81 arguments = parser.parse_args()
82 if arguments.samples < 2:
83 parser.error(
"--samples has to be at least 2")
106 Probe all sampling points and return the rows (x, y, z, r, time, unknowns...)
107 along with the header of the unknowns
113 with tempfile.TemporaryDirectory()
as scratch:
114 for i
in range(arguments.samples):
115 lambda_ = i / (arguments.samples - 1)
117 a + lambda_ * (b - a)
for a, b
in zip(arguments.start, arguments.end)
119 output = os.path.join(scratch,
"probe.csv")
121 file_name=file_name, point=point, output_file=output, start=start, end=end
124 with open(output)
as csv_file:
125 reader = csv.reader(csv_file)
126 header = next(reader)
127 values = next(reader)
128 rows.append(point + [math.sqrt(sum(x * x
for x
in point))] + values)
129 return [
"x",
"y",
"z",
"r"] + header, rows
probe_line(arguments, file_name)
Probe all sampling points and return the rows (x, y, z, r, time, unknowns...) along with the header o...