Calculates ratios for PSM tables containing isobaric channels with
    raw intensities. Normalizes the ratios by median. NA values or values
    below min_intensity are excluded from the normalization.

def calculate_normalized_ratios(ratios, ch_medians, channels):
    """Calculates ratios for PSM tables containing isobaric channels with
    raw intensities. Normalizes the ratios by median. NA values or values
    below min_intensity are excluded from the normalization."""
    outratios = []
    for quant in ratios:
        quant.update({ch: str(quant[ch] / ch_medians[ch])
                      if quant[ch] != 'NA' else 'NA' for ch in channels})
        outratios.append(quant)
    return outratios