-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdesirability_function_plot.py
More file actions
44 lines (35 loc) · 1.42 KB
/
desirability_function_plot.py
File metadata and controls
44 lines (35 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from sympy import *
from sympy.parsing.sympy_parser import parse_expr
import numpy as np
import matplotlib.pyplot as plt
import argparse
from process_predictions import get_norm_value, process_desirability_functions
def main_params(in_function, in_range):
fnc = process_desirability_functions([in_function])[0]
print(fnc)
in_values = np.arange(int(in_range[0]), int(in_range[1]), 0.01)
out_values = in_values.copy()
for index, value in enumerate(out_values):
out_values[index] = get_norm_value(value, fnc)
fig, ax = plt.subplots()
ax.plot(in_values, out_values)
ax.grid()
# plt.xlabel('Property')
# plt.ylabel('Desirability')
plt.xticks(fontsize=14)
plt.yticks(fontsize=14)
plt.show()
def main():
parser = argparse.ArgumentParser(description=
'Plots your function from string for desirability functions')
parser.add_argument('-if', '--in_function', metavar='0.45:0,0.55:10*x-4.5,1000:1',
required=True, help='input string for plot')
parser.add_argument('-ir', '--in_range', metavar='[-5 10]', nargs='*',
required=True, help='type two number which represents range your plot')
args = vars(parser.parse_args())
for o, v in args.items():
if o == 'in_function': in_function = v
if o == 'in_range': in_range = v
main_params(in_function, in_range)
if __name__ == '__main__':
main()