Save-Path-File-Changes #1
@ -644,7 +644,10 @@ def sweep_b_val(instr:pyvisa.resources.Resource, min_bval:float, max_bval:float,
|
|||||||
np.savetxt("Wavelength.txt", wl)
|
np.savetxt("Wavelength.txt", wl)
|
||||||
np.savetxt("B_Values.txt", bval_lst)
|
np.savetxt("B_Values.txt", bval_lst)
|
||||||
|
|
||||||
|
# NOTE: old function of generate_coor_list_fixed_angle
|
||||||
|
'''
|
||||||
def generate_coord_list_fixed_angle(angle, b_val, b_val_step_size, reverse=False):
|
def generate_coord_list_fixed_angle(angle, b_val, b_val_step_size, reverse=False):
|
||||||
|
# TODO: mod function to take different b_min and b_max along given angle. update docs
|
||||||
"""
|
"""
|
||||||
Generates a list of (x, y) Cartesian coordinates along a line defined by a fixed angle,
|
Generates a list of (x, y) Cartesian coordinates along a line defined by a fixed angle,
|
||||||
scanning from -b_val to b_val or from b_val to -b_val depending on the reverse flag.
|
scanning from -b_val to b_val or from b_val to -b_val depending on the reverse flag.
|
||||||
@ -682,6 +685,32 @@ def generate_coord_list_fixed_angle(angle, b_val, b_val_step_size, reverse=False
|
|||||||
current_b += b_val_step_size
|
current_b += b_val_step_size
|
||||||
|
|
||||||
return coordinates
|
return coordinates
|
||||||
|
'''
|
||||||
|
|
||||||
|
def generate_coord_list_fixed_angle(angle, b_min, b_max, b_val_step_size, reverse=False):
|
||||||
|
"""
|
||||||
|
Generates a list of (x, y) Cartesian coordinates along a line defined by a fixed angle,
|
||||||
|
scanning from b_min to b_max or from b_max to b_min depending on the reverse flag.
|
||||||
|
"""
|
||||||
|
coordinates = []
|
||||||
|
angle_rad = math.radians(angle)
|
||||||
|
|
||||||
|
if reverse:
|
||||||
|
current_b = b_max
|
||||||
|
while current_b >= b_min:
|
||||||
|
x = current_b * math.cos(angle_rad)
|
||||||
|
y = current_b * math.sin(angle_rad)
|
||||||
|
coordinates.append((x, y))
|
||||||
|
current_b -= b_val_step_size
|
||||||
|
else:
|
||||||
|
current_b = b_min
|
||||||
|
while current_b <= b_max:
|
||||||
|
x = current_b * math.cos(angle_rad)
|
||||||
|
y = current_b * math.sin(angle_rad)
|
||||||
|
coordinates.append((x, y))
|
||||||
|
current_b += b_val_step_size
|
||||||
|
|
||||||
|
return coordinates
|
||||||
|
|
||||||
def generate_angle_coord_list(radius, start_angle, end_angle, step_size, clockwise=True):
|
def generate_angle_coord_list(radius, start_angle, end_angle, step_size, clockwise=True):
|
||||||
# TODO: DOCS
|
# TODO: DOCS
|
||||||
@ -840,6 +869,7 @@ def b_field_rotation(instr1:pyvisa.resources.Resource, instr2:pyvisa.resources.R
|
|||||||
write_no_echo(instr1, f'RATE 0 {min_range_lst[0]};RATE 1 {min_range_lst[1]}')
|
write_no_echo(instr1, f'RATE 0 {min_range_lst[0]};RATE 1 {min_range_lst[1]}')
|
||||||
write_no_echo(instr2, f'RATE 0 {min_range_lst[0]};RATE 1 {min_range_lst[1]}')
|
write_no_echo(instr2, f'RATE 0 {min_range_lst[0]};RATE 1 {min_range_lst[1]}')
|
||||||
|
|
||||||
|
# TODO: see if this is the desired process: to always start from the x-axis ASK LUKAS
|
||||||
if Babs <= BX_MAX:
|
if Babs <= BX_MAX:
|
||||||
write_no_echo(instr1, f'CHAN 2;ULIM {Babs*10};SWEEP UP') # sets to B_x, the B_x upper limit and sweeps the magnet field to the upper limit
|
write_no_echo(instr1, f'CHAN 2;ULIM {Babs*10};SWEEP UP') # sets to B_x, the B_x upper limit and sweeps the magnet field to the upper limit
|
||||||
print(f'SWEEPING B-X TO {Babs} T NOW')
|
print(f'SWEEPING B-X TO {Babs} T NOW')
|
||||||
@ -975,8 +1005,9 @@ def b_field_rotation(instr1:pyvisa.resources.Resource, instr2:pyvisa.resources.R
|
|||||||
# TODO: implement b_sweep at an arbitrary angle in the Bx-By plane
|
# TODO: implement b_sweep at an arbitrary angle in the Bx-By plane
|
||||||
# copy the functionality of loading the powerboxsupplies from b_rotation and the other sweep functionalities of
|
# copy the functionality of loading the powerboxsupplies from b_rotation and the other sweep functionalities of
|
||||||
# b_sweep_val and implement it in this function
|
# b_sweep_val and implement it in this function
|
||||||
|
# CHECK: B_abs <= BX_MAX or BY_MAX
|
||||||
def sweep_b_angle(instr1:pyvisa.resources.Resource, instr2:pyvisa.resources.Resource,
|
def sweep_b_angle(instr1:pyvisa.resources.Resource, instr2:pyvisa.resources.Resource,
|
||||||
min_bval:float, max_bval:float, res:float,
|
min_bval:float, max_bval:float, res:float, angle:float,
|
||||||
Settings:str, clockwise=True, base_file_name='',
|
Settings:str, clockwise=True, base_file_name='',
|
||||||
reversescan_bool=False, zerowhenfin_bool=False, loopscan_bool=False):
|
reversescan_bool=False, zerowhenfin_bool=False, loopscan_bool=False):
|
||||||
|
|
||||||
@ -1020,8 +1051,9 @@ def sweep_b_angle(instr1:pyvisa.resources.Resource, instr2:pyvisa.resources.Reso
|
|||||||
instr1_sweep, instr2_sweep = 'DOWN', 'UP'
|
instr1_sweep, instr2_sweep = 'DOWN', 'UP'
|
||||||
|
|
||||||
# TODO: see later parts of b_field_rotation from line 820 onwards, and see if same logic can be applied here
|
# TODO: see later parts of b_field_rotation from line 820 onwards, and see if same logic can be applied here
|
||||||
|
# acquire coordinates along the fixed axis, threading, sweep both supplies till desired value (with lock)
|
||||||
|
# then set event, measure, on with the next iteration, just like in b-field-rotation
|
||||||
|
cartesian_coords = generate_coord_list_fixed_angle(angle, )
|
||||||
|
|
||||||
################################################################# END OF FUNCTION DEFS ###########################################################################################
|
################################################################# END OF FUNCTION DEFS ###########################################################################################
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user