Skip to content
Snippets Groups Projects
Commit 5b47eae8 authored by Daniel Brown's avatar Daniel Brown
Browse files

adding worst error to EI object, also fixing parsing for pd, qnoised and qshots

parent 32391cdc
Branches
No related tags found
No related merge requests found
......@@ -15,16 +15,17 @@ m m2 0.99 0.01 -0.1 n3 n4
attr m2 m 1 # mech sus1
ad up_refl 0 n1
ad low_refl 0 n1
ad up_refl $fs n1
ad low_refl $fs n1
qd refl_A 0 0 n1
qd refl_Q 0 90 n1
qd tran_A 0 0 n4
qd tran_Q 0 90 n4
put up_refl f $x1
put low_refl f $mx1
qnoised qnd 1 $fs max n4
qshot qsd 1 $fs max n4
pd1 p1 $fs max n4
yaxis log re:im
......@@ -47,10 +48,10 @@ a_up = out.y[:,0] + out.y[:,1]*1j
a_lo = out.y[:,2] + out.y[:,3]*-1j
pl.figure(1)
pl.loglog(out.x, np.abs(a_up + a_lo), out.x, np.abs((a_up - a_lo) / (1j)))
pl.loglog(out.x, out["p1"])
pl.xlabel(out.xlabel)
pl.title("Reflection quadratures with no relative carrier phase")
pl.legend(["Amplitude","Phase"])
#pl.show()
pl.show()
kat.remove(kat.signals)
\ No newline at end of file
......@@ -25,8 +25,13 @@ __suffix = {'y': 'e-24', # yocto
'P': 'e15' # peta
}
__exceptions = ["$fs", "$mfs"]
def SIfloat(value):
if value==None:
if value is None:
return value
if value in __exceptions:
return value
value = np.array(value)
......
......@@ -597,7 +597,13 @@ class pd(Detector1):
alt_str = "*"
for n in range(1, 1+self.num_demods):
fphi_str += " {0:.16g}".format(float(self.__getattribute__("f"+str(n))))
_f = self.__getattribute__("f"+str(n))
if _f == "$fs":
fphi_str += " $fs"
else:
fphi_str += " {0:.16g}".format(float(_f))
phi_val = self.__getattribute__("phi"+str(n))
if phi_val != None:
......@@ -703,7 +709,13 @@ class qnoised(pd):
alt_str = "*"
for n in range(1, 1+self.num_demods):
fphi_str += " {0:.16g}".format(float(self.__getattribute__("f"+str(n))))
_f = self.__getattribute__("f"+str(n))
if _f == "$fs":
fphi_str += " $fs"
else:
fphi_str += " {0:.16g}".format(float(_f))
phi_val = self.__getattribute__("phi"+str(n))
if phi_val != None:
......@@ -795,7 +807,13 @@ class qshot(pd):
alt_str = "*"
for n in range(1, 1+self.num_demods):
fphi_str += " {0:.16g}".format(float(self.__getattribute__("f"+str(n))))
_f = self.__getattribute__("f"+str(n))
if _f == "$fs":
fphi_str += " $fs"
else:
fphi_str += " {0:.16g}".format(float(_f))
phi_val = self.__getattribute__("phi"+str(n))
if phi_val != None:
......
......@@ -22,7 +22,7 @@ from scipy.integrate import newton_cotes
from multiprocessing import Process, Queue, Array, Value, Event
EmpiricalInterpolant = collections.namedtuple('EmpiricalInterpolant', 'B nodes node_indices limits x')
EmpiricalInterpolant = collections.namedtuple('EmpiricalInterpolant', 'B nodes node_indices limits x worst_error')
ReducedBasis = collections.namedtuple('ReducedBasis', 'RB limits x')
ROMLimits = collections.namedtuple('ROMLimits', 'zmin zmax w0min w0max R mapSamples max_order')
......@@ -795,7 +795,8 @@ def MakeROMFromHDF5(hdf5Filename, greedyFilename=None, EIFilename=None, tol=1e-1
nodes=np.array(x_nodes).squeeze(),
node_indices=np.array(EI_indices).squeeze(),
limits=limits,
x=x.squeeze())
x=x.squeeze(),
worst_error=worst_error)
if EIFilename is not None:
with open("%s.p" % EIFilename, 'wb') as f:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment