diff --git a/bin/test_fsig.py b/bin/test_fsig.py index 66ccfa125cefaf3ed7004667f05d3e8dbee7e192..e26ceb3e49e664ce0c208bf1f307b22fafd95fd3 100644 --- a/bin/test_fsig.py +++ b/bin/test_fsig.py @@ -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 diff --git a/pykat/SIfloat.py b/pykat/SIfloat.py index aa65c9ec2313f68deb721d7508182e61368c5937..d6e16ab5a6c0ddbc72ca6a5871571a40d51a5801 100644 --- a/pykat/SIfloat.py +++ b/pykat/SIfloat.py @@ -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) diff --git a/pykat/detectors.py b/pykat/detectors.py index 9fb0bd66b2d1bb236db4b8e01390d3b619036f51..4609caaadb7b27e248b0bd4c11d72ada30630545 100644 --- a/pykat/detectors.py +++ b/pykat/detectors.py @@ -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: diff --git a/pykat/optics/romhom.py b/pykat/optics/romhom.py index 5680c7a93f6ac2ecfdcc3ad53af3d943b01fe15e..de6eaa6d0c816e76f7140de9c64a14c4294b1262 100644 --- a/pykat/optics/romhom.py +++ b/pykat/optics/romhom.py @@ -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: