class TestFreqRespSetProbe: kat = katFP() # fin.addReadout(kat, 'REFL', 'IX_bk', 11e3, 0, freqresp=False) # for probe in ['REFL_DC', 'REFL_I', 'REFL_Q']: # fin.set_probe_response(kat, probe, 'fr') # now this step is done automatically # fin.set_all_probe_response(kat, 'fr') katFR = fin.KatFR(kat) katFR.run(1e-2, 1e4, 1000) def test_tfI(self): tfI = self.katFR.getTF('REFL_I', 'EX') assert close.allclose(tfI, data['tfI']) def test_tfQ(self): tfQ = self.katFR.getTF('REFL_Q', 'EX') assert close.allclose(tfQ, data['tfQ'])
class TestFreqResp: kat = katMI(90, 0, 45) fin.addReadout(kat, 'AS', 'AS_in', fmod, 0) katTF = fin.KatFR(kat) katTF.run(1, 1e4, 400) def test_tfQ_EM(self): tfQ_EM = self.katTF.getTF('AS_Q', {'EX': 0.5, 'EY': -0.5}) assert close.allclose(tfQ_EM, data['tfQ_EM']) def test_tfI_EM(self): tfI_EM = self.katTF.getTF('AS_I', {'EX': 0.5, 'EY': -0.5}) assert close.allclose(tfI_EM, data['tfI_EM']) def test_tfQ_IM(self): tfQ_IM = self.katTF.getTF('AS_Q', {'IX': 0.5, 'IY': -0.5}) assert close.allclose(tfQ_IM, data['tfQ_IM'])
zpk_tst = ss_tst.to_zpk() zpk_pum = ss_pum.to_zpk() zpk_sus = ss_sus.to_zpk() # convert to PyTickle Filters tst2tst = define_filt(zpk_tst) # test mass force to position pum2tst = define_filt(zpk_pum) # PUM force to test mass position sus2tst = define_filt(zpk_sus) # sus point position to test mass position ############################################################################## # compute the optomechanical plant ############################################################################## par = parFPMI.parFPMI(zpk_tst.zeros, zpk_tst.poles, zpk_tst.gain) kat = katFPMI.katFPMI(par) katFR = fin.KatFR(kat, all_drives=False) katFR.addDrives(['EX', 'EY', 'BS']) # Run the model fmin = 0.3 fmax = 1e3 npts = 400 katFR.run(fmin, fmax, npts) ff = katFR.ff # Define the probes that will be used to sense each DOF. DARM = dict(EX=1 / 2, EY=-1 / 2) CARM = dict(EX=1 / 2, EY=1 / 2) probesDARM = {'AS_Q': 1 / np.abs(katFR.getTF('AS_Q', DARM)[0])} probesCARM = {'REFL_I': 1 / np.abs(katFR.getTF('REFL_I', CARM)[0])}
def getKatFR(kat): katFR = fin.KatFR(kat, all_drives=False) katFR.addDrives(['EX', 'EY']) return katFR
fin.addSpace(kat, 'Laser_out', 'Mod_in', 0) fin.addSpace(kat, 'Mod_out', 'IX_bk', 0) # add DC and RF photodiodes fin.addReadout(kat, 'REFL', 'IX_bk', fmod, 0, doftype='pitch') fin.monitorMotion(kat, 'EX', doftype='pitch') fin.monitorMotion(kat, 'IX', doftype='pitch') fin.monitorBeamSpotMotion(kat, 'EX_fr') fin.monitorBeamSpotMotion(kat, 'IX_fr') kat.phase = 2 kat.maxtem = 1 katTF = fin.KatFR(kat) HARD = {'IX': -1, 'EX': r} SOFT = {'IX': r, 'EX': 1} fmin = 1e-1 fmax = 30 npts = 1000 katTF.run(fmin, fmax, npts, doftype='pitch') katTF.runDC() katTF.save('test_torsional_spring.hdf5') katTF2 = plant.FinessePlant() katTF2.load('test_torsional_spring.hdf5') os.remove('test_torsional_spring.hdf5')
class TestFreqResp: kat = katFP() katFR = fin.KatFR(kat) katFR.run(1e-2, 1e4, 1000) katFR.run(1e-2, 1e4, 1000, doftype='freq') katFR.runDC() katFR.run(1e-2, 1e4, 1000, doftype='amp') katFR.save('test_PDH.hdf5') katFR2 = plant.FinessePlant() katFR2.load('test_PDH.hdf5') os.remove('test_PDH.hdf5') def test_tfI(self): ex = DegreeOfFreedom('EX') ex2 = DegreeOfFreedom('EX', probes='REFL_I') ex3 = DegreeOfFreedom('EX', probes='REFL_DC') tfI1 = self.katFR.getTF('REFL_I', 'EX') tfI2 = self.katFR.getTF('REFL_I', ex) tfI3 = self.katFR.getTF(ex2) tfI4 = self.katFR.getTF('REFL_I', ex3) c1 = close.allclose(tfI1, data['tfI']) c2 = close.allclose(tfI2, data['tfI']) c3 = close.allclose(tfI3, data['tfI']) c4 = close.allclose(tfI4, data['tfI']) assert np.all([c1, c2, c3, c4]) def test_tfQ(self): ex = DegreeOfFreedom(name='EX', drives='EX', doftype='pos') ex2 = DegreeOfFreedom(name='EX', drives='EX', doftype='pos', probes='REFL_Q') tfQ1 = self.katFR.getTF('REFL_Q', 'EX') tfQ2 = self.katFR.getTF('REFL_Q', ex) tfQ3 = self.katFR.getTF(ex2) c1 = close.allclose(tfQ1, data['tfQ']) c2 = close.allclose(tfQ2, data['tfQ']) c3 = close.allclose(tfQ3, data['tfQ']) assert np.all([c1, c2, c3]) def test_qnI(self): qnI = self.katFR.getQuantumNoise('REFL_I') assert close.allclose(qnI, data['qnI']) def test_qnQ(self): qnQ = self.katFR.getQuantumNoise('REFL_Q') assert close.allclose(qnQ, data['qnQ']) def test_qnDC(self): qnDC = self.katFR.getQuantumNoise('REFL_DC') assert close.allclose(qnDC, data['qnDC']) def test_freqI(self): laser = DegreeOfFreedom('Laser', 'freq') laser2 = DegreeOfFreedom('Laser', probes='REFL_I', doftype='freq') tf1 = self.katFR.getTF('REFL_I', 'Laser', doftype='freq') tf2 = self.katFR.getTF('REFL_I', laser) tf3 = self.katFR.getTF(laser2) c1 = close.allclose(tf1, data['tfI_freq']) c2 = close.allclose(tf2, data['tfI_freq']) c3 = close.allclose(tf3, data['tfI_freq']) assert np.all([c1, c2]) def test_freqQ(self): tf = self.katFR.getTF('REFL_Q', 'Laser', doftype='freq') assert close.allclose(tf, data['tfQ_freq']) def test_ampI(self): laser = DegreeOfFreedom('Laser', 'amp') laser2 = DegreeOfFreedom('Laser', probes='REFL_I', doftype='amp') tf1 = self.katFR.getTF('REFL_I', 'Laser', doftype='amp') tf2 = self.katFR.getTF('REFL_I', laser) tf3 = self.katFR.getTF(laser2) c1 = close.allclose(tf1, data['tfI_amp']) c2 = close.allclose(tf2, data['tfI_amp']) c3 = close.allclose(tf3, data['tfI_amp']) assert np.all([c1, c2, c3]) def test_ampQ(self): tf = self.katFR.getTF('REFL_Q', 'Laser', doftype='amp') assert close.allclose(tf, data['tfQ_amp']) def test_DC_DC(self): sig = self.katFR.getSigDC('REFL_DC') assert close.isclose(sig, data['dcDC']) def test_DC_I(self): sig = self.katFR.getSigDC('REFL_I') assert close.isclose(sig, data['dcI']) def test_DC_Q(self): sig = self.katFR.getSigDC('REFL_Q') assert close.isclose(sig, data['dcQ']) def test_amp2pos(self): ex = DegreeOfFreedom('EX') laser_amp = DegreeOfFreedom('Laser', 'amp') amp2pos = self.katFR.getMechTF(ex, laser_amp) assert close.allclose(amp2pos, data['amp2pos']) def test_reload_tfI(self): tfI = self.katFR2.getTF('REFL_I', 'EX') assert close.allclose(tfI, data['tfI']) def test_reload_tfQ(self): tfQ = self.katFR2.getTF('REFL_Q', 'EX') assert close.allclose(tfQ, data['tfQ']) def test_reload_qnI(self): qnI = self.katFR2.getQuantumNoise('REFL_I') assert close.allclose(qnI, data['qnI']) def test_reload_qnQ(self): qnQ = self.katFR2.getQuantumNoise('REFL_Q') assert close.allclose(qnQ, data['qnQ']) def test_reload_qnDC(self): qnDC = self.katFR2.getQuantumNoise('REFL_DC') assert close.allclose(qnDC, data['qnDC']) def test_reload_freqI(self): tf = self.katFR2.getTF('REFL_I', 'Laser', doftype='freq') assert close.allclose(tf, data['tfI_freq']) def test_reload_freqQ(self): tf = self.katFR2.getTF('REFL_Q', 'Laser', doftype='freq') assert close.allclose(tf, data['tfQ_freq']) def test_reload_ampI(self): tf = self.katFR2.getTF('REFL_I', 'Laser', doftype='amp') assert close.allclose(tf, data['tfI_amp']) def test_reload_ampQ(self): tf = self.katFR2.getTF('REFL_Q', 'Laser', doftype='amp') assert close.allclose(tf, data['tfQ_amp']) def test_reload_DC_DC(self): sig = self.katFR2.getSigDC('REFL_DC') assert close.isclose(sig, data['dcDC']) def test_reload_DC_I(self): sig = self.katFR2.getSigDC('REFL_I') assert close.isclose(sig, data['dcI']) def test_reload_DC_Q(self): sig = self.katFR2.getSigDC('REFL_Q') assert close.isclose(sig, data['dcQ'])