From 350c61ce14d1f0ddf3f821f04a7cd25cb9550270 Mon Sep 17 00:00:00 2001 From: Andreas Freise <adf@star.bham.ac.uk> Date: Mon, 6 Jan 2014 21:28:23 +0000 Subject: [PATCH] cleaning up files up to this point. --- examples/asc_test/master.py | 7 +--- examples/asc_test/master2.py | 9 +++-- examples/asc_test/master3.py | 55 +++---------------------------- examples/asc_test/master3_plot.py | 15 --------- examples/asc_test/master4.py | 52 ++--------------------------- examples/asc_test/master4_plot.py | 15 --------- 6 files changed, 16 insertions(+), 137 deletions(-) diff --git a/examples/asc_test/master.py b/examples/asc_test/master.py index 826c607..91db296 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 4af7eaa..d7e8fcd 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 12fb88d..1e727af 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 8b09d80..5fa29ef 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 d49f8f0..90ebdec 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 852a704..25c566c 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() -- GitLab