def _to_bpm_data(data, year): for plane in data: for bpm in data[plane]: for i in range(len(data[plane][bpm])): bpm_type = bpm.split(".")[0] coefficients = polynomial_correction.get_coefficients_of_bpm_type( bpm_type, polynomial_correction.old_coefficients[year] ) if coefficients: data[plane][bpm][i] = polynomial_correction.revert_correction_polynomial( data[plane][bpm][i], coefficients ) else: print('Warning: No coefficients for bpm type: "%s" found! Skipping...' % bpm_type) return data
def _revert_old_correction(data, year): """Reverts the old correction of the given year to end up with uncorrected data.""" for plane in data: for bpm in data[plane]: for i in range(len(data[plane][bpm])): bpm_type = bpm.split(".")[0] if bpm_type == "BPMS": continue # we will skip skewed BPMS type BPMs as they need special treatment and are only a few coefficients = polynomial_correction.get_coefficients_of_bpm_type( bpm_type, polynomial_correction.old_coefficients[year] ) if coefficients: # the normalization by kf = coefficients[0] is important data[plane][bpm][i] = ( polynomial_correction.revert_correction_polynomial(data[plane][bpm][i], coefficients) / coefficients[0] ) else: print('Warning: No coefficients for bpm type: "%s" found! Skipping...' % bpm_type) continue return data