def center_col(label, detid, run_label_filename="labels.txt"): """ Return the peak index of the label data summed along the zeroth axis (perpendicular to the energy-dispersive direction """ summed = np.sum(data.get_label_data(label, detid, fname=run_label_filename), axis=0) return np.argmax(summed)
def si_is_saturated(label, start=400, end=800): from dataccess import data_access as data imarr = data.get_label_data(label, 'si')[0] spectrum = np.sum(imarr, axis=0)[start:end] spectrum = spectrum - np.percentile(spectrum, 1) saturation_metric = np.sum(np.abs(np.diff( np.diff(spectrum)))) / np.sum(spectrum) return saturation_metric > 0.1
def center_col(label, detid, run_label_filename='labels.txt'): """ Return the peak index of the label data summed along the zeroth axis (perpendicular to the energy-dispersive direction """ summed = np.sum(data.get_label_data(label, detid, fname=run_label_filename), axis=0) return np.argmax(summed)
def lineout(label, detid, cencol, pxwidth=10, default_bg=None, run_label_filename="labels.txt"): """ Return a 1d lineout """ raw = data.get_label_data(label, detid, default_bg=default_bg, fname=run_label_filename) frame_dimension = len(raw) spectrum_intensities = np.array( [sum([raw[i][j] for j in range(cencol - pxwidth, cencol + pxwidth + 1)]) for i in range(frame_dimension)] ) return spectrum_intensities
def lineout(label, detid, cencol, pxwidth=10, default_bg=None, run_label_filename='labels.txt'): """ Return a 1d lineout """ raw = data.get_label_data(label, detid, default_bg=default_bg, fname=run_label_filename) frame_dimension = len(raw) spectrum_intensities = np.array([ sum([raw[i][j] for j in range(cencol - pxwidth, cencol + pxwidth + 1)]) for i in range(frame_dimension) ]) return spectrum_intensities
def si_spectrometer_dark(run=None, **kwargs): from dataccess import data_access bg_label = data_access.get_label_property(str(run), 'background') dark, _ = data_access.get_label_data(bg_label, 'si') return dark