Using python I am calling a class from another .py file to do some maths. But its adding a V at the end of it. I would like to remove the V. I have tried replace but I keep getting an error,
AttributeError Traceback (most recent call last)
Cell In[11], line 8
5 #results.report.expanded(k=2)
6 #results.expanded(0.9545)
7 UoM = results.expand(k=2)
----> 8 UoM_sig_digits = Number(UoM, n=2, fmt='decimal').replace('V', '')
9 UoM_value = UoM_sig_digits
10 #print(UoM_sig_digits)
AttributeError: 'Number' object has no attribute 'replace'
This is the code I am trying to run,
import matplotlib.pyplot as plt
import numpy as np
import suncal
from suncal.common.report import Number
model = suncal.Model('f = V')
model.var('V').measure([10.000070, 10.000069, 10.000069, 10.000069, 10.000069, 10.000069, 10.000069], units='volts').typeb(name='Resolution',dist='uniform', unc=0.5, units='microvolts').typeb(name='Thermal EMF', dist='uniform', unc=0.3*2, units='microvolts').typeb(name='Spec % of reading', unc='0.0035%', k=2, units='volt').typeb(name='Spec % of range', unc='0.0005 %range(10)', k=2, units='volt')
model.calculate_gum()
results = model.calculate_gum()
UoM = results.expand(k=2)
UoM_sig_digits = Number(UoM, n=2, fmt='decimal').replace('V', '')
print(UoM_sig_digits)
I can get it to spit out 0.00035 V but as soon as I try a replace it gets funny. The Number is a class.