Save-Path-File-Changes #1
@ -898,14 +898,14 @@ def b_field_rotation(instr1:pyvisa.resources.Resource, instr2:pyvisa.resources.R
|
|||||||
if value <= target_value[device_id]:
|
if value <= target_value[device_id]:
|
||||||
write_no_echo(instr1, f"CHAN 2;ULIM {target_value[device_id]*10};SWEEP UP")
|
write_no_echo(instr1, f"CHAN 2;ULIM {target_value[device_id]*10};SWEEP UP")
|
||||||
else:
|
else:
|
||||||
write_no_echo(instr1, "CHAN 2;LLIM {target_value[device_id]*10};SWEEP DOWN")
|
write_no_echo(instr1, f"CHAN 2;LLIM {target_value[device_id]*10};SWEEP DOWN")
|
||||||
|
|
||||||
elif '2101014' in device_id:
|
elif '2101014' in device_id:
|
||||||
value = sep_num_from_units(query_no_echo(instr2, 'IMAG?'))[0]*0.1 # convert kG to T
|
value = sep_num_from_units(query_no_echo(instr2, 'IMAG?'))[0]*0.1 # convert kG to T
|
||||||
if value <= target_value[device_id]:
|
if value <= target_value[device_id]:
|
||||||
write_no_echo(instr2, f"ULIM {target_value[device_id]*10};SWEEP UP")
|
write_no_echo(instr2, f"ULIM {target_value[device_id]*10};SWEEP UP")
|
||||||
else:
|
else:
|
||||||
write_no_echo(instr2, "LLIM {target_value[device_id]*10};SWEEP DOWN")
|
write_no_echo(instr2, f"LLIM {target_value[device_id]*10};SWEEP DOWN")
|
||||||
else:
|
else:
|
||||||
continue # Skip if device ID is not recognized
|
continue # Skip if device ID is not recognized
|
||||||
print(f"Device {device_id} reports value: {value} T")
|
print(f"Device {device_id} reports value: {value} T")
|
||||||
@ -1085,7 +1085,8 @@ def sweep_b_angle(instr1:pyvisa.resources.Resource, instr2:pyvisa.resources.Reso
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
# TODO: mod copied code (from b_field_rotation) forsweep_b_angle
|
# TODO: mod copied code (from b_field_rotation) forsweep_b_angle
|
||||||
# NEED TO MOD THE LOGIC OF LISTEN-TO-DEVICE TO SWEEP FROM LOWER TO HIGHER ANGLES, SEE SWEEP_B_VAL FUNCTION
|
# NEED TO MOD THE LOGIC OF listen_to_device FUNCTION LOGIC
|
||||||
|
# TO SWEEP FROM LOWER TO HIGHER ANGLES, SEE SWEEP_B_VAL FUNCTION
|
||||||
|
|
||||||
# NOTE: implement PID control, possibly best option to manage the b field DO THIS LATER ON, WE DO DISCRETE B VALUES RN
|
# NOTE: implement PID control, possibly best option to manage the b field DO THIS LATER ON, WE DO DISCRETE B VALUES RN
|
||||||
# Helper function that listens to a device
|
# Helper function that listens to a device
|
||||||
@ -1094,17 +1095,25 @@ def sweep_b_angle(instr1:pyvisa.resources.Resource, instr2:pyvisa.resources.Reso
|
|||||||
# value = 0 # Simulate receiving a float from the device INSERT QUERY NO ECHO HERE TO ASK FOR DEVICE IMAG
|
# value = 0 # Simulate receiving a float from the device INSERT QUERY NO ECHO HERE TO ASK FOR DEVICE IMAG
|
||||||
if '2301034' in device_id:
|
if '2301034' in device_id:
|
||||||
value = sep_num_from_units(query_no_echo(instr1, 'IMAG?'))[0]*0.1 # convert kG to T
|
value = sep_num_from_units(query_no_echo(instr1, 'IMAG?'))[0]*0.1 # convert kG to T
|
||||||
if value <= target_value[device_id]:
|
# New code:
|
||||||
write_no_echo(instr1, f"CHAN 2;ULIM {target_value[device_id]*10};SWEEP UP")
|
sweep_limit = "ULIM" if not reversescan_bool else "LLIM"
|
||||||
else:
|
write_no_echo(instr1, f"CHAN 2;{sweep_limit} {target_value[device_id]*10};SWEEP {'UP' if sweep_limit == 'ULIM' else 'DOWN'}")
|
||||||
write_no_echo(instr1, "CHAN 2;LLIM {target_value[device_id]*10};SWEEP DOWN")
|
# Old code
|
||||||
|
# if value <= target_value[device_id]:
|
||||||
|
# write_no_echo(instr1, f"CHAN 2;ULIM {target_value[device_id]*10};SWEEP UP")
|
||||||
|
# else:
|
||||||
|
# write_no_echo(instr1, f"CHAN 2;LLIM {target_value[device_id]*10};SWEEP DOWN")
|
||||||
|
|
||||||
elif '2101014' in device_id:
|
elif '2101014' in device_id:
|
||||||
value = sep_num_from_units(query_no_echo(instr2, 'IMAG?'))[0]*0.1 # convert kG to T
|
value = sep_num_from_units(query_no_echo(instr2, 'IMAG?'))[0]*0.1 # convert kG to T
|
||||||
if value <= target_value[device_id]:
|
# New code
|
||||||
write_no_echo(instr2, f"ULIM {target_value[device_id]*10};SWEEP UP")
|
sweep_limit = "ULIM" if not reversescan_bool else "LLIM"
|
||||||
else:
|
write_no_echo(instr1, f"{sweep_limit} {target_value[device_id]*10};SWEEP {'UP' if sweep_limit == 'ULIM' else 'DOWN'}")
|
||||||
write_no_echo(instr2, "LLIM {target_value[device_id]*10};SWEEP DOWN")
|
# Old code
|
||||||
|
# if value <= target_value[device_id]:
|
||||||
|
# write_no_echo(instr2, f"ULIM {target_value[device_id]*10};SWEEP UP")
|
||||||
|
# else:
|
||||||
|
# write_no_echo(instr2, f"LLIM {target_value[device_id]*10};SWEEP DOWN")
|
||||||
else:
|
else:
|
||||||
continue # Skip if device ID is not recognized
|
continue # Skip if device ID is not recognized
|
||||||
print(f"Device {device_id} reports value: {value} T")
|
print(f"Device {device_id} reports value: {value} T")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user