def MergeWaveSets(waveset1, waveset2):
    """Return the union of the two wavelength sets.

    The union is computed using `numpy.union1d`, unless one or
    both of them is `None`.

    The merged result may sometimes contain numbers which are nearly
    equal but differ at levels as small as 1E-14. Having values this
    close together can cause problems due to effectively duplicate
    wavelength values. Therefore, wavelength values having differences
    smaller than or equal to ``pysynphot.spectrum.MERGETHRESH``
    (defaults to 1E-12) are considered as the same.

    Parameters
    ----------
    waveset1, waveset2 : array_like or `None`
        Wavelength sets to combine.

    Returns
    -------
    MergedWaveSet : array_like or `None`
        Merged wavelength set. It is `None` if both inputs are such.

    """
    if waveset1 is None and waveset2 is not None:
        MergedWaveSet = waveset2
    elif waveset2 is None and waveset1 is not None:
        MergedWaveSet = waveset1
    elif waveset1 is None and waveset2 is None:
        MergedWaveSet = None
    else:
        MergedWaveSet = N.union1d(waveset1, waveset2)

        # The merged wave sets may sometimes contain numbers which are nearly
        # equal but differ at levels as small as 1e-14. Having values this
        # close together can cause problems down the line so here we test
        # whether any such small differences are present, with a small
        # difference defined as less than MERGETHRESH.
        #
        # If small differences are present we make a copy of the union'ed array
        # with the lower of the close together pairs removed.
        delta = MergedWaveSet[1:] - MergedWaveSet[:-1]

        if not (delta > MERGETHRESH).all():
            newlen = len(delta[delta > MERGETHRESH]) + 1
            newmerged = N.zeros(newlen, dtype=MergedWaveSet.dtype)
            newmerged[:-1] = MergedWaveSet[:-1][delta > MERGETHRESH]
            newmerged[-1] = MergedWaveSet[-1]

            MergedWaveSet = newmerged

    return MergedWaveSet
Return the union of the two wavelength sets.

    The union is computed using `numpy.union1d`, unless one or
    both of them is `None`.

    The merged result may sometimes contain numbers which are nearly
    equal but differ at levels as small as 1E-14. Having values this
    close together can cause problems due to effectively duplicate
    wavelength values. Therefore, wavelength values having differences
    smaller than or equal to ``pysynphot.spectrum.MERGETHRESH``
    (defaults to 1E-12) are considered as the same.

    Parameters
    ----------
    waveset1, waveset2 : array_like or `None`
        Wavelength sets to combine.

    Returns
    -------
    MergedWaveSet : array_like or `None`
        Merged wavelength set. It is `None` if both inputs are such.