import logging


def add_same_offset_images(parameters,parameters_slave,rd_dem,rd_dem_slave,t0_dem):
    """Get offsets of the dem for master and slave

    Parameters
    ----------
    parameters : dict
        Dictionary with parameters of the master image.
        Output of function get_params_from_xml()
    parameters_slave : dict
        Dictionary with parameters of the slave image.
        Output of function get_params_from_xml()
    rd_dem : float
         Range sampling of back-geocoded DEM for the master
         Output from get_params_back_geocoding_dem()
    rd_dem_slave: float
        Range sampling of back-geocoded DEM for the slave
        Output from get_params_back_geocoding_dem()
    t0_dem
        Azimuth start time of DEM with margin
        Output from get_params_back_geocoding_dem()

    Returns
    -------
    rd_dem : float
    rd_dem_slave : float
    t0_dem : float
    t0_dem_slave : float

    Notes
    -------
    Author : Victor Cazcarra-Bes (victor.cazcarrabes@dlr.de)
    Date : May 2020

    """

    log = logging.getLogger('add_same_offset_images')
    log.info('Add same offset to the images ...')

    
    incrd = parameters['rg_delay'] - rd_dem
    rd_dem = parameters['rg_delay'] - incrd
    rd_dem_slave = parameters_slave['rg_delay'] - incrd
    ts_min = 0  # t0_start from TAXI, which is set to 0
    inct = ts_min - t0_dem
    t0_dem = ts_min - inct
    t0_dem_slave = ts_min - inct

    return rd_dem,rd_dem_slave,t0_dem,t0_dem_slave