Peano
Loading...
Searching...
No Matches
utils.py
Go to the documentation of this file.
1# This file is part of the ExaHyPE2 project. For conditions of distribution and
2# use, please see the copyright notice at www.peano-framework.org
3
4
5Symbols = [ "o", "^", "s", "d", "<", ">", "v", "D"]
6internal_symbol_counter = 0
7
8
9def next_markevery(size_of_data):
10 global internal_symbol_counter
11
12 if size_of_data<1:
13 raise Exception( "Too few entries to pick a correct markevery value for matplotlib")
14
15 default_number_of_markers = 5
16 if size_of_data<default_number_of_markers+1:
17 return 1
18 else:
19 ten_per_plot = int( size_of_data / default_number_of_markers )
20 shift = internal_symbol_counter % ten_per_plot - 1
21
22 return ten_per_plot+shift
23
24
26 global internal_symbol_counter
27
28 result = "-"
29 if internal_symbol_counter >= len(Symbols):
30 result = "--"
31 if internal_symbol_counter >= 2*len(Symbols):
32 result = ":"
33 if internal_symbol_counter >= 3*len(Symbols):
34 result = ""
35 result = result + Symbols[internal_symbol_counter % len(Symbols) ]
36 internal_symbol_counter+=1
37 internal_symbol_counter = internal_symbol_counter % len(4*Symbols)
38 return result
39
40
41def linear_runtime_trend_line(x_data, y_data):
42 """
43 We assume this is performance data, i.e. x_data denotes the
44 number of cores or ranks, and y_data are runtimes. We give
45 only calibrated y data back. x_data has to be ordered.
46 """
47 result = []
48 for i in range(0,len(x_data)):
49 result.append( y_data[0]/x_data[i] )
50 return result