makePlots.py
Go to the documentation of this file.
1 
2 import ROOT, glob, sys, os, re
3 from array import array
4 import Optimizations, OptimizationUtils
5 
6 def natural_sort(l):
7  convert = lambda text: int(text) if text.isdigit() else text.lower()
8  alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ]
9  return sorted(l, key = alphanum_key)
10 
11 ##### PARSE INPUT ARGUMENT #####
12 
13 if not len(sys.argv) > 1:
14  print "Please specify an optimization name"
15  sys.exit()
16 
17 optimization_name = sys.argv[1]
18 
19 max_configurations = 1000
20 
21 if len(sys.argv)>2:
22  max_configurations = int(sys.argv[2])
23 
24 ##### Find processed configurations and calculate fitnesses #####
25 
26 doSubFitnesses = True
27 
28 configurations = []
29 fitnesses = []
30 fhcnumufitnesses = []
31 fhcnumubarfitnesses = []
32 rhcnumufitnesses = []
33 rhcnumubarfitnesses = []
34 fhcnuenuebarfitnesses = []
35 rhcnuenuebarfitnesses = []
36 nhfitnesses = []
37 ihfitnesses = []
38 mhfitnesses = []
39 fitness_errors = []
40 fhcnumufitness_errors = []
41 rhcnumufitness_errors = []
42 fhcnumubarfitness_errors = []
43 rhcnumubarfitness_errors = []
44 fhcnuenuebarfitness_errors = []
45 rhcnuenuebarfitness_errors = []
46 nhfitness_errors = []
47 ihfitness_errors = []
48 mhfitness_errors = []
49 proton_energies = []
50 zero_errors = []
51 
52 optimization = Optimizations.Optimization(optimization_name)
53 
54 fluxpath = optimization.output_location+"users/ljf26/fluxfiles/g4lbne/"+optimization.g4lbne_version+"/"+optimization.physics_list+"/"
55 
56 fluxdirs = glob.glob(fluxpath+"*")
57 if optimization.rhc_parameters_float_separate:
58  fluxdirs = glob.glob(fluxpath+"*FHC*")
59 
60 for dir in natural_sort(fluxdirs):
61 
62  if os.path.basename(dir).startswith("Optimizations-"+optimization_name):
63  configuration = dir.split("/")[9].split("-")[2]
64 
65  if "Scan" in configuration: continue
66 
67  if float(configuration) < max_configurations:
68 
69  [tfitness_names,tfitnesses,tfiterrors] = optimization.getFitness(float(configuration))
70 
71  if tfitnesses[0]==-1: continue
72  print configuration,tfitnesses[0]
73  [fitness,fitness_error] = [tfitnesses[0],tfiterrors[0]]
74  if optimization_name.startswith("CP"):
75 
76  [fhcnumufitness,fhcnumufitness_error] = [tfitnesses[1],tfiterrors[1]]
77  [fhcnumubarfitness,fhcnumubarfitness_error] = [tfitnesses[2],tfiterrors[2]]
78  [fhcnuenuebarfitness,fhcnuenuebarfitness_error] = [tfitnesses[3],tfiterrors[3]]
79  [rhcnumufitness,rhcnumufitness_error] = [tfitnesses[4],tfiterrors[4]]
80  [rhcnumubarfitness,rhcnumubarfitness_error] = [tfitnesses[5],tfiterrors[5]]
81  [rhcnuenuebarfitness,rhcnuenuebarfitness_error] = [tfitnesses[6],tfiterrors[6]]
82  [nhfitness,nhfitness_error] = [tfitnesses[7],tfiterrors[7]]
83  [ihfitness,ihfitness_error] = [tfitnesses[8],tfiterrors[8]]
84  [tfitness_names,tfitnesses,tfiterrors] = optimization.getFitness(float(configuration),"mh")
85  [mhfitness,mhfitness_error] = [tfitnesses[0],tfiterrors[0]]
86 
87  # veto cases where fitness wasn't calculated or
88  # errors are absurdly large
89  if(float(fitness)>0 and float(fitness_error) < 5):
90 
91  configurations.append(float(configuration))
92  fitnesses.append(fitness)
93  fitness_errors.append(fitness_error)
94  if(optimization_name.startswith("CP_")):
95 
96  fhcnumufitnesses.append(fhcnumufitness)
97  fhcnumufitness_errors.append(fhcnumufitness_error)
98  rhcnumufitnesses.append(rhcnumufitness)
99  rhcnumufitness_errors.append(rhcnumufitness_error)
100  fhcnumubarfitnesses.append(fhcnumubarfitness)
101  fhcnumubarfitness_errors.append(fhcnumubarfitness_error)
102  rhcnumubarfitnesses.append(rhcnumubarfitness)
103  rhcnumubarfitness_errors.append(rhcnumubarfitness_error)
104  fhcnuenuebarfitnesses.append(fhcnuenuebarfitness)
105  fhcnuenuebarfitness_errors.append(fhcnuenuebarfitness_error)
106  rhcnuenuebarfitnesses.append(rhcnuenuebarfitness)
107  rhcnuenuebarfitness_errors.append(rhcnuenuebarfitness_error)
108  ihfitnesses.append(ihfitness)
109  ihfitness_errors.append(ihfitness_error)
110  nhfitnesses.append(nhfitness)
111  nhfitness_errors.append(nhfitness_error)
112  mhfitnesses.append(mhfitness)
113  mhfitness_errors.append(mhfitness_error)
114  else:
115  fhcnumufitnesses.append(0)
116  fhcnumufitness_errors.append(0)
117  rhcnumufitnesses.append(0)
118  rhcnumufitness_errors.append(0)
119  fhcnumubarfitnesses.append(0)
120  fhcnumubarfitness_errors.append(0)
121  rhcnumubarfitnesses.append(0)
122  rhcnumubarfitness_errors.append(0)
123  fhcnuenuebarfitnesses.append(0)
124  fhcnuenuebarfitness_errors.append(0)
125  rhcnuenuebarfitnesses.append(0)
126  rhcnuenuebarfitness_errors.append(0)
127  ihfitnesses.append(0)
128  ihfitness_errors.append(0)
129  nhfitnesses.append(0)
130  nhfitness_errors.append(0)
131  mhfitnesses.append(0)
132  mhfitness_errors.append(0)
133  zero_errors.append(0.0)
134 
135 ##### Get nominal fitness errors ####
136 nominal_fitnesses = []
137 nominal_fitness_error = 0
138 [nominal_fitness,nominal_fitness_error] = optimization.getNominalFitness("cp")
139 nominal_fitnesses.append(nominal_fitness[0]); # standard
140 nominal_fitnesses.append(0); # fhcnumu
141 nominal_fitnesses.append(0); # fhcnumubar
142 nominal_fitnesses.append(0); # fhcnuenuebar
143 nominal_fitnesses.append(0); # rhcnumu
144 nominal_fitnesses.append(0); # rhcnumubar
145 nominal_fitnesses.append(0); # rhcnuenuebar
146 if optimization_name.startswith("CP_"):
147  nominal_fitnesses.append(nominal_fitness[1]) #nh
148  nominal_fitnesses.append(nominal_fitness[2]) #ih
149 print "NOMINAL STANDARD FITNESS: ",nominal_fitness[0]
150 
151 [nominal_fitness,nominal_fitness_error] = optimization.getNominalFitness("mh") # mh
152 nominal_fitnesses.append(nominal_fitness[0]);
153 
154 
155 # Read in knob turns from macros
156 configurations2 = []
157 parameter_values = []
158 
159 parameter_histos = []
160 
161 n_parameters = len(optimization.parameter_names);
162 for i in range(0,n_parameters):
163  parameter_name = optimization.parameter_names[i]
164  parameter_values.append([])
165  parameter_histos.append(ROOT.TH1F("h_parameters_"+str(i),parameter_name,10,optimization.parameter_lower_limits[i],optimization.parameter_upper_limits[i]));
166 
167 knobturns = optimization.getKnobturns()
168 
169 for configuration in configurations:
170  if float(configuration)>max_configurations: continue
171  configuration_found = False
172  for j in range(0,len(knobturns)):
173  if knobturns[j][0]==configuration:
174  configuration_found = True
175  configurations2.append(knobturns[j][0])
176  for i in range(0,n_parameters):
177  parameter_histos[i].Fill(knobturns[j][1][i])
178  parameter_values[i].append(float(knobturns[j][1][i]))
179  if not configuration_found:
180  print "ERROR: configuration:",configuration," found in flux directories but can't find macros to look up knobturns... quitting."
181  sys.exit()
182 
183 if configurations != configurations2:
184  print "WARNING: vector of configurations matched to fitness and vector of configurations matched to knobturns is different. This will likely cause plots to be incorrect"
185 
186 
187 # Make TGraphs
188 canv = ROOT.TCanvas("MyCanvas","MyCanvas")
189 #split data into chunks to make tgraphs of different colors for different configurations
190 split_configurations = [[]]
191 split_fitnesses = [[]]
192 split_fhcnumufitnesses = [[]]
193 split_rhcnumufitnesses = [[]]
194 split_fhcnumubarfitnesses = [[]]
195 split_rhcnumubarfitnesses = [[]]
196 split_fhcnuenuebarfitnesses = [[]]
197 split_rhcnuenuebarfitnesses = [[]]
198 split_ihfitnesses = [[]]
199 split_nhfitnesses = [[]]
200 split_mhfitnesses = [[]]
201 split_zero_errors = [[]]
202 split_fitness_errors = [[]]
203 split_fhcnumufitness_errors = [[]]
204 split_rhcnumufitness_errors = [[]]
205 split_fhcnumubarfitness_errors = [[]]
206 split_rhcnumubarfitness_errors = [[]]
207 split_fhcnuenuebarfitness_errors = [[]]
208 split_rhcnuenuebarfitness_errors = [[]]
209 split_ihfitness_errors = [[]]
210 split_nhfitness_errors = [[]]
211 split_mhfitness_errors = [[]]
212 split_parameter_values = []
213 for j in range(0,n_parameters):
214  split_parameter_values.append([[]])
215 gen_end = optimization.generation_size
216 gen_number = 0
217 for i in range(0,len(configurations)):
218  if(configurations[i]>gen_end):
219  gen_end = gen_end+optimization.generation_size
220  gen_number = gen_number+1
221  split_configurations.append([])
222  split_fitnesses.append([])
223  split_fhcnumufitnesses.append([])
224  split_rhcnumufitnesses.append([])
225  split_fhcnumubarfitnesses.append([])
226  split_rhcnumubarfitnesses.append([])
227  split_fhcnuenuebarfitnesses.append([])
228  split_rhcnuenuebarfitnesses.append([])
229  split_ihfitnesses.append([])
230  split_nhfitnesses.append([])
231  split_mhfitnesses.append([])
232  split_zero_errors.append([])
233  split_fitness_errors.append([])
234  split_fhcnumufitness_errors.append([])
235  split_rhcnumufitness_errors.append([])
236  split_fhcnumubarfitness_errors.append([])
237  split_rhcnumubarfitness_errors.append([])
238  split_fhcnuenuebarfitness_errors.append([])
239  split_rhcnuenuebarfitness_errors.append([])
240  split_ihfitness_errors.append([])
241  split_nhfitness_errors.append([])
242  split_mhfitness_errors.append([])
243  for j in range(0,n_parameters):
244  split_parameter_values[j].append([])
245  split_configurations[gen_number].append(float(configurations[i]))
246 
247  split_fitnesses[gen_number].append(float(fitnesses[i]))
248  split_fhcnumufitnesses[gen_number].append(float(fhcnumufitnesses[i]))
249  split_rhcnumufitnesses[gen_number].append(float(rhcnumufitnesses[i]))
250  split_fhcnumubarfitnesses[gen_number].append(float(fhcnumubarfitnesses[i]))
251  split_rhcnumubarfitnesses[gen_number].append(float(rhcnumubarfitnesses[i]))
252  split_fhcnuenuebarfitnesses[gen_number].append(float(fhcnuenuebarfitnesses[i]))
253  split_rhcnuenuebarfitnesses[gen_number].append(float(rhcnuenuebarfitnesses[i]))
254  split_ihfitnesses[gen_number].append(float(ihfitnesses[i]))
255  split_nhfitnesses[gen_number].append(float(nhfitnesses[i]))
256  split_mhfitnesses[gen_number].append(float(mhfitnesses[i]))
257 
258  split_zero_errors[gen_number].append(float(zero_errors[i]))
259  split_fitness_errors[gen_number].append(float(fitness_errors[i]))
260  split_fhcnumufitness_errors[gen_number].append(float(fhcnumufitness_errors[i]))
261  split_rhcnumufitness_errors[gen_number].append(float(rhcnumufitness_errors[i]))
262  split_fhcnumubarfitness_errors[gen_number].append(float(fhcnumubarfitness_errors[i]))
263  split_rhcnumubarfitness_errors[gen_number].append(float(rhcnumubarfitness_errors[i]))
264  split_fhcnuenuebarfitness_errors[gen_number].append(float(fhcnuenuebarfitness_errors[i]))
265  split_rhcnuenuebarfitness_errors[gen_number].append(float(rhcnuenuebarfitness_errors[i]))
266  split_ihfitness_errors[gen_number].append(float(ihfitness_errors[i]))
267  split_nhfitness_errors[gen_number].append(float(nhfitness_errors[i]))
268  split_mhfitness_errors[gen_number].append(float(mhfitness_errors[i]))
269  for j in range(0,n_parameters):
270  split_parameter_values[j][gen_number].append(float(parameter_values[j][i]))
271 
272 print "BLAH"
273 print configurations
274 print split_configurations
275 
276 colors = [39,222,9]
277 
278 fitness_types = ["Nu_mu Flux"]
279 if optimization_name.startswith("CP"):
280  fitness_types = ["CP","fhcnumu","fhcnumubar","fhcnuenuebar","rhcnumu","rhcnumubar","rhcnuenuebar","ih","nh","mh"]
281 for type_iter in range(len(fitness_types)):
282  fitness_vs_configurations = []
283 
284  for i in range(0,len(split_configurations)):
285 
286  if fitness_types[type_iter]=="CP" or fitness_types[type_iter]=="Nu_mu Flux":
287  fitness_vs_configurations.append(ROOT.TGraphErrors(len(split_configurations[i]),array('d',split_configurations[i]),array('d',split_fitnesses[i]),array('d',split_zero_errors[i]),array('d',split_fitness_errors[i])));
288 
289  if fitness_types[type_iter]=="fhcnumu":
290  fitness_vs_configurations.append(ROOT.TGraphErrors(len(split_configurations[i]),array('d',split_configurations[i]),array('d',split_fhcnumufitnesses[i]),array('d',split_zero_errors[i]),array('d',split_fhcnumufitness_errors[i])));
291  if fitness_types[type_iter]=="fhcnumubar":
292  fitness_vs_configurations.append(ROOT.TGraphErrors(len(split_configurations[i]),array('d',split_configurations[i]),array('d',split_fhcnumubarfitnesses[i]),array('d',split_zero_errors[i]),array('d',split_fhcnumubarfitness_errors[i])));
293  if fitness_types[type_iter]=="fhcnuenuebar":
294  fitness_vs_configurations.append(ROOT.TGraphErrors(len(split_configurations[i]),array('d',split_configurations[i]),array('d',split_fhcnuenuebarfitnesses[i]),array('d',split_zero_errors[i]),array('d',split_fhcnuenuebarfitness_errors[i])));
295  if fitness_types[type_iter]=="rhcnumu":
296  fitness_vs_configurations.append(ROOT.TGraphErrors(len(split_configurations[i]),array('d',split_configurations[i]),array('d',split_rhcnumufitnesses[i]),array('d',split_zero_errors[i]),array('d',split_rhcnumufitness_errors[i])));
297  if fitness_types[type_iter]=="rhcnumubar":
298  fitness_vs_configurations.append(ROOT.TGraphErrors(len(split_configurations[i]),array('d',split_configurations[i]),array('d',split_rhcnumubarfitnesses[i]),array('d',split_zero_errors[i]),array('d',split_rhcnumubarfitness_errors[i])));
299  if fitness_types[type_iter]=="rhcnuenuebar":
300  fitness_vs_configurations.append(ROOT.TGraphErrors(len(split_configurations[i]),array('d',split_configurations[i]),array('d',split_rhcnuenuebarfitnesses[i]),array('d',split_zero_errors[i]),array('d',split_rhcnuenuebarfitness_errors[i])));
301  if fitness_types[type_iter]=="ih":
302  fitness_vs_configurations.append(ROOT.TGraphErrors(len(split_configurations[i]),array('d',split_configurations[i]),array('d',split_ihfitnesses[i]),array('d',split_zero_errors[i]),array('d',split_ihfitness_errors[i])));
303  if fitness_types[type_iter]=="nh":
304  fitness_vs_configurations.append(ROOT.TGraphErrors(len(split_configurations[i]),array('d',split_configurations[i]),array('d',split_nhfitnesses[i]),array('d',split_zero_errors[i]),array('d',split_nhfitness_errors[i])));
305  if fitness_types[type_iter]=="mh":
306  fitness_vs_configurations.append(ROOT.TGraphErrors(len(split_configurations[i]),array('d',split_configurations[i]),array('d',split_mhfitnesses[i]),array('d',split_zero_errors[i]),array('d',split_mhfitness_errors[i])));
307 
308  x_max = max_configurations + 100
309 
310  fitness_vs_configurations[i].GetXaxis().SetLimits(0.0,x_max)
311  fitness_vs_configurations[i].GetXaxis().SetTitle("Configuration")
312  fitness_vs_configurations[i].GetYaxis().SetTitle(fitness_types[type_iter]+" Fitness")
313  fitness_vs_configurations[i].GetXaxis().CenterTitle()
314  fitness_vs_configurations[i].GetYaxis().CenterTitle()
315  fitness_vs_configurations[i].SetMarkerColor(colors[i%len(colors)]);
316  fitness_vs_configurations[i].SetLineColor(colors[i%len(colors)]);
317 
318  if(i==0):
319  fitness_vs_configurations[i].SetTitle("");
320  fitness_vs_configurations[i].Draw("ap");
321  a_line = ROOT.TLine(0,nominal_fitnesses[type_iter],x_max,nominal_fitnesses[type_iter])
322  a_line.SetLineWidth(2)
323 
324  if(fitness_types[type_iter]=="CP" or fitness_types[type_iter]=="Nu_mu Flux"):
325  fitness_vs_configurations[i].SetMaximum(max(fitnesses)*1.1)
326  fitness_vs_configurations[i].SetMinimum(min(fitnesses)*0.8)
327  if(fitness_types[type_iter]=="fhcnumu"):
328  fitness_vs_configurations[i].SetMaximum(max(fhcnumufitnesses)*1.1)
329  fitness_vs_configurations[i].SetMinimum(min(fhcnumufitnesses))
330  if(fitness_types[type_iter]=="fhcnumubar"):
331  fitness_vs_configurations[i].SetMaximum(max(fhcnumubarfitnesses)*1.1)
332  fitness_vs_configurations[i].SetMinimum(min(fhcnumubarfitnesses))
333  if(fitness_types[type_iter]=="fhcnuenuebar"):
334  fitness_vs_configurations[i].SetMaximum(max(fhcnuenuebarfitnesses)*1.1)
335  fitness_vs_configurations[i].SetMinimum(min(fhcnuenuebarfitnesses))
336  if(fitness_types[type_iter]=="rhcnumu"):
337  fitness_vs_configurations[i].SetMaximum(max(rhcnumufitnesses)*1.1)
338  fitness_vs_configurations[i].SetMinimum(min(rhcnumufitnesses))
339  if(fitness_types[type_iter]=="rhcnumubar"):
340  fitness_vs_configurations[i].SetMaximum(max(rhcnumubarfitnesses)*1.1)
341  fitness_vs_configurations[i].SetMinimum(min(rhcnumubarfitnesses))
342  if(fitness_types[type_iter]=="rhcnuenuebar"):
343  fitness_vs_configurations[i].SetMaximum(max(rhcnuenuebarfitnesses)*1.1)
344  fitness_vs_configurations[i].SetMinimum(min(rhcnuenuebarfitnesses))
345  if(fitness_types[type_iter]=="ih"):
346  fitness_vs_configurations[i].SetMaximum(max(ihfitnesses)*1.1)
347  fitness_vs_configurations[i].SetMinimum(0)
348  if(fitness_types[type_iter]=="nh"):
349  fitness_vs_configurations[i].SetMaximum(max(nhfitnesses)*1.1)
350  fitness_vs_configurations[i].SetMinimum(0)
351  if(fitness_types[type_iter]=="mh"):
352  fitness_vs_configurations[i].SetMaximum(max(mhfitnesses)*1.1)
353  fitness_vs_configurations[i].SetMinimum(3)
354 
355  a_line.SetLineStyle(2);
356  a_line.Draw("SAME");
357  fitness_vs_configurations[i].Draw("psame");
358 
359  else:
360  fitness_vs_configurations[i].Draw("psame");
361 
362  #latex = ROOT.TLatex( 0.67, 0.67, "Nominal Configuration" );
363  #latex.SetNDC()
364  #latex.SetTextSize(0.035);
365  #latex.Draw()
366  canv.Print("plots/"+optimization_name+"_"+fitness_types[type_iter]+"_fitness_vs_configuration.eps");
367  canv.Print("plots/"+optimization_name+"_"+fitness_types[type_iter]+"_fitness_vs_configuration.png");
368 
369 
370 ROOT.gStyle.SetMarkerStyle(2);
371 
372 best_parameter_values = []
373 best_parameter_errors = []
374 for i in range(0,n_parameters):
375  best_parameter_values.append([])
376  best_parameter_errors.append([])
377 
378 for j in range(0,len(fitnesses)):
379 
380 # if(fitnesses[j]>2.4):
381  for i in range(0,n_parameters):
382  best_parameter_values[i].append(parameter_values[i][j])
383  best_parameter_errors[i].append(0)
384 
385 
386 for i in range(0,n_parameters):
387 
388  parameter_vs_configurations = []
389  y_low = optimization.parameter_lower_limits[i]-(optimization.parameter_upper_limits[i]-optimization.parameter_lower_limits[i])*0.05;
390  y_low = optimization.parameter_upper_limits[i]+(optimization.parameter_upper_limits[i]-optimization.parameter_lower_limits[i])*0.05;
391  frame = ROOT.TH2D("frame","frame",100,0,max_configurations+100,100,optimization.parameter_lower_limits[i],optimization.parameter_upper_limits[i]);
392  frame.SetTitle(optimization.parameter_names[i]);
393  frame.Draw();
394  ROOT.gPad.Update()
395  title = ROOT.gPad.GetPrimitive("title");
396  title.SetBorderSize(0);
397 
398  for j in range(0,len(split_configurations)):
399 
400  parameter_vs_configurations.append(ROOT.TGraphErrors(len(split_configurations[j]),array('d',split_configurations[j]),array('d',split_parameter_values[i][j]),array('d',split_zero_errors[j]),array('d',split_zero_errors[j])));
401  parameter_vs_configurations[j].GetXaxis().SetLimits(0.0,max_configurations+100)
402 #parameter_vs_configuration.GetHistogram().SetMaximum(0.8e-18);
403  y_axis_title = optimization.parameter_names[i]
404  if(optimization.parameter_units[i]!=""):
405  y_axis_title = y_axis_title+" ("+optimization.parameter_units[i]+")"
406  frame.GetXaxis().SetTitle("Configuration")
407  frame.GetYaxis().SetTitle(y_axis_title)
408  frame.GetXaxis().CenterTitle()
409  frame.GetYaxis().CenterTitle()
410  parameter_vs_configurations[j].SetMarkerColor(colors[j%len(colors)]);
411  parameter_vs_configurations[j].SetLineColor(colors[j%len(colors)]);
412  parameter_vs_configurations[j].Draw("psame");
413 
414  parameter_name = optimization.parameter_names[i]
415  canv.Print("plots/"+optimization_name+"_"+parameter_name+"_vs_configuration.eps");
416  canv.Print("plots/"+optimization_name+"_"+parameter_name+"_vs_configuration.png");
417 
418  fitness_types = ["Nu_mu Flux"]
419  if optimization_name.startswith("CP_"):
420  fitness_types = ["CP","fhcnumu","fhcnumubar","fhcnuenuebar","rhcnumu","rhcnumubar","rhcnuenuebar","nh","ih","mh"]
421  for fitness_type in fitness_types:
422  if fitness_type=="CP" or fitness_type=="Nu_mu Flux":
423  fitness_vs_parameter = ROOT.TGraphErrors(len(configurations),array('d',parameter_values[i]),array('d',fitnesses),array('d',zero_errors),array('d',fitness_errors))
424  if fitness_type=="fhcnumu":
425  fitness_vs_parameter = ROOT.TGraphErrors(len(configurations),array('d',parameter_values[i]),array('d',fhcnumufitnesses),array('d',zero_errors),array('d',fhcnumufitness_errors))
426  if fitness_type=="fhcnumubar":
427  fitness_vs_parameter = ROOT.TGraphErrors(len(configurations),array('d',parameter_values[i]),array('d',fhcnumubarfitnesses),array('d',zero_errors),array('d',fhcnumubarfitness_errors))
428  if fitness_type=="fhcnuenuebar":
429  fitness_vs_parameter = ROOT.TGraphErrors(len(configurations),array('d',parameter_values[i]),array('d',fhcnuenuebarfitnesses),array('d',zero_errors),array('d',fhcnuenuebarfitness_errors))
430  if fitness_type=="rhcnumu":
431  fitness_vs_parameter = ROOT.TGraphErrors(len(configurations),array('d',parameter_values[i]),array('d',rhcnumufitnesses),array('d',zero_errors),array('d',rhcnumufitness_errors))
432  if fitness_type=="rhcnumubar":
433  fitness_vs_parameter = ROOT.TGraphErrors(len(configurations),array('d',parameter_values[i]),array('d',rhcnumubarfitnesses),array('d',zero_errors),array('d',rhcnumubarfitness_errors))
434  if fitness_type=="rhcnuenuebar":
435  fitness_vs_parameter = ROOT.TGraphErrors(len(configurations),array('d',parameter_values[i]),array('d',rhcnuenuebarfitnesses),array('d',zero_errors),array('d',rhcnuenuebarfitness_errors))
436  if fitness_type=="mh":
437  fitness_vs_parameter = ROOT.TGraphErrors(len(configurations),array('d',parameter_values[i]),array('d',mhfitnesses),array('d',zero_errors),array('d',mhfitness_errors))
438  if fitness_type=="ih":
439  fitness_vs_parameter = ROOT.TGraphErrors(len(configurations),array('d',parameter_values[i]),array('d',ihfitnesses),array('d',zero_errors),array('d',ihfitness_errors))
440  if fitness_type=="nh":
441  fitness_vs_parameter = ROOT.TGraphErrors(len(configurations),array('d',parameter_values[i]),array('d',nhfitnesses),array('d',zero_errors),array('d',nhfitness_errors))
442  fitness_vs_parameter.GetYaxis().SetTitle(fitness_type+" Fitness")
443  x_axis_title = optimization.parameter_names[i]
444  if(optimization.parameter_units[i]!=""):
445  x_axis_title = x_axis_title+" ("+optimization.parameter_units[i]+")"
446  fitness_vs_parameter.GetXaxis().SetTitle(x_axis_title);
447  fitness_vs_parameter.GetXaxis().CenterTitle()
448  fitness_vs_parameter.GetYaxis().CenterTitle()
449  fitness_vs_parameter.Draw("AP");
450  canv.Print("plots/"+optimization_name+"_"+fitness_type+"_fitness_vs_"+parameter_name+".eps")
451  canv.Print("plots/"+optimization_name+"_"+fitness_type+"_fitness_vs_"+parameter_name+".png")
452 
453  """
454  for j in range(i+1,n_parameters):
455  parameter_vs_parameter = ROOT.TGraphErrors(len(best_parameter_values[i]),array('d',best_parameter_values[i]),array('d',best_parameter_values[j]),array('d',best_parameter_errors[i]),array('d',best_parameter_errors[j]))
456  x_axis_title = optimization.parameter_names[i]
457  y_axis_title = optimization.parameter_names[j]
458  if(optimization.parameter_units[i]!=""):
459  x_axis_title = x_axis_title+" ("+optimization.parameter_units[i]+")"
460  if(optimization.parameter_units[j]!=""):
461  y_axis_title = y_axis_title+" ("+optimization.parameter_units[j]+")"
462  parameter_vs_parameter.GetXaxis().SetTitle(x_axis_title);
463  parameter_vs_parameter.GetYaxis().SetTitle(y_axis_title);
464  parameter_vs_parameter.GetXaxis().CenterTitle()
465  parameter_vs_parameter.GetYaxis().CenterTitle()
466  parameter_vs_parameter.Draw("AP");
467  canv.Print("plots/"+optimization_name+"_"+parameter_name+"_vs_"+optimization.parameter_names[j]+".eps")
468  canv.Print("plots/"+optimization_name+"_"+parameter_name+"_vs_"+optimization.parameter_names[j]+".png")
469  """
def natural_sort(l)
Definition: makePlots.py:6
auto array(Array const &a)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:228
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
void split(std::string const &s, char c, OutIter dest)
Definition: split.h:35
if(!yymsg) yymsg
static QCString str