15 {
16
17 auto m_plotting = m.def_submodule("plotting");
18 m_plotting.doc() = "This is a Python binding of MaCh3s C++ based plotting library.";
19
20 py::class_<MaCh3Plotting::PlottingManager>(m_plotting, "PlottingManager")
21 .def(
22 py::init<const std::string &>(),
23 "construct a PlottingManager using the specified config file",
24 py::arg("config_file_name")
25 )
26
27 .def(
28 py::init(),
29 "default constructor, will initialise the PlottingManager with the default plotting config"
30 )
31
32 .def(
33 "initialise",
35 "initalise this PlottingManager"
36 )
37
38 .def(
39 "usage",
41 "Print a usage message for the current executable"
42 )
43
44 .def(
45 "parse_inputs",
47 "Parse command line variables",
48 py::arg("arguments")
49 )
50
51 .def(
52 "set_exec",
54 "Set the name of the current executable, which will be used when getting executable specific options from the plotting config file",
55 py::arg("exec_name")
56 )
57
58 .def(
59 "get_file_name",
61 "Get the path to a particular file",
62 py::arg("input_file_id")
63 )
64
65 .def(
66 "get_file_label",
68 "Get the specified label of a particular input file",
69 py::arg("input_file_id")
70 )
71
72 .def(
73 "get_draw_options",
75 "Get any additional root drawing options specified by the user"
76 )
77
78 .def(
79 "get_output_name",
81 "Get the output name specified by the user, can specify an additional *suffix* to append to the file name but before the file extension",
82 py::arg("suffix") = ""
83 )
84
85 .def(
86 "get_file_names",
88 "Get the list of all file names"
89 )
90
91 .def(
92 "get_file_labels",
94 "Get the list of all file labels"
95 )
96
97 .def(
98 "get_n_files",
100 "Get the number of specified files"
101 )
102
103 .def(
104 "get_split_by_sample",
106 "Get whether or not the user has set the 'split by sample' (-s) option"
107 )
108
109 .def(
110 "get_plot_ratios",
112 "Get whether or not the user specified the 'plot ratios' (-r) option"
113 )
114
115 .def(
116 "get_draw_grid",
118 "Get wheter or not the user has specified the 'draw grid' (-g) option"
119 )
120
121 .def(
122 "style",
124 "Get the StyleManager associated with this PlottingManager"
125 )
126
127 .def(
128 "input",
130 "Get the InputManager associated with this PlottingManager"
131 )
132
133
134
135
136 ;
137
138 py::class_<MaCh3Plotting::InputManager>(m_plotting, "InputManager")
139 .def(
140 "print",
142 "Print a summary of everything this manager knows"
143 )
144
145 .def(
146 "get_llh_scan",
148 "Get the LLH scan for a particular parameter from a particular file",
149 py::arg("input_file_id"),
150 py::arg("param_name"),
151 py::arg("LLH_type") = "total"
152 )
153
154 .def(
155 "get_llh_scan_by_sample",
157 "Get the LLH scan for a particular parameter from a particular file for a particular sample",
158 py::arg("input_file_id"),
159 py::arg("param"),
160 py::arg("sample")
161 )
162
163 .def(
164 "get_enabled_llh",
166 "Get whether a particular file has LLH scans for a particular parameter",
167 py::arg("input_file_id"),
168 py::arg("param"),
169 py::arg("LLH_type") = "total"
170 )
171
172 .def(
173 "get_enabled_llh_by_sample",
175 "Get whether a particular file has LLH scans for a particular parameter for a particular sample",
176 py::arg("input_file_id"),
177 py::arg("param"),
178 py::arg("sample")
179 )
180
181 .def(
182 "get_post_fit_error",
184 "Get the post fit error for a parameter from a particular file",
185 py::arg("input_file_id"),
186 py::arg("param"),
187 py::arg("error_type") = ""
188 )
189
190 .def(
191 "get_post_fit_value",
193 "Get the post fit value for a parameter from a particular file",
194 py::arg("input_file_id"),
195 py::arg("param"),
196 py::arg("error_type") = ""
197 )
198
199 .def(
200 "get_known_parameters",
202 "Get all the parameters that this manager knows about. Useful for iterating over"
203 )
204
205 .def(
206 "get_known_samples",
208 "Get all the samples that this manager knows about. Useful for iterating over"
209 )
210
211 .def(
212 "get_tagged_parameters",
214 "Get all the parameters whose tags match some specified list",
215 py::arg("tags"),
216 py::arg("check_type") = "all"
217 )
218
219 .def(
220 "get_tagged_samples",
222 "Get all the samples whose tags match some specified list",
223 py::arg("tags"),
224 py::arg("check_type") = "all"
225 )
226
227 .def(
228 "get_n_input_files",
230 "Get the number of input files registered with this manager"
231 )
232
233 .def(
234 "get_known_llh_parameters",
236 "Get all the parameters that a file has LLH scans for",
237 py::arg("file_id")
238 )
239
240 .def(
241 "get_known_llh_samples",
243 "Get all the samples that a file has individual LLH scans for",
244 py::arg("file_id")
245 )
246
247 .def(
248 "get_known_post_fit_parameters",
250 "Get all the parameters that a file has post fit values and errors for",
251 py::arg("file_id")
252 )
253
254 .def(
255 "get_known_MCMC_parameters",
257 "Get all the parameters that a file has MCMC chain entries for",
258 py::arg("file_id")
259 )
260
261 .def(
262 "get_known_1d_posterior_parameters",
264 "Get all the parameters that a file has processed 1d posteriors for",
265 py::arg("file_id")
266 )
267
268 .def(
269 "get_MCMC_entry",
271 "Load up a particular step in the MCMC chain for a particular input file",
272 py::arg("file_id"),
273 py::arg("step")
274 )
275
276 .def(
277 "get_MCMC_value",
279 "Get the value of a particular parameter for the current entry (set by set_MCMC_entry) in the chain for a particular file",
280 py::arg("file_id"),
281 py::arg("param")
282 )
283
284 .def(
285 "get_n_MCMC_entries",
287 "Get the number of entries in the MCMC chain in a particular file"
288 )
289
290 .def(
291 "get_1d_posterior",
293 "Get the 1d posterior for a particular parameter from a particular file",
294 py::arg("file_id"),
295 py::arg("param")
296 )
297
298 ;
299
300 py::class_<MaCh3Plotting::StyleManager>(m_plotting, "StyleManager")
301 .def(
302 "prettify_parameter_name",
304 "Convert internally used parameter name to a nice pretty name that can be used in plots",
305 py::arg("param")
306 )
307
308 .def(
309 "prettify_sample_name",
311 "Convert internally used sample name to a nice pretty name that can be used in plots",
312 py::arg("sample")
313 )
314 ;
315
316}
const std::string getOutputName()
Get the straight up output file name with no bells or whistles, just the file extension.
void initialise()
initalise this PlottingManager.
void parseInputsVec(std::vector< std::string > argv)
Parse vector of command line arguments.
void setExec(std::string execName)
Internally set the name of the executable that manager is being used in.
const std::vector< std::string > getFileNames()
void usage()
Print a usage message for the current executable.
const std::string getFileName(int i)
const std::vector< std::string > getFileLabels()
const std::string getDrawOptions()
const std::string getFileLabel(int i)
const StyleManager & style()
Get the StyleManager contained within this PlottingManager, for doing style related things.
const InputManager & input()
Get the InputManager contained within this PlottingManager, for doing input related things.
std::string prettifyParamName(const std::string &origName) const
Convert hideous and vulgar internal parameter name into a beautiful presentable name.