added comments

This commit is contained in:
2022-10-31 23:14:42 +01:00
parent 3c435f6f9b
commit 8e778eaf56

View File

@@ -8,6 +8,7 @@ from sfdata import SFDataFiles, sfdatafile, SFScanInfo, SFProcFile
from xraydb import material_mu
from joblib import Parallel, delayed, cpu_count
from scipy.stats.stats import pearsonr
import matplotlib.pyplot as plt
def scan_info(run_number,base_path=None,small_data=True):
"""Returns SFScanInfo object for a given run number.
@@ -146,7 +147,7 @@ def find_offset(run_no_or_scan, ch1,ch2, offsets=range(-7,7),step=0,verbose = Fa
"""Attempts to find an ideal offset between pids of two channels. Offset is added to Channel_2. Channel_1 is used as reference.
Returns best offset, best_correlation, [all offsets, all correlations]."""
scan = scan_from_run_number_or_scan(run_no_or_scan)
run_number = int(str(scan.fs)[-19:-15])
run_number = int(str(scan.fs)[-19:-15]) # Find the run number from the path string
d = scan[step]
assert len(d[ch1].shape) ==1, "Channel 2 has more than 1 dimension, can't correlate"
assert len(d[ch2].shape) ==1, "Channel 2 has more than 1 dimension, can't correlate"