diff --git a/examples/asc_test/master.py b/examples/asc_test/master.py index 826c6070b2d9dac30f85e2281b321f2a06bd7189..91db2966fb262412058c195395912ffa13019004 100644 --- a/examples/asc_test/master.py +++ b/examples/asc_test/master.py @@ -83,13 +83,8 @@ def main(): tmpfile = shelve.open(tmpresultfile) tmpfile['result']=result tmpfile.close() - - -#------------------------------------------------------------------- -#------------------------------------------------------------------- -#------------------------------------------------------------------- - +#--------------------------------------------------------------------------- def pd_signal(tmpkat): diff --git a/examples/asc_test/master2.py b/examples/asc_test/master2.py index 4af7eaa4acfca1511f1918c269e5983a7046379a..d7e8fcd6587a96109e3224481255792d02baf51f 100644 --- a/examples/asc_test/master2.py +++ b/examples/asc_test/master2.py @@ -100,9 +100,14 @@ def main(): print "--------------------------------------------------------" print " 8. compute ASC signal matrix at WFS1 and WFS2" signal = asc_signal(kat) + +print "--------------------------------------------------------" + print " 9. ASC signals for large misalignments (ITM)" + asc_large(kat) + print "--------------------------------------------------------" - print " Saving results in temp. files to be read by master2.py" + print " Saving results in temp. files to be read by master3.py" tmpkatfile = "asc_base3.kat" tmpresultfile = "myshelf2.dat" print " kat object saved in: {0}".format(tmpkatfile) @@ -116,7 +121,7 @@ def main(): #----------------------------------------------------------------------------------- - + def asc_signal(tmpkat): kat = copy.deepcopy(tmpkat) diff --git a/examples/asc_test/master3.py b/examples/asc_test/master3.py index 12fb88d2b6ea638a6320e52fdf9ace3c0bef2083..1e727affff6db171fc1487975f131ab4fe211e43 100644 --- a/examples/asc_test/master3.py +++ b/examples/asc_test/master3.py @@ -7,14 +7,6 @@ import copy import sys import shutil -from itertools import cycle -import matplotlib -from matplotlib import rc -import matplotlib.pyplot as plt -formatter = matplotlib.ticker.EngFormatter(unit='', places=0) -formatter.ENG_PREFIXES[-6] = 'u' - - def main(): print """ @@ -27,7 +19,9 @@ def main(): to generate the Finesse results reported in the document: `Comparing Finesse simulations, analytical solutions and OSCAR simulations of Fabry-Perot alignment signals', LIGO-T1300345 - + + This file is part of a collection. Run this after master2.py + Run this file to create the data and master3_plot.py to plot the results. Results are saved after each step and plots can be created at any time. @@ -59,7 +53,8 @@ def main(): print "--------------------------------------------------------" print " 9. ASC signals for large misalignments (ITM)" asc_large(kat) - + +#----------------------------------------------------------------------------------- def asc_large(tmpkat): kat = copy.deepcopy(tmpkat) @@ -98,46 +93,6 @@ def asc_large(tmpkat): tmpfile['out']=out tmpfile['maxtems']=done_maxtems tmpfile.close() - -def asc_signal(tmpkat): - kat = copy.deepcopy(tmpkat) - - code_lock = """ - set err PDrefl_p re - lock z $err 900 1p - put* ETM phi $z - noplot z - """ - - kat.parseKatCode(code_lock) - kat.parseKatCode('yaxis abs') - kat.noxaxis = True - kat.maxtem=1 - - signal=np.zeros((2, 2)) - kat.ITM.ybeta=1e-10 - kat.ETM.ybeta=0.0 - out = kat.run(printout=0,printerr=0) - WFS1_idx=out.ylabels.index("WFS1_I") - WFS2_idx=out.ylabels.index("WFS2_I") - signal[0,0] = out.y[WFS1_idx] - signal[1,0] = out.y[WFS2_idx] - - kat.ITM.ybeta=0.0 - kat.ETM.ybeta=-1e-10 - out = kat.run(printout=0,printerr=0) - signal[0,1] = out.y[WFS1_idx] - signal[1,1] = out.y[WFS2_idx] - signal = signal *1e10 - sensors=('WFS1', 'WFS2') - mirrors=('ITM', 'ETM') - print " ASC Matrix:" - for i in range(2): - print " ", sensors[i], " ", - for j in range(2): - print "%12.10g" % signal[i,j], - print mirrors[i] - return signal if __name__ == '__main__': diff --git a/examples/asc_test/master3_plot.py b/examples/asc_test/master3_plot.py index 8b09d8037b6e44dd7e2d1e3306f0f6b7f4a8f824..5fa29ef83cfe95cc76992dfe7375372853092644 100644 --- a/examples/asc_test/master3_plot.py +++ b/examples/asc_test/master3_plot.py @@ -3,20 +3,14 @@ from pykat.commands import * import pylab as pl import numpy as np import shelve -import copy import sys -import shutil -from itertools import cycle import matplotlib -from matplotlib import rc -import matplotlib.pyplot as plt formatter = matplotlib.ticker.EngFormatter(unit='', places=0) formatter.ENG_PREFIXES[-6] = 'u' import matplotlib.backends.backend_pdf def printPDF(self): - filename = 'test.pdf' pdfp = matplotlib.backends.backend_pdf.PdfPages('large_ITM.pdf') pdfp.savefig(self,dpi=300,bbox_inches='tight') pdfp.close() @@ -50,15 +44,6 @@ def main(): #global out #global result - tmpresultfile = 'myshelf2.dat' - - # loading data saved by master.py - try: - tmpfile = shelve.open(tmpresultfile) - result=tmpfile['result'] - tmpfile.close() - except: raise Exception("Could not open temprary results file {0}".format(tmpresultfile)) - print "--------------------------------------------------------" print " 9. Plotting ASC signals for large misalignments" asc_large() diff --git a/examples/asc_test/master4.py b/examples/asc_test/master4.py index d49f8f0988ba4763526f9904102fbdb807907893..90ebdecdbf9ad5e34c6453b7facffd2e4cd3d679 100644 --- a/examples/asc_test/master4.py +++ b/examples/asc_test/master4.py @@ -7,13 +7,6 @@ import copy import sys import shutil -from itertools import cycle -import matplotlib -from matplotlib import rc -import matplotlib.pyplot as plt -formatter = matplotlib.ticker.EngFormatter(unit='', places=0) -formatter.ENG_PREFIXES[-6] = 'u' - def main(): @@ -27,7 +20,9 @@ def main(): to generate the Finesse results reported in the document: `Comparing Finesse simulations, analytical solutions and OSCAR simulations of Fabry-Perot alignment signals', LIGO-T1300345 - + + This file is part of a collection. Run this after master2.py + Run this file to create the data and master4_plot.py to plot the results. Results are saved after each step and plots can be created at any time. @@ -98,47 +93,6 @@ def asc_large(tmpkat): tmpfile['out']=out tmpfile['maxtems']=done_maxtems tmpfile.close() - -def asc_signal(tmpkat): - kat = copy.deepcopy(tmpkat) - - code_lock = """ - set err PDrefl_p re - lock z $err 900 1p - put* ETM phi $z - noplot z - """ - - kat.parseKatCode(code_lock) - kat.parseKatCode('yaxis abs') - kat.noxaxis = True - kat.maxtem=1 - - signal=np.zeros((2, 2)) - kat.ITM.ybeta=1e-10 - kat.ETM.ybeta=0.0 - out = kat.run(printout=0,printerr=0) - WFS1_idx=out.ylabels.index("WFS1_I") - WFS2_idx=out.ylabels.index("WFS2_I") - signal[0,0] = out.y[WFS1_idx] - signal[1,0] = out.y[WFS2_idx] - - kat.ITM.ybeta=0.0 - kat.ETM.ybeta=-1e-10 - out = kat.run(printout=0,printerr=0) - signal[0,1] = out.y[WFS1_idx] - signal[1,1] = out.y[WFS2_idx] - signal = signal *1e10 - sensors=('WFS1', 'WFS2') - mirrors=('ITM', 'ETM') - print " ASC Matrix:" - for i in range(2): - print " ", sensors[i], " ", - for j in range(2): - print "%12.10g" % signal[i,j], - print mirrors[i] - return signal - if __name__ == '__main__': main() diff --git a/examples/asc_test/master4_plot.py b/examples/asc_test/master4_plot.py index 852a704d7fe68ea4c3d3a67998af3a049de3c6f6..25c566cd441e3400031fdff398f0f179f1c0b597 100644 --- a/examples/asc_test/master4_plot.py +++ b/examples/asc_test/master4_plot.py @@ -3,20 +3,14 @@ from pykat.commands import * import pylab as pl import numpy as np import shelve -import copy import sys -import shutil -from itertools import cycle import matplotlib -from matplotlib import rc -import matplotlib.pyplot as plt formatter = matplotlib.ticker.EngFormatter(unit='', places=0) formatter.ENG_PREFIXES[-6] = 'u' import matplotlib.backends.backend_pdf def printPDF(self): - filename = 'test.pdf' pdfp = matplotlib.backends.backend_pdf.PdfPages('large_ETM.pdf') pdfp.savefig(self,dpi=300,bbox_inches='tight') pdfp.close() @@ -50,15 +44,6 @@ def main(): #global out #global result - tmpresultfile = 'myshelf2.dat' - - # loading data saved by master.py - try: - tmpfile = shelve.open(tmpresultfile) - result=tmpfile['result'] - tmpfile.close() - except: raise Exception("Could not open temprary results file {0}".format(tmpresultfile)) - print "--------------------------------------------------------" print " 10. Plotting ASC signals for large misalignments (ETM)" asc_large()