update calibration
This commit is contained in:
parent
ebf7d7fc99
commit
34e71ade15
@ -378,11 +378,14 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
||||
|
||||
return uncertain_eff
|
||||
|
||||
def get_create_graph(matrix, patterns):
|
||||
def get_create_graph(matrix, patterns, resolution, equipment_risk):
|
||||
image = BytesIO()
|
||||
errors = []
|
||||
yerr = []
|
||||
|
||||
upresolution = resolution if resolution >=0 else (resolution*-1)
|
||||
lowresolution = resolution if resolution < 0 else (resolution*-1)
|
||||
|
||||
count = 0
|
||||
for pattern in patterns:
|
||||
error = pattern - matrix[count][0]
|
||||
@ -391,15 +394,18 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
||||
count+=1
|
||||
|
||||
labels = list(patterns)
|
||||
#raise UserError(str([labels,errors]))
|
||||
|
||||
x = labels
|
||||
y = errors
|
||||
|
||||
if equipment_risk == 'dosB':
|
||||
top = 6
|
||||
bottom = -6
|
||||
else:
|
||||
top = 0.60
|
||||
bottom = -0.60
|
||||
ls = 'dotted'
|
||||
|
||||
ls = 'dotted'
|
||||
fig, ax1 = plt.subplots(nrows=1, ncols=1)
|
||||
|
||||
ax1.set_ylim(bottom, top)
|
||||
@ -410,7 +416,7 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
||||
ax1.set_xlabel('Patrones')
|
||||
ax1.set_ylabel('Valores Observados')
|
||||
|
||||
ax1.set_yticks([-0.25,0.0,0.25])
|
||||
ax1.set_yticks([lowresolution,0.0,upresolution])
|
||||
#ax1.set_xticks([-10.0,-5.0,0.0,5.0,10.0])
|
||||
|
||||
ax1.errorbar(x, y, yerr=yerr, marker='D', markersize=10, linestyle=ls)
|
||||
@ -489,6 +495,7 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
||||
|
||||
if maintenance.equipment.product.resolution_type == "analoga":
|
||||
a_resolution = maintenance.equipment.product.analog_resolution
|
||||
resolution = a_resolution
|
||||
factor_a = maintenance.equipment.product.a_factor_resolution
|
||||
uncertain_b2_analog = (a_resolution) / (factor_a*mt.sqrt(3))
|
||||
sum_uncertain_c = (uncertain_type_A**2) + (uncertain_b1**2) + (uncertain_b2_analog**2)
|
||||
@ -496,6 +503,7 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
||||
uncertain_eff = uncertain_c**4/((uncertain_type_A**4)/(len(samples)-1)+(uncertain_b1**4/U_subi)+(uncertain_b2_analog**4/U_subi))
|
||||
elif maintenance.equipment.product.resolution_type == "digital":
|
||||
d_resolution = maintenance.equipment.product.d_resolution
|
||||
resolution = d_resolution
|
||||
uncertain_b2_digital = (d_resolution) / (2*mt.sqrt(3))
|
||||
sum_uncertain_c = (uncertain_type_A**2) + (uncertain_b1**2) + (uncertain_b2_digital**2)
|
||||
uncertain_c = mt.sqrt(sum_uncertain_c)
|
||||
@ -547,7 +555,8 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
||||
|
||||
maintenance.save()
|
||||
|
||||
image = cls.get_create_graph(dates_mistake_pattern, patterns)
|
||||
equipment_risk = maintenance.equipment.product.risk
|
||||
image = cls.get_create_graph(dates_mistake_pattern, patterns, resolution, equipment_risk)
|
||||
maintenance.graph_calibration = image
|
||||
maintenance.save()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user