Closedown
This commit is contained in:
@@ -99,23 +99,23 @@ def prepare_keithleys(dwell, triggered):
|
||||
|
||||
dwell = dwell time in seconds (0.1 - 20.0)
|
||||
"""
|
||||
KeiSample.prepare(dwell, triggered)
|
||||
KeiReference.prepare(dwell, triggered)
|
||||
#KeiSample.prepare(dwell, triggered)
|
||||
#KeiReference.prepare(dwell, triggered)
|
||||
|
||||
def trig_keithleys():
|
||||
"""
|
||||
trigger keithleys, do not wait.
|
||||
after this, you have to wait for at least the dwell time before reading the value!
|
||||
"""
|
||||
KeiSample.trig()
|
||||
KeiReference.trig()
|
||||
#KeiSample.trig()
|
||||
#KeiReference.trig()
|
||||
|
||||
def wait_keithleys():
|
||||
"""
|
||||
wait for one dwell time so that the keithleys can finish their measurement.
|
||||
if we polled them too early, they would produce an error message.
|
||||
"""
|
||||
time.sleep(KeiSample.dwell * 2.2)
|
||||
#time.sleep(KeiSample.dwell * 2.2)
|
||||
|
||||
def fetch_keithleys():
|
||||
"""
|
||||
@@ -123,16 +123,16 @@ def fetch_keithleys():
|
||||
this requires that at least the dwell time has passed since the last trigger.
|
||||
the value can then be read from the SampleCurrent and ReferenceCurrent devices.
|
||||
"""
|
||||
KeiSample.fetch()
|
||||
KeiReference.fetch()
|
||||
#KeiSample.fetch()
|
||||
#KeiReference.fetch()
|
||||
|
||||
def release_keithleys():
|
||||
"""
|
||||
switch keithleys to free run.
|
||||
0.1 s polling and dwell time
|
||||
"""
|
||||
KeiSample.release()
|
||||
KeiReference.release()
|
||||
#KeiSample.release()
|
||||
#KeiReference.release()
|
||||
|
||||
diag_channels = []
|
||||
diag_channels.append(Scienta.channelBegin) #diag_channels.append(ChannelDouble("ChannelBegin", "X03DA-SCIENTA:cam1:CHANNEL_BEGIN_RBV"))
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
"""
|
||||
Flying hologram scan (experimental)
|
||||
|
||||
Arguments:
|
||||
|
||||
THETA_RANGE (tuple (min, max))
|
||||
PHI_RANGE (tuple (min, max))
|
||||
THETA_STEP (scalar)
|
||||
PHI_STEP (scalar)
|
||||
|
||||
ZIGZAG (BOOLEAN)
|
||||
LATENCY (float) in seconds
|
||||
SENSORS (list of devices)
|
||||
"""
|
||||
import traceback
|
||||
THETA_RANGE = (-9.0, 81.0)
|
||||
THETA_STEP = 1.0
|
||||
PHI_RANGE = (-40.0, +40.0)
|
||||
#PHI_RANGE = (-160.0, +160.0)
|
||||
PHI_STEP = 40.0
|
||||
|
||||
LATENCY = 0.0
|
||||
ZIGZAG = True
|
||||
ENDSCAN = True
|
||||
MOTORS = (ManipulatorTheta)
|
||||
#SENSORS = (Counts, Scienta.spectrum, SampleCurrent, RefCurrent, MachineCurrent)
|
||||
SENSORS = (Counts, Scienta.dataMatrix, SampleCurrent, RefCurrent, MachineCurrent)
|
||||
|
||||
#set_preference(Preference.ENABLED_PLOTS, [ManipulatorPhi, ManipulatorTheta, Scienta.dataMatrix, ImageIntegrator])
|
||||
#set_preference(Preference.PLOT_TYPES,{'ImageIntegrator':1})
|
||||
adjust_sensors()
|
||||
set_adc_averaging()
|
||||
set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1})
|
||||
|
||||
# time per scienta acquisition in seconds
|
||||
time1 = time.time()
|
||||
trig_scienta()
|
||||
time2 = time.time()
|
||||
scienta_time = (time2 - time1) # + 1.0
|
||||
print "scienta_time: ", scienta_time
|
||||
|
||||
# time for one theta scan in seconds
|
||||
THETA_NSTEPS = int((THETA_RANGE[1] - THETA_RANGE[0]) / THETA_STEP) + 1
|
||||
theta_time = scienta_time * THETA_NSTEPS
|
||||
print "theta_time: ", theta_time
|
||||
|
||||
PHI_NSTEPS = int((PHI_RANGE[1] - PHI_RANGE[0]) / PHI_STEP) + 1
|
||||
phi_positions = [PHI_RANGE[0] + PHI_STEP * i for i in range(PHI_NSTEPS)]
|
||||
print "phi_positions: ", phi_positions
|
||||
|
||||
|
||||
try:
|
||||
for phi in phi_positions:
|
||||
ManipulatorPhi.write(phi)
|
||||
print "phi = ", phi
|
||||
ManipulatorPhi.waitValueInRange(phi, 1.0, 100)
|
||||
#try:
|
||||
#check_positions = False makes scan not to abort if cannot keep time base: can get less points
|
||||
cscan(MOTORS, SENSORS, THETA_RANGE[0], THETA_RANGE[1], THETA_NSTEPS - 1, time=theta_time, before_read=before_readout, after_read = after_readout, check_positions = False)
|
||||
#except ContinuousScanFollowingErrorException:
|
||||
# print time.time(), " cscan: exception at (theta, phi) = ({th}, {ph})".format(th=ManipulatorTheta.read(), ph=phi)
|
||||
if ZIGZAG:
|
||||
THETA_RANGE = (THETA_RANGE[1], THETA_RANGE[0])
|
||||
except:
|
||||
traceback.print_exc()
|
||||
finally:
|
||||
if ENDSCAN:
|
||||
after_scan()
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
"""
|
||||
Flying hologram scan (experimental)
|
||||
|
||||
Arguments:
|
||||
|
||||
THETA_RANGE (tuple (min, max))
|
||||
PHI_RANGE (tuple (min, max))
|
||||
THETA_STEP (scalar)
|
||||
PHI_STEP (scalar)
|
||||
|
||||
ZIGZAG (BOOLEAN)
|
||||
LATENCY (float) in seconds
|
||||
SENSORS (list of devices)
|
||||
"""
|
||||
|
||||
THETA_RANGE = (-9.0, 81.0)
|
||||
THETA_STEP = 1.0
|
||||
PHI_RANGE = (-40.0, +40.0)
|
||||
#PHI_RANGE = (-160.0, +160.0)
|
||||
PHI_STEP = 40.0
|
||||
|
||||
LATENCY = 0.0
|
||||
ZIGZAG = True
|
||||
ENDSCAN = True
|
||||
MOTORS = (ManipulatorTheta)
|
||||
#SENSORS = (Counts, Scienta.spectrum, SampleCurrent, RefCurrent, MachineCurrent)
|
||||
SENSORS = (Counts, Scienta.dataMatrix, SampleCurrent, RefCurrent, MachineCurrent)
|
||||
|
||||
#set_preference(Preference.ENABLED_PLOTS, [ManipulatorPhi, ManipulatorTheta, Scienta.dataMatrix, ImageIntegrator])
|
||||
#set_preference(Preference.PLOT_TYPES,{'ImageIntegrator':1})
|
||||
adjust_sensors()
|
||||
set_adc_averaging()
|
||||
set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1})
|
||||
|
||||
# time per scienta acquisition in seconds
|
||||
time1 = time.time()
|
||||
trig_scienta()
|
||||
time2 = time.time()
|
||||
scienta_time = (time2 - time1)
|
||||
print "scienta_time: ", scienta_time
|
||||
|
||||
# time for one theta scan in seconds
|
||||
THETA_NSTEPS = int((THETA_RANGE[1] - THETA_RANGE[0]) / THETA_STEP) + 1
|
||||
theta_time = scienta_time * THETA_NSTEPS
|
||||
print "theta_time: ", theta_time
|
||||
|
||||
PHI_NSTEPS = int((PHI_RANGE[1] - PHI_RANGE[0]) / PHI_STEP) + 1
|
||||
phi_positions = [PHI_RANGE[0] + PHI_STEP * i for i in range(PHI_NSTEPS)]
|
||||
print "phi_positions: ", phi_positions
|
||||
|
||||
|
||||
def before_pass(index, scan):
|
||||
global phi_positions
|
||||
print "Starting pass: ", index
|
||||
phi = phi_positions[index-1]
|
||||
ManipulatorPhi.write(phi)
|
||||
print "phi = ", phi
|
||||
ManipulatorPhi.waitValueInRange(phi, 1.0, 100)
|
||||
|
||||
|
||||
try:
|
||||
cscan(MOTORS, SENSORS, THETA_RANGE[0], THETA_RANGE[1], THETA_NSTEPS - 1, time=theta_time, passes=len(phi_positions), zigzag=ZIGZAG, before_read=before_readout, after_read = after_readout, before_pass = before_pass, check_positions = False)
|
||||
|
||||
finally:
|
||||
if ENDSCAN:
|
||||
after_scan()
|
||||
|
||||
Reference in New Issue
Block a user