43 lines
1.6 KiB
Python
43 lines
1.6 KiB
Python
"""Module for the p22760 beamtime experiment at Cristallina. For slic purposes only.
|
|
"""
|
|
|
|
import scipy
|
|
import numpy as np
|
|
|
|
|
|
|
|
def get_theta_prediction(B_field):
|
|
"""Get predicted theta angle from B field using linear interpolation.
|
|
|
|
Args:
|
|
B_field (float): Magnetic field value in Tesla.
|
|
|
|
Returns:
|
|
tuple: Predicted theta angles (left, right) in degrees.
|
|
"""
|
|
|
|
B = np.array([0. , 0. , 0.05 , 0.1 , 0.15 , 0.2 , 0.25 , 0.3 ,
|
|
0.35 , 0.4 , 0.5 , 0.525 , 0.53 , 0.55 , 0.555 , 0.56 ,
|
|
0.565 , 0.5675, 0.57 , 0.5725, 0.575 , 0.6 ])
|
|
|
|
left = np.array([-16.72402197, -16.72592595, -16.72266943, -16.71780642,
|
|
-16.70710748, -16.68879129, -16.67129814, -16.64430405,
|
|
-16.61258093, -16.57162955, -16.43958512, -16.36767873,
|
|
-16.35235521, -16.20000072, -16.14585335, -16.14986136,
|
|
-16.14953497, -16.15033841, -16.14907281, -16.14883662,
|
|
-16.14936827, -16.14544489])
|
|
|
|
right = np.array([-15.82641889, -15.82810495, -15.82810142, -15.83362565,
|
|
-15.84191596, -15.85030174, -15.86875095, -15.88716295,
|
|
-15.91257856, -15.94358668, -16.0436225 , -16.07455302,
|
|
-16.08374928, -16.13199655, -16.14585335, -16.14986136,
|
|
-16.14953497, -16.15033841, -16.14907281, -16.14883662,
|
|
-16.14936827, -16.14544489])
|
|
|
|
interpolation_right = scipy.interpolate.interp1d(B, right, kind='linear')
|
|
interpolation_left = scipy.interpolate.interp1d(B, left, kind='linear')
|
|
|
|
theta_right = interpolation_right(B_field)
|
|
theta_left = interpolation_left(B_field)
|
|
|
|
return theta_left, theta_right |