def basic_forced_photometry(rerun, psf=True, cmodel=True, aper=False, shape
    =False, flux=False, aper_type='3_20'):
    """
    Return a dict of column names for basic photometric measurements.
    """
    basic_dict = {'object_id': 'forced.object_id', 'ra': 'forced.ra', 'dec':
        'forced.dec', 'tract': 'forced.tract', 'patch': 'forced.patch',
        'a_g': 'forced.a_g', 'a_r': 'forced.a_r', 'a_i': 'forced.a_i',
        'a_z': 'forced.a_z', 'a_y': 'forced.a_y'}
    if 'pdr2' in rerun or 's18a' in rerun:
        meta_dict = {'merge_peak_sky': 'forced.merge_peak_sky',
            'g_inputcount': 'forced.g_inputcount_value', 'r_inputcount':
            'forced.r_inputcount_value', 'i_inputcount':
            'forced.i_inputcount_value', 'z_inputcount':
            'forced.z_inputcount_value', 'y_inputcount':
            'forced.y_inputcount_value', 'g_flag_edge':
            'forced.g_pixelflags_edge', 'r_flag_edge':
            'forced.r_pixelflags_edge', 'i_flag_edge':
            'forced.i_pixelflags_edge', 'z_flag_edge':
            'forced.z_pixelflags_edge', 'y_flag_edge':
            'forced.y_pixelflags_edge', 'g_flag_saturated':
            'forced.g_pixelflags_saturated', 'r_flag_saturated':
            'forced.r_pixelflags_saturated', 'i_flag_saturated':
            'forced.i_pixelflags_saturated', 'z_flag_saturated':
            'forced.z_pixelflags_saturated', 'y_flag_saturated':
            'forced.y_pixelflags_saturated', 'g_flag_interpolated':
            'forced.g_pixelflags_interpolated', 'r_flag_interpolated':
            'forced.r_pixelflags_interpolated', 'i_flag_interpolated':
            'forced.i_pixelflags_interpolated', 'z_flag_interpolated':
            'forced.z_pixelflags_interpolated', 'y_flag_interpolated':
            'forced.y_pixelflags_interpolated', 'g_flag_saturated_cen':
            'forced.g_pixelflags_saturatedcenter', 'r_flag_saturated_cen':
            'forced.r_pixelflags_saturatedcenter', 'i_flag_saturated_cen':
            'forced.i_pixelflags_saturatedcenter', 'z_flag_saturated_cen':
            'forced.z_pixelflags_saturatedcenter', 'y_flag_saturated_cen':
            'forced.y_pixelflags_saturatedcenter',
            'g_flag_interpolated_cen':
            'forced.g_pixelflags_interpolatedcenter',
            'r_flag_interpolated_cen':
            'forced.r_pixelflags_interpolatedcenter',
            'i_flag_interpolated_cen':
            'forced.i_pixelflags_interpolatedcenter',
            'z_flag_interpolated_cen':
            'forced.z_pixelflags_interpolatedcenter',
            'y_flag_interpolated_cen':
            'forced.y_pixelflags_interpolatedcenter', 'g_extendedness':
            'forced.g_extendedness_value', 'r_extendedness':
            'forced.r_extendedness_value', 'i_extendedness':
            'forced.i_extendedness_value', 'z_extendedness':
            'forced.z_extendedness_value', 'y_extendedness':
            'forced.y_extendedness_value'}
        if cmodel:
            cmodel_flag = {'g_cmodel_flag': 'forced.g_cmodel_flag',
                'r_cmodel_flag': 'forced.r_cmodel_flag', 'i_cmodel_flag':
                'forced.i_cmodel_flag', 'z_cmodel_flag':
                'forced.z_cmodel_flag', 'y_cmodel_flag': 'forced.y_cmodel_flag'
                }
            if flux:
                cmodel_dict = {'g_cmodel_flux': 'forced.g_cmodel_flux',
                    'r_cmodel_flux': 'forced.r_cmodel_flux',
                    'i_cmodel_flux': 'forced.i_cmodel_flux',
                    'z_cmodel_flux': 'forced.z_cmodel_flux',
                    'y_cmodel_flux': 'forced.y_cmodel_flux',
                    'g_cmodel_flux_err': 'forced.g_cmodel_fluxsigma',
                    'r_cmodel_flux_err': 'forced.r_cmodel_fluxsigma',
                    'i_cmodel_flux_err': 'forced.i_cmodel_fluxsigma',
                    'z_cmodel_flux_err': 'forced.z_cmodel_fluxsigma',
                    'y_cmodel_flux_err': 'forced.y_cmodel_fluxsigma'}
            else:
                cmodel_dict = {'g_cmodel_mag': 'forced.g_cmodel_mag',
                    'r_cmodel_mag': 'forced.r_cmodel_mag', 'i_cmodel_mag':
                    'forced.i_cmodel_mag', 'z_cmodel_mag':
                    'forced.z_cmodel_mag', 'y_cmodel_mag':
                    'forced.y_cmodel_mag', 'g_cmodel_mag_err':
                    'forced.g_cmodel_magsigma', 'r_cmodel_mag_err':
                    'forced.r_cmodel_magsigma', 'i_cmodel_mag_err':
                    'forced.i_cmodel_magsigma', 'z_cmodel_mag_err':
                    'forced.z_cmodel_magsigma', 'y_cmodel_mag_err':
                    'forced.y_cmodel_magsigma'}
            cmodel_dict.update(cmodel_flag)
        else:
            cmodel_dict = {}
        if psf:
            psf_flag = {'g_psf_flag': 'forced2.g_psfflux_flag',
                'r_psf_flag': 'forced2.r_psfflux_flag', 'i_psf_flag':
                'forced2.i_psfflux_flag', 'z_psf_flag':
                'forced2.z_psfflux_flag', 'y_psf_flag':
                'forced2.y_psfflux_flag'}
            if flux:
                psf_dict = {'g_psf_flux': 'forced2.g_psfflux_flux',
                    'r_psf_flux': 'forced2.r_psfflux_flux', 'i_psf_flux':
                    'forced2.i_psfflux_flux', 'z_psf_flux':
                    'forced2.z_psfflux_flux', 'y_psf_flux':
                    'forced2.y_psfflux_flux', 'g_psf_flux_err':
                    'forced2.g_psfflux_fluxsigma', 'r_psf_flux_err':
                    'forced2.r_psfflux_fluxsigma', 'i_psf_flux_err':
                    'forced2.i_psfflux_fluxsigma', 'z_psf_flux_err':
                    'forced2.z_psfflux_fluxsigma', 'y_psf_flux_err':
                    'forced2.y_psfflux_fluxsigma'}
            else:
                psf_dict = {'g_psf_mag': 'forced2.g_psfflux_mag',
                    'r_psf_mag': 'forced2.r_psfflux_mag', 'i_psf_mag':
                    'forced2.i_psfflux_mag', 'z_psf_mag':
                    'forced2.z_psfflux_mag', 'y_psf_mag':
                    'forced2.y_psfflux_mag', 'g_psf_mag_err':
                    'forced2.g_psfflux_magsigma', 'r_psf_mag_err':
                    'forced2.r_psfflux_magsigma', 'i_psf_mag_err':
                    'forced2.i_psfflux_magsigma', 'z_psf_mag_err':
                    'forced2.z_psfflux_magsigma', 'y_psf_mag_err':
                    'forced2.y_psfflux_magsigma'}
            psf_dict.update(psf_flag)
        else:
            psf_dict = {}
        if aper:
            aper_flag = {'g_aper_flag': 'forced4.g_convolvedflux_{}_flag'.
                format(aper_type), 'r_aper_flag':
                'forced4.r_convolvedflux_{}_flag'.format(aper_type),
                'i_aper_flag': 'forced4.i_convolvedflux_{}_flag'.format(
                aper_type), 'z_aper_flag':
                'forced4.z_convolvedflux_{}_flag'.format(aper_type),
                'y_aper_flag': 'forced4.y_convolvedflux_{}_flag'.format(
                aper_type)}
            if flux:
                aper_dict = {'g_aper_flux':
                    'forced4.g_convolvedflux_{}_flux'.format(aper_type),
                    'r_aper_flux': 'forced4.r_convolvedflux_{}_flux'.format
                    (aper_type), 'i_aper_flux':
                    'forced4.i_convolvedflux_{}_flux'.format(aper_type),
                    'z_aper_flux': 'forced4.z_convolvedflux_{}_flux'.format
                    (aper_type), 'y_aper_flux':
                    'forced4.y_convolvedflux_{}_flux'.format(aper_type),
                    'g_aper_flux_err':
                    'forced4.g_convolvedflux_{}_fluxsigma'.format(aper_type
                    ), 'r_aper_flux_err':
                    'forced4.r_convolvedflux_{}_fluxsigma'.format(aper_type
                    ), 'i_aper_flux_err':
                    'forced4.i_convolvedflux_{}_fluxsigma'.format(aper_type
                    ), 'z_aper_flux_err':
                    'forced4.z_convolvedflux_{}_fluxsigma'.format(aper_type
                    ), 'y_aper_flux_err':
                    'forced4.y_convolvedflux_{}_fluxsigma'.format(aper_type)}
            else:
                aper_dict = {'g_aper_mag': 'forced4.g_convolvedflux_{}_mag'
                    .format(aper_type), 'r_aper_mag':
                    'forced4.r_convolvedflux_{}_mag'.format(aper_type),
                    'i_aper_mag': 'forced4.i_convolvedflux_{}_mag'.format(
                    aper_type), 'z_aper_mag':
                    'forced4.z_convolvedflux_{}_mag'.format(aper_type),
                    'y_aper_mag': 'forced4.y_convolvedflux_{}_mag'.format(
                    aper_type), 'g_aper_mag_err':
                    'forced4.g_convolvedflux_{}_magsigma'.format(aper_type),
                    'r_aper_mag_err': 'forced4.r_convolvedflux_{}_magsigma'
                    .format(aper_type), 'i_aper_mag_err':
                    'forced4.i_convolvedflux_{}_magsigma'.format(aper_type),
                    'z_aper_mag_err': 'forced4.z_convolvedflux_{}_magsigma'
                    .format(aper_type), 'y_aper_mag_err':
                    'forced4.y_convolvedflux_{}_magsigma'.format(aper_type)}
            aper_dict.update(aper_flag)
        else:
            aper_dict = {}
        if shape:
            shape_dict = {'g_sdssshape_11': 'forced2.g_sdssshape_shape11',
                'g_sdssshape_22': 'forced2.g_sdssshape_shape22',
                'g_sdssshape_12': 'forced2.g_sdssshape_shape12',
                'r_sdssshape_11': 'forced2.r_sdssshape_shape11',
                'r_sdssshape_22': 'forced2.r_sdssshape_shape22',
                'r_sdssshape_12': 'forced2.r_sdssshape_shape12',
                'i_sdssshape_11': 'forced2.i_sdssshape_shape11',
                'i_sdssshape_22': 'forced2.i_sdssshape_shape22',
                'i_sdssshape_12': 'forced2.i_sdssshape_shape12',
                'z_sdssshape_11': 'forced2.z_sdssshape_shape11',
                'z_sdssshape_22': 'forced2.z_sdssshape_shape22',
                'z_sdssshape_12': 'forced2.z_sdssshape_shape12',
                'y_sdssshape_11': 'forced2.y_sdssshape_shape11',
                'y_sdssshape_22': 'forced2.y_sdssshape_shape22',
                'y_sdssshape_12': 'forced2.y_sdssshape_shape12'}
        else:
            shape_dict = {}
    elif 's17a' in rerun:
        meta_dict = {'merge_peak_sky': 'forced.merge_peak_sky',
            'g_inputcount': 'forced.g_inputcount_value', 'r_inputcount':
            'forced.r_inputcount_value', 'i_inputcount':
            'forced.i_inputcount_value', 'z_inputcount':
            'forced.z_inputcount_value', 'y_inputcount':
            'forced.y_inputcount_value', 'g_flag_edge':
            'forced.g_pixelflags_edge', 'r_flag_edge':
            'forced.r_pixelflags_edge', 'i_flag_edge':
            'forced.i_pixelflags_edge', 'z_flag_edge':
            'forced.z_pixelflags_edge', 'y_flag_edge':
            'forced.y_pixelflags_edge', 'g_flag_saturated':
            'forced.g_pixelflags_saturated', 'r_flag_saturated':
            'forced.r_pixelflags_saturated', 'i_flag_saturated':
            'forced.i_pixelflags_saturated', 'z_flag_saturated':
            'forced.z_pixelflags_saturated', 'y_flag_saturated':
            'forced.y_pixelflags_saturated', 'g_flag_interpolated':
            'forced.g_pixelflags_interpolated', 'r_flag_interpolated':
            'forced.r_pixelflags_interpolated', 'i_flag_interpolated':
            'forced.i_pixelflags_interpolated', 'z_flag_interpolated':
            'forced.z_pixelflags_interpolated', 'y_flag_interpolated':
            'forced.y_pixelflags_interpolated', 'g_flag_saturated_cen':
            'forced.g_pixelflags_saturatedcenter', 'r_flag_saturated_cen':
            'forced.r_pixelflags_saturatedcenter', 'i_flag_saturated_cen':
            'forced.i_pixelflags_saturatedcenter', 'z_flag_saturated_cen':
            'forced.z_pixelflags_saturatedcenter', 'y_flag_saturated_cen':
            'forced.y_pixelflags_saturatedcenter',
            'g_flag_interpolated_cen':
            'forced.g_pixelflags_interpolatedcenter',
            'r_flag_interpolated_cen':
            'forced.r_pixelflags_interpolatedcenter',
            'i_flag_interpolated_cen':
            'forced.i_pixelflags_interpolatedcenter',
            'z_flag_interpolated_cen':
            'forced.z_pixelflags_interpolatedcenter',
            'y_flag_interpolated_cen':
            'forced.y_pixelflags_interpolatedcenter', 'g_extendedness':
            'forced.g_extendedness_value', 'r_extendedness':
            'forced.r_extendedness_value', 'i_extendedness':
            'forced.i_extendedness_value', 'z_extendedness':
            'forced.z_extendedness_value', 'y_extendedness':
            'forced.y_extendedness_value'}
        if cmodel:
            cmodel_flag = {'g_cmodel_flag': 'forced.g_cmodel_flag',
                'r_cmodel_flag': 'forced.r_cmodel_flag', 'i_cmodel_flag':
                'forced.i_cmodel_flag', 'z_cmodel_flag':
                'forced.z_cmodel_flag', 'y_cmodel_flag': 'forced.y_cmodel_flag'
                }
            if flux:
                cmodel_dict = {'g_cmodel_flux': 'forced.g_cmodel_flux',
                    'r_cmodel_flux': 'forced.r_cmodel_flux',
                    'i_cmodel_flux': 'forced.i_cmodel_flux',
                    'z_cmodel_flux': 'forced.z_cmodel_flux',
                    'y_cmodel_flux': 'forced.y_cmodel_flux',
                    'g_cmodel_flux_err': 'forced.g_cmodel_fluxsigma',
                    'r_cmodel_flux_err': 'forced.r_cmodel_fluxsigma',
                    'i_cmodel_flux_err': 'forced.i_cmodel_fluxsigma',
                    'z_cmodel_flux_err': 'forced.z_cmodel_fluxsigma',
                    'y_cmodel_flux_err': 'forced.y_cmodel_fluxsigma'}
            else:
                cmodel_dict = {'g_cmodel_mag': 'forced.g_cmodel_mag',
                    'r_cmodel_mag': 'forced.r_cmodel_mag', 'i_cmodel_mag':
                    'forced.i_cmodel_mag', 'z_cmodel_mag':
                    'forced.z_cmodel_mag', 'y_cmodel_mag':
                    'forced.y_cmodel_mag', 'g_cmodel_mag_err':
                    'forced.g_cmodel_magsigma', 'r_cmodel_mag_err':
                    'forced.r_cmodel_magsigma', 'i_cmodel_mag_err':
                    'forced.i_cmodel_magsigma', 'z_cmodel_mag_err':
                    'forced.z_cmodel_magsigma', 'y_cmodel_mag_err':
                    'forced.y_cmodel_magsigma'}
            cmodel_dict.update(cmodel_flag)
        else:
            cmodel_dict = {}
        if psf:
            psf_flag = {'g_psf_flag': 'forced.g_psfflux_flag', 'r_psf_flag':
                'forced.r_psfflux_flag', 'i_psf_flag':
                'forced.i_psfflux_flag', 'z_psf_flag':
                'forced.z_psfflux_flag', 'y_psf_flag': 'forced.y_psfflux_flag'}
            if flux:
                psf_dict = {'g_psf_flux': 'forced.g_psfflux_flux',
                    'r_psf_flux': 'forced.r_psfflux_flux', 'i_psf_flux':
                    'forced.i_psfflux_flux', 'z_psf_flux':
                    'forced.z_psfflux_flux', 'y_psf_flux':
                    'forced.y_psfflux_flux', 'g_psf_flux_err':
                    'forced.g_psfflux_fluxsigma', 'r_psf_flux_err':
                    'forced.r_psfflux_fluxsigma', 'i_psf_flux_err':
                    'forced.i_psfflux_fluxsigma', 'z_psf_flux_err':
                    'forced.z_psfflux_fluxsigma', 'y_psf_flux_err':
                    'forced.y_psfflux_fluxsigma'}
            else:
                psf_dict = {'g_psf_mag': 'forced.g_psfflux_mag',
                    'r_psf_mag': 'forced.r_psfflux_mag', 'i_psf_mag':
                    'forced.i_psfflux_mag', 'z_psf_mag':
                    'forced.z_psfflux_mag', 'y_psf_mag':
                    'forced.y_psfflux_mag', 'g_psf_mag_err':
                    'forced.g_psfflux_magsigma', 'r_psf_mag_err':
                    'forced.r_psfflux_magsigma', 'i_psf_mag_err':
                    'forced.i_psfflux_magsigma', 'z_psf_mag_err':
                    'forced.z_psfflux_magsigma', 'y_psf_mag_err':
                    'forced.y_psfflux_magsigma'}
            psf_dict.update(psf_flag)
        else:
            psf_dict = {}
        if aper:
            aper_flag = {'g_aper_flag': 'forced3.g_convolvedflux_{}_flag'.
                format(aper_type), 'r_aper_flag':
                'forced3.r_convolvedflux_{}_flag'.format(aper_type),
                'i_aper_flag': 'forced3.i_convolvedflux_{}_flag'.format(
                aper_type), 'z_aper_flag':
                'forced3.z_convolvedflux_{}_flag'.format(aper_type),
                'y_aper_flag': 'forced3.y_convolvedflux_{}_flag'.format(
                aper_type)}
            if flux:
                aper_dict = {'g_aper_flux':
                    'forced3.g_convolvedflux_{}_flux'.format(aper_type),
                    'r_aper_flux': 'forced3.r_convolvedflux_{}_flux'.format
                    (aper_type), 'i_aper_flux':
                    'forced3.i_convolvedflux_{}_flux'.format(aper_type),
                    'z_aper_flux': 'forced3.z_convolvedflux_{}_flux'.format
                    (aper_type), 'y_aper_flux':
                    'forced3.y_convolvedflux_{}_flux'.format(aper_type),
                    'g_aper_flux_err':
                    'forced3.g_convolvedflux_{}_fluxsigma'.format(aper_type
                    ), 'r_aper_flux_err':
                    'forced3.r_convolvedflux_{}_fluxsigma'.format(aper_type
                    ), 'i_aper_flux_err':
                    'forced3.i_convolvedflux_{}_fluxsigma'.format(aper_type
                    ), 'z_aper_flux_err':
                    'forced3.z_convolvedflux_{}_fluxsigma'.format(aper_type
                    ), 'y_aper_flux_err':
                    'forced3.y_convolvedflux_{}_fluxsigma'.format(aper_type)}
            else:
                aper_dict = {'g_aper_mag': 'forced3.g_convolvedflux_{}_mag'
                    .format(aper_type), 'r_aper_mag':
                    'forced3.r_convolvedflux_{}_mag'.format(aper_type),
                    'i_aper_mag': 'forced3.i_convolvedflux_{}_mag'.format(
                    aper_type), 'z_aper_mag':
                    'forced3.z_convolvedflux_{}_mag'.format(aper_type),
                    'y_aper_mag': 'forced3.y_convolvedflux_{}_mag'.format(
                    aper_type), 'g_aper_mag_err':
                    'forced3.g_convolvedflux_{}_magsigma'.format(aper_type),
                    'r_aper_mag_err': 'forced3.r_convolvedflux_{}_magsigma'
                    .format(aper_type), 'i_aper_mag_err':
                    'forced3.i_convolvedflux_{}_magsigma'.format(aper_type),
                    'z_aper_mag_err': 'forced3.z_convolvedflux_{}_magsigma'
                    .format(aper_type), 'y_aper_mag_err':
                    'forced3.y_convolvedflux_{}_magsigma'.format(aper_type)}
            aper_dict.update(aper_flag)
        else:
            aper_dict = {}
        if shape:
            print(
                '# SDSS Shape is not available for forced photometry in S17A release.'
                )
        shape_dict = {}
    elif 'pdr1' in rerun or 's16a' in rerun:
        meta_dict = {'merge_peak_sky': 'forced.merge_peak_sky',
            'g_inputcount': 'forced.gcountinputs', 'r_inputcount':
            'forced.rcountinputs', 'i_inputcount': 'forced.icountinputs',
            'z_inputcount': 'forced.zcountinputs', 'y_inputcount':
            'forced.ycountinputs', 'g_flag_edge':
            'forced.gflags_pixel_edge', 'r_flag_edge':
            'forced.rflags_pixel_edge', 'i_flag_edge':
            'forced.iflags_pixel_edge', 'z_flag_edge':
            'forced.zflags_pixel_edge', 'y_flag_edge':
            'forced.yflags_pixel_edge', 'g_flag_saturated':
            'forced.gflags_pixel_saturated_any', 'r_flag_saturated':
            'forced.rflags_pixel_saturated_any', 'i_flag_saturated':
            'forced.iflags_pixel_saturated_any', 'z_flag_saturated':
            'forced.zflags_pixel_saturated_any', 'y_flag_saturated':
            'forced.yflags_pixel_saturated_any', 'g_flag_interpolated':
            'forced.gflags_pixel_interpolated_any', 'r_flag_interpolated':
            'forced.rflags_pixel_interpolated_any', 'i_flag_interpolated':
            'forced.iflags_pixel_interpolated_any', 'z_flag_interpolated':
            'forced.zflags_pixel_interpolated_any', 'y_flag_interpolated':
            'forced.yflags_pixel_interpolated_any', 'g_flag_saturated_cen':
            'forced.gflags_pixel_saturated_center', 'r_flag_saturated_cen':
            'forced.rflags_pixel_saturated_center', 'i_flag_saturated_cen':
            'forced.iflags_pixel_saturated_center', 'z_flag_saturated_cen':
            'forced.zflags_pixel_saturated_center', 'y_flag_saturated_cen':
            'forced.yflags_pixel_saturated_center',
            'g_flag_interpolated_cen':
            'forced.gflags_pixel_interpolated_center',
            'r_flag_interpolated_cen':
            'forced.rflags_pixel_interpolated_center',
            'i_flag_interpolated_cen':
            'forced.iflags_pixel_interpolated_center',
            'z_flag_interpolated_cen':
            'forced.zflags_pixel_interpolated_center',
            'y_flag_interpolated_cen':
            'forced.yflags_pixel_interpolated_center', 'g_extendedness':
            'forced.gclassification_extendedness', 'r_extendedness':
            'forced.rclassification_extendedness', 'i_extendedness':
            'forced.iclassification_extendedness', 'z_extendedness':
            'forced.zclassification_extendedness', 'y_extendedness':
            'forced.yclassification_extendedness'}
        if cmodel:
            cmodel_flag = {'g_cmodel_flag': 'forced.gcmodel_flux_flags',
                'r_cmodel_flag': 'forced.rcmodel_flux_flags',
                'i_cmodel_flag': 'forced.icmodel_flux_flags',
                'z_cmodel_flag': 'forced.zcmodel_flux_flags',
                'y_cmodel_flag': 'forced.ycmodel_flux_flags'}
            if flux:
                cmodel_dict = {'g_cmodel_flux': 'forced.gcmodel_flux',
                    'r_cmodel_flux': 'forced.rcmodel_flux', 'i_cmodel_flux':
                    'forced.icmodel_flux', 'z_cmodel_flux':
                    'forced.zcmodel_flux', 'y_cmodel_flux':
                    'forced.ycmodel_flux', 'g_cmodel_flux_err':
                    'forced.gcmodel_flux_err', 'r_cmodel_flux_err':
                    'forced.rcmodel_flux_err', 'i_cmodel_flux_err':
                    'forced.icmodel_flux_err', 'z_cmodel_flux_err':
                    'forced.zcmodel_flux_err', 'y_cmodel_flux_err':
                    'forced.ycmodel_flux_err'}
            else:
                cmodel_dict = {'g_cmodel_mag': 'forced.gcmodel_mag',
                    'r_cmodel_mag': 'forced.rcmodel_mag', 'i_cmodel_mag':
                    'forced.icmodel_mag', 'z_cmodel_mag':
                    'forced.zcmodel_mag', 'y_cmodel_mag':
                    'forced.ycmodel_mag', 'g_cmodel_mag_err':
                    'forced.gcmodel_mag_err', 'r_cmodel_mag_err':
                    'forced.rcmodel_mag_err', 'i_cmodel_mag_err':
                    'forced.icmodel_mag_err', 'z_cmodel_mag_err':
                    'forced.zcmodel_mag_err', 'y_cmodel_mag_err':
                    'forced.ycmodel_mag_err'}
            cmodel_dict.update(cmodel_flag)
        else:
            cmodel_dict = {}
        if psf:
            psf_flag = {'g_psf_flag': 'forced.gflux_psf_flags',
                'r_psf_flag': 'forced.rflux_psf_flags', 'i_psf_flag':
                'forced.iflux_psf_flags', 'z_psf_flag':
                'forced.zflux_psf_flags', 'y_psf_flag':
                'forced.yflux_psf_flags'}
            if flux:
                psf_dict = {'g_psf_flux': 'forced.gflux_psf', 'r_psf_flux':
                    'forced.rflux_psf', 'i_psf_flux': 'forced.iflux_psf',
                    'z_psf_flux': 'forced.zflux_psf', 'y_psf_flux':
                    'forced.yflux_psf', 'g_psf_flux_err':
                    'forced.gflux_psf_err', 'r_psf_flux_err':
                    'forced.rflux_psf_err', 'i_psf_flux_err':
                    'forced.iflux_psf_err', 'z_psf_flux_err':
                    'forced.zflux_psf_err', 'y_psf_flux_err':
                    'forced.yflux_psf_err'}
            else:
                psf_dict = {'g_psf_mag': 'forced.gmag_psf', 'r_psf_mag':
                    'forced.rmag_psf', 'i_psf_mag': 'forced.imag_psf',
                    'z_psf_mag': 'forced.zmag_psf', 'y_psf_mag':
                    'forced.ymag_psf', 'g_psf_mag_err':
                    'forced.gmag_psf_err', 'r_psf_mag_err':
                    'forced.rmag_psf_err', 'i_psf_mag_err':
                    'forced.imag_psf_err', 'z_psf_mag_err':
                    'forced.zmag_psf_err', 'y_psf_mag_err':
                    'forced.ymag_psf_err'}
            psf_dict.update(psf_flag)
        else:
            psf_dict = {}
        if aper:
            print('# No PSF matched aperture photometry is available in PDR1')
            aper_dict = {}
        if shape:
            shape_dict = {'g_sdssshape_11': 'forced.gshape_sdss_11',
                'g_sdssshape_22': 'forced.gshape_sdss_22', 'g_sdssshape_12':
                'forced.gshape_sdss_12', 'r_sdssshape_11':
                'forced.rshape_sdss_11', 'r_sdssshape_22':
                'forced.rshape_sdss_22', 'r_sdssshape_12':
                'forced.rshape_sdss_12', 'i_sdssshape_11':
                'forced.ishape_sdss_11', 'i_sdssshape_22':
                'forced.ishape_sdss_22', 'i_sdssshape_12':
                'forced.ishape_sdss_12', 'z_sdssshape_11':
                'forced.zshape_sdss_11', 'z_sdssshape_22':
                'forced.zshape_sdss_22', 'z_sdssshape_12':
                'forced.zshape_sdss_12', 'y_sdssshape_11':
                'forced.yshape_sdss_11', 'y_sdssshape_22':
                'forced.yshape_sdss_22', 'y_sdssshape_12':
                'forced.yshape_sdss_12'}
        else:
            shape_dict = {}
    else:
        raise NameError('Wrong rerun name')
    basic_dict.update(cmodel_dict)
    basic_dict.update(psf_dict)
    basic_dict.update(aper_dict)
    basic_dict.update(shape_dict)
    basic_dict.update(meta_dict)
    return basic_dict
