From 71db608d95003eedb05de08d7aad8ef7551fe736 Mon Sep 17 00:00:00 2001 From: gobbo_a Date: Mon, 9 Jan 2017 18:35:46 +0100 Subject: [PATCH] Closedown --- script/Alignment/Gun_solenoid_alignment.py | 4 ++-- script/Alignment/Laser_gun_alignment.py | 4 ++-- script/Correlation/Correlation.py | 6 +++--- script/RFscan/SchottkyICT.py | 2 +- script/RFscan/phase_scan_caqtdm.py | 2 +- script/RFscan/phase_scan_caqtdm_dv.py | 2 +- script/RFscan/phase_scan_caqtdm_dv2.py | 2 +- script/local.py | 10 +++++----- script/test/Gun_solenoid_alignment_dv_test.py | 2 +- script/test/region_scan_with_elog.py | 2 +- script/test/toto.py | 4 ++-- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/script/Alignment/Gun_solenoid_alignment.py b/script/Alignment/Gun_solenoid_alignment.py index a7aca47..f91b8e2 100755 --- a/script/Alignment/Gun_solenoid_alignment.py +++ b/script/Alignment/Gun_solenoid_alignment.py @@ -12,7 +12,7 @@ import datetime use_bpm = False -if get_context().source == CommandSource.ui: +if get_exec_pars().source == CommandSource.ui: I1 = 95.0 I2 = 100.0 dI = 1.0 @@ -116,7 +116,7 @@ else: hx.append(hx[0]); hy.append(hy[0]) # save the entry in the logbook -gsa_log_msg = "Data file: " + get_context().path +gsa_log_msg = "Data file: " + get_exec_pars().path gsa_log_msg = gsa_log_msg + "\nImages: " + str(number_images) gsa_log_msg = gsa_log_msg + "\nBackground: enabled=" + str(use_background) + " multiple=" + str(multiple_background) + " number=" + str(number_backgrounds) gsa_log_msg = gsa_log_msg + "\n\n" + r.print() diff --git a/script/Alignment/Laser_gun_alignment.py b/script/Alignment/Laser_gun_alignment.py index 4812599..4395c0a 100755 --- a/script/Alignment/Laser_gun_alignment.py +++ b/script/Alignment/Laser_gun_alignment.py @@ -12,7 +12,7 @@ import datetime use_bpm = False -if get_context().source == CommandSource.ui: +if get_exec_pars().source == CommandSource.ui: phi1= 95.0 phi2 = 100.0 dphi = 1.0 @@ -116,7 +116,7 @@ else: # save the entry in the logbook -gsa_log_msg = "Data file: " + get_context().path +gsa_log_msg = "Data file: " + get_exec_pars().path gsa_log_msg = gsa_log_msg + "\nImages: " + str(number_images) + " Background: enabled=" + str(use_background) + " multiple=" + str(multiple_background) + " number=" + str(number_backgrounds) gsa_log_msg = gsa_log_msg + "\nPhase range: " + str(phi1) + " to " + str(phi2) gsa_log_msg = gsa_log_msg + "\nLaser position on cathod: " + str(caget("SLG-LCAM-C103:FIT-XPOS")) + "/" + str(caget("SLG-LCAM-C103:FIT-YPOS")) diff --git a/script/Correlation/Correlation.py b/script/Correlation/Correlation.py index 3169b3c..5379759 100644 --- a/script/Correlation/Correlation.py +++ b/script/Correlation/Correlation.py @@ -5,7 +5,7 @@ from plotutils import plot_line, plot_function from ch.psi.pshell.swing.Shell import STDOUT_COLOR import org.apache.commons.math3.stat.correlation.PearsonsCorrelation as PearsonsCorrelation -if get_context().source == CommandSource.ui: +if get_exec_pars().source == CommandSource.ui: #dx = "SINEG01-RLLE-REF10:SIG-PHASE-AVG" #dy = "SINEG01-RLLE-REF20:SIG-PHASE-AVG" #dx = "SINEG01-RGUN-PUP10:SIG-AMPLT-AVG 4" @@ -110,7 +110,7 @@ try: sd.setPointSize(4) - if get_context().source == CommandSource.ui: + if get_exec_pars().source == CommandSource.ui: if globals().has_key("marker"): p.removeMarker(marker) marker=None @@ -138,7 +138,7 @@ try: corr= PearsonsCorrelation().correlation(to_array(ax,'d'), to_array(ay,'d')) s = "Correlation=" + str(round(corr,4)) #print s - if get_context().source == CommandSource.ui: + if get_exec_pars().source == CommandSource.ui: if marker is not None: p.removeMarker(marker) marker = p.addMarker(x2+res, p.AxisId.X, s, p.getBackground()) diff --git a/script/RFscan/SchottkyICT.py b/script/RFscan/SchottkyICT.py index 382fd56..2929919 100644 --- a/script/RFscan/SchottkyICT.py +++ b/script/RFscan/SchottkyICT.py @@ -6,4 +6,4 @@ instrument = Channel("SINEG01-DICT215:B1_CHARGE", 'd', alias = "Bunch Charge (IC r = lscan(knob, [instrument], 0, 360., 10.,2.0) -elog("SchottkyICT", "Data file: " + get_context().path + "\n\n" + r.print() , get_plot_snapshots()) +elog("SchottkyICT", "Data file: " + get_exec_pars().path + "\n\n" + r.print() , get_plot_snapshots()) diff --git a/script/RFscan/phase_scan_caqtdm.py b/script/RFscan/phase_scan_caqtdm.py index 30ccc1f..147be57 100755 --- a/script/RFscan/phase_scan_caqtdm.py +++ b/script/RFscan/phase_scan_caqtdm.py @@ -7,7 +7,7 @@ import ch.psi.pshell.epics.ControlledVariable as ControlledVariable latency = 0.05 -if get_context().source == CommandSource.ui: +if get_exec_pars().source == CommandSource.ui: prefix = "MINSB03-RSYS" start = -170.0 stop = 180.0 diff --git a/script/RFscan/phase_scan_caqtdm_dv.py b/script/RFscan/phase_scan_caqtdm_dv.py index 8e95ec3..332d09d 100644 --- a/script/RFscan/phase_scan_caqtdm_dv.py +++ b/script/RFscan/phase_scan_caqtdm_dv.py @@ -1,6 +1,6 @@ import ch.psi.pshell.epics.ControlledVariable as ControlledVariable -if get_context().source != CommandSource.ui: +if get_exec_pars().source != CommandSource.ui: prefix = args[0] + "-RSYS" start = caget(prefix + ":SET-SCAN-START") diff --git a/script/RFscan/phase_scan_caqtdm_dv2.py b/script/RFscan/phase_scan_caqtdm_dv2.py index 143bfb0..942a9fe 100644 --- a/script/RFscan/phase_scan_caqtdm_dv2.py +++ b/script/RFscan/phase_scan_caqtdm_dv2.py @@ -2,7 +2,7 @@ import ch.psi.pshell.epics.ControlledVariable as ControlledVariable latency = 0.05 -if get_context().source == CommandSource.ui: +if get_exec_pars().source == CommandSource.ui: prefix = "SINSB04-RSYS" start = 0.0 stop = 360.0 diff --git a/script/local.py b/script/local.py index b541a75..72642c4 100755 --- a/script/local.py +++ b/script/local.py @@ -131,7 +131,7 @@ def elog(title, message, attachments = [], author = None, category = "Info", dom Add entry to ELOG. """ if author is None: - author = "pshell" #context.getUser().name + author = "pshell" #get_context().user.name typ = "pshell" entry = "" @@ -156,7 +156,7 @@ def elog(title, message, attachments = [], author = None, category = "Info", dom raise Exception(err) print out -def get_plot_snapshots(title = None, file_type = "png", temp_path = context.setup.getContextPath()): +def get_plot_snapshots(title = None, file_type = "png", temp_path = get_context().setup.getContextPath()): """ Returns list with file names of plots snapshots from a plotting context. """ @@ -184,7 +184,7 @@ center_x.setPolling(100) center_y.setPolling(100) -if not context.isLocalMode(): +if not get_context().isLocalMode(): try: run("camtool") add_device(CamTool("image_stats", prefix = "SINEG01-DSCR190:", latch = True, camera = "SINEG01-DSCR190", gauss = False), True) @@ -255,13 +255,13 @@ avy = create_averager(comy, 5, 0.001) #CAS -if context.isServerEnabled(): +if get_context().isServerEnabled(): import ch.psi.pshell.epics.CAS as CAS #CAS.setServerPort(5062) class ServerUrl(ReadonlyRegisterBase): def doRead(self): - return context.server.baseURL + return get_context().server.baseURL d = ServerUrl() d.initialize() diff --git a/script/test/Gun_solenoid_alignment_dv_test.py b/script/test/Gun_solenoid_alignment_dv_test.py index 1058e55..a81a54b 100644 --- a/script/test/Gun_solenoid_alignment_dv_test.py +++ b/script/test/Gun_solenoid_alignment_dv_test.py @@ -44,6 +44,6 @@ plot(r.getReadable(2), xdata=r.getReadable(1), title = "Centroid excursion") # save the entry in the logbook msg = str(r) -msg = msg + "\nFile: " + get_context().path +msg = msg + "\nFile: " + get_exec_pars().path msg = msg + "\n\n" + r.print() elog("Gun solenoid current scan", msg , get_plot_snapshots()) diff --git a/script/test/region_scan_with_elog.py b/script/test/region_scan_with_elog.py index 192a189..f3df0ec 100755 --- a/script/test/region_scan_with_elog.py +++ b/script/test/region_scan_with_elog.py @@ -2,6 +2,6 @@ a= rscan(ao1, (ai1,ai2), [(0,5,5), (10,15,20), (20,25,5)] , 0.01) msg = str(a) -msg = msg + "\nFile: " + get_context().path +msg = msg + "\nFile: " + get_exec_pars().path msg = msg + "\n\n" + a.print() elog("Region scan", msg , get_plot_snapshots()) diff --git a/script/test/toto.py b/script/test/toto.py index 9c6851c..4f1546c 100755 --- a/script/test/toto.py +++ b/script/test/toto.py @@ -5,7 +5,7 @@ #1D vector scan, plot to 1D Vector tab vector = [ 1, 3, 5, 10, 25, 40, 45, 47, 49] -a= vscan(ao1,(ai1,ai2),vector,False, 0.5, context = "1D Vector") +a= vscan(ao1,(ai1,ai2),vector,False, 0.5, title = "1D Vector") @@ -17,5 +17,5 @@ vector = [ [1,1] , [1,2] , [1,3] , [1,4] , [2.5,2.5] , [3,1] , [3,2] , [3,3] , [3,4] ] -a= vscan((m1,m2),(ai1,ai2),vector,False, 0.1, context = "2D Vector") +a= vscan((m1,m2),(ai1,ai2),vector,False, 0.1, title = "2D Vector")