diff --git a/startup/11-energy.py b/startup/11-energy.py index 5e5be09..f384e41 100644 --- a/startup/11-energy.py +++ b/startup/11-energy.py @@ -19,15 +19,16 @@ def energy_to_gap(target_energy, undulator_harmonic=1): fundamental_energy = target_energy / float(undulator_harmonic) f = fundamental_energy - a = -53.025391 - b1 = 0.220837 - b2 = -3.537803e-4 - b3 = 3.105219e-7 - b4 = -1.587795e-10 - b5 = 4.734179e-14 - b6 = -7.633003e-18 - b7 = 5.14881e-22 - gap = a + b1*f + b2*f**2 + b3 * f**3 + b4 * f**4 + b5 * f**5 + b6 * f**6 + b7 * f**7 - 0.07 + #measured fundamnetal harmonic on the 20th September 2018 + a = 24.31415 #-53.025391 values until 20Sep'18 + b1 = -0.08224 #0.220837 + b2 = 1.38266e-4 #-3.537803e-4 + b3 = -1.18903e-7 #-13.105219e-7 + b4 = 5.90784e-11 #-1.587795e-10 + b5 = -1.70272e-14 #4.734179e-14 + b6 = 2.64385e-18 #-7.633003e-18 + b7 = -1.70455e-22 #5.14881e-22 + gap = a + b1*f + b2*f**2 + b3 * f**3 + b4 * f**4 + b5 * f**5 + b6 * f**6 + b7 * f**7 return gap def energy_to_dcm_pitch(target_energy, offset=0.0): @@ -128,7 +129,7 @@ def forward(self, p_pos): # compute where we would move everything to in a perfect world target_ivu_gap = energy_to_gap(energy, harmonic) - while not (6.2 < target_ivu_gap < 25.10): + while not (6.2 <= target_ivu_gap < 25.10): harmonic -= 2 if harmonic < 1: raise RuntimeError('can not find a valid gap') diff --git a/startup/30-user.py b/startup/30-user.py index f864622..4def7ec 100644 --- a/startup/30-user.py +++ b/startup/30-user.py @@ -327,7 +327,7 @@ def align_gisax( ): align_gisaxs_manual( rang = 0.1, point = 11 ) -def grating_rana(det, motor, name='Water_upRepeat', cycle=1, cycle_t=11, n_cycles=20): +def grating_rana_temp(det, motor, name='Water_upRepeat', cycle=1, cycle_t=11, n_cycles=20): # Slowest cycle: temperatures = [302, 305, 310] @@ -362,6 +362,7 @@ def grating_rana(det, motor, name='Water_upRepeat', cycle=1, cycle_t=11, n_cycle yield from bps.mv(prs, phi[i_s]) sample_id(user_name=name, sample_name=sample_name) yield from bps.mv(det.cam.acquire_time, cycle*cycle_t) + yield from bps.mv(pil1m_bs.x, pil1m_bs.x_center) yield from bps.mv(attn_shutter, 'Retract') yield from count([det], num=1) sample_id(user_name=name, sample_name=f'{sample_name}_sweep20') @@ -371,6 +372,45 @@ def grating_rana(det, motor, name='Water_upRepeat', cycle=1, cycle_t=11, n_cycle yield from fly_scan(det, motor, cycle, cycle_t, phi[i_s]) yield from bps.sleep(1) yield from bps.mv(attn_shutter, 'Insert') + +def grating_rana(det, motor, name='SNS2', cycle=1, cycle_t=10.0, n_cycles=10): + # Medium cycle: + samples = ['C14.3-0808-150-D45','C16.7-0808-150-D45','C20-0808-150-D45', 'C14.8-2430-170P'] + x = [20, 12, 3, -12] + y = [1.851, 1.875, 1.9, 1.88] + align_angle01 = [0.088, 0.155, -0.061, 0.084] + phi = [-0.405, 0.515, -1.505, -0.547] + chi = [-0.2,-0.2, -0.2, -0.2] + + # Fastest cycle: + angles = [0.2, 0.25, 0.35] + angle_offset = [0.1, 0.15, 0.25] + name_fmt = '{sample}_{angle}deg' + + for i_s, s in enumerate(samples): + for i_a, a in enumerate(angles): + sample_name = name_fmt.format(sample=s, angle=a) + print(f'\n\t=== Sample: {sample_name} ===\n') + yield from bps.mv(prs, phi[i_s]) + yield from bps.mv(sample.x, x[i_s]) + yield from bps.mv(stage.ch, chi[i_s]) + yield from bps.mv(stage.y, y[i_s]) + yield from bps.mv(sample.al, align_angle01[i_s] - angle_offset[i_a]) + sample_id(user_name=name, sample_name=sample_name) + yield from bps.mv(det.cam.acquire_time, 1) + yield from bps.mv(pil1m_bs.x, pil1m_bs.x_center) + yield from bps.mv(attn_shutter, 'Retract') + yield from count([det], num=1) + yield from bps.mv(det.cam.acquire_time, cycle*cycle_t) + sample_id(user_name=name, sample_name=f'{sample_name}_sweep20') + print(f'\n\t=== Sample: {sample_name}_sweep20 ===\n') + print('... doing fly_scan here ...') + for i in range(n_cycles): + yield from fly_scan(det, motor, cycle, cycle_t, phi[i_s]) + yield from bps.sleep(1) + yield from bps.mv(attn_shutter, 'Insert') + sample_id(user_name='test', sample_name='test') + det_exposure_time(0.5) def run_saxs_caps(t=1): x_list = [-15,-12.8,-6.45,-0.25, 6.43, 12.5, 19.05,25.2]# diff --git a/startup/82-sample.py b/startup/82-sample.py index c4015cd..c48b2ef 100644 --- a/startup/82-sample.py +++ b/startup/82-sample.py @@ -1,5 +1,5 @@ -BS_POSITION_X = 1.15 -BS_POSITION_Y = 13.1 +BS_POSITION_X = 1.25 +BS_POSITION_Y = 13.2 class PIL1MPositions(Device): x = Cpt(EpicsMotor, 'X}Mtr') @@ -24,7 +24,7 @@ def __init__(self, *args, **kwargs): pil1m_pos = PIL1MPositions('XF:12IDC-ES:2{Det:1M-Ax:', name='pil1m_pos') pil1m_bs = PIL1MBS('XF:12IDC-ES:2{BS:SAXS-Ax:', name='pil1m_bs') -pil1m_bs.x_center = 1.2 +pil1m_bs.x_center = 1.25 pil1m_bs.y_center = 13.1 # Plans: