def matching(tr_synth, tr_seis):
    """
    matching zeroes all values of the seismic trace `tr_seis` 
    outside the limits of the synthetic trace `tr_synth`

    Parameters
    ----------
    tr_synth : numpy.array
        The synthetic trace
    tr_seis : numpy.array
        The seismic trace

    Returns
    -------
    tr_seis_new: numpy.array
        Returns the new seismic trace (with zeros outside the area of comparison)

    """
    tr_seis_new = tr_seis.copy()
    i = 0
    while tr_synth[i] == 0 and i < len(tr_seis):
        tr_seis_new[i] = 0
        i += 1
    i = len(tr_seis)-1
    while tr_synth[i] == 0 and i >= 0:
        tr_seis_new[i] = 0
        i -= 1
    return tr_seis_new