def compute_photometry(catalog, photmode):
    """ Compute magnitudes for sources from catalog based on observations photmode.

    Parameters
    ----------
    catalog : `~astropy.table.Table`
        Astropy Table with 'source_sum' column for the measured flux for each source.

    photmode : str
        Specification of the observation filter configuration used for the exposure
        as reported by the 'PHOTMODE' keyword from the PRIMARY header.

    Returns
    -------
    phot_cat : `~astropy.table.Table`
        Astropy Table object of input source catalog with added column for
        VEGAMAG photometry (in magnitudes).
    """
    # Determine VEGAMAG zero-point using pysynphot for this photmode
    photmode = photmode.replace(' ', ', ')
    vega = S.FileSpectrum(VEGASPEC)
    bp = S.ObsBandpass(photmode)
    vegauvis = S.Observation(vega, bp)
    vegazpt = 2.5 * np.log10(vegauvis.countrate())

    # Use zero-point to convert flux values from catalog into magnitudes
    # source_phot = vegazpt - 2.5*np.log10(catalog['source_sum'])
    source_phot = vegazpt - 2.5 * np.log10(catalog['flux'])
    source_phot.name = 'vegamag'
    # Now add this new column to the catalog table
    catalog.add_column(source_phot)

    return catalog