added code for p22760 experiment
This commit is contained in:
69
src/cristallina/p22760/__init__.py
Normal file
69
src/cristallina/p22760/__init__.py
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import os
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
from collections import defaultdict, deque
|
||||||
|
from copy import copy
|
||||||
|
import time
|
||||||
|
|
||||||
|
import scipy
|
||||||
|
import numpy as np
|
||||||
|
import pandas as pd
|
||||||
|
from tqdm.notebook import tqdm
|
||||||
|
import re
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
from matplotlib import pyplot as plt
|
||||||
|
import matplotlib as mpl
|
||||||
|
|
||||||
|
import cristallina.utils as cu
|
||||||
|
import cristallina as cr
|
||||||
|
|
||||||
|
from loguru import logger
|
||||||
|
|
||||||
|
from cristallina.uscan import UnfinishedScan
|
||||||
|
|
||||||
|
from joblib import Parallel, delayed, Memory
|
||||||
|
import sfdata
|
||||||
|
from sfdata import SFProcFile, SFDataFile, SFDataFiles, SFScanInfo
|
||||||
|
|
||||||
|
memory = Memory(location="/sf/cristallina/data/p22760/work/joblib", compress=2, verbose=2)
|
||||||
|
pgroup = "p22760"
|
||||||
|
|
||||||
|
print(f"p22760 module imported.")
|
||||||
|
|
||||||
|
|
||||||
|
def get_theta_prediction(B_field):
|
||||||
|
"""Get predicted theta angle from B field using linear interpolation.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
B_field (float): Magnetic field value.
|
||||||
|
"""
|
||||||
|
|
||||||
|
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
|
||||||
Reference in New Issue
Block a user