From 79d0f52a6dff4c6c78b7ce73a4765d7bc61037af Mon Sep 17 00:00:00 2001 From: boccioli_m Date: Fri, 22 May 2015 15:14:50 +0200 Subject: [PATCH] Script execution --- script/Marco/power-supply.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/script/Marco/power-supply.py b/script/Marco/power-supply.py index 4ca3724..017fc88 100644 --- a/script/Marco/power-supply.py +++ b/script/Marco/power-supply.py @@ -1,4 +1,5 @@ #Script imported from: PO2DV-NCS-HW_ps.xml +from mathutils import estimate_peak_indexes, fit_gaussians, create_fit_point_list #Pre-actions caput('PO2DV-NCS-VHQ1:Set-RampA', '10') @@ -20,7 +21,7 @@ ActualIA = Channel('PO2DV-NCS-VHQ1:Actual-IA', type = 'd') #set voltage to 0 print 'Ramping down power supply to 0V' -SetVA.put(0.0, timeout=None) +SetVA.put(0.1, timeout=None) #wait up to 2 minutes for voltage to be ~0 for setpoint1 in frange(0.0, 120.0, 1.0, True): @@ -57,6 +58,18 @@ SetVA.close() ActualVA.close() ActualIA.close() +readable = scan.getReadable(0) +positions = scan.getPositions(0) + +threshold = (min(readable) + max(readable))/2 +min_peak_distance = 5.0 + +peaks = estimate_peak_indexes(readable, positions, threshold, min_peak_distance) +print "Peak indexes: " + str(peaks) +print "Peak x: " + str(map(lambda x:positions[x], peaks)) +print "Peak y: " + str(map(lambda x:readable[x], peaks)) + + scan.end() #Post-actions