'Parameters
a : str or `HDUList`
The filename of a FITS file on disk, or an `HDUList` object.
b : str or `HDUList`
The filename of a FITS file on disk, or an `HDUList` object to
compare to the first file.
ignore_keywords : sequence, optional
Header keywords to ignore when comparing two headers; the presence
of these keywords and their values are ignored.  Wildcard strings
may also be included in the list.
ignore_comments : sequence, optional
A list of header keywords whose comments should be ignored in the
comparison.  May contain wildcard strings as with ignore_keywords.
ignore_fields : sequence, optional
The (case-insensitive) names of any table columns to ignore if any
table data is to be compared.
numdiffs : int, optional
The number of pixel/table values to output when reporting HDU data
differences.  Though the count of differences is the same either
way, this allows controlling the number of different values that
are kept in memory or output.  If a negative value is given, then
numdiffs is treated as unlimited (default: 10).
rtol : float, optional
The relative difference to allow when comparing two float values
either in header values, image arrays, or table columns
(default: 0.0). Values which satisfy the expression
.. math::
\left| a - b \right| > \text{atol} + \text{rtol} \cdot \left| b \right|
are considered to be different.
The underlying function used for comparison is `numpy.allclose`.
.. versionchanged:: 2.0
``rtol`` replaces the deprecated ``tolerance`` argument.
atol : float, optional
The allowed absolute difference. See also ``rtol`` parameter.
.. versionadded:: 2.0
ignore_blanks : bool, optional
Ignore extra whitespace at the end of string values either in
headers or data. Extra leading whitespace is not ignored
(default: True).
ignore_blank_cards : bool, optional
Ignore all cards that are blank, i.e. they only contain
whitespace (default: True).'

def __init__(self, a, b, ignore_keywords=[], ignore_comments=[], ignore_fields=[], numdiffs=10, rtol=0.0, atol=0.0, ignore_blanks=True, ignore_blank_cards=True, tolerance=None):

    if isinstance(a, string_types):
        try:
            a = fitsopen(a)
        except Exception as exc:
            raise IOError('error    opening    file    a    ({}):    {}:    {}'.format(a, exc.__class__.__name__, exc.args[0]))
        close_a = True
    else:
        close_a = False
    if isinstance(b, string_types):
        try:
            b = fitsopen(b)
        except Exception as exc:
            raise IOError('error    opening    file    b    ({}):    {}:    {}'.format(b, exc.__class__.__name__, exc.args[0]))
        close_b = True
    else:
        close_b = False
    self.ignore_keywords = set((k.upper() for k in ignore_keywords))
    self.ignore_comments = set((k.upper() for k in ignore_comments))
    self.ignore_fields = set((k.upper() for k in ignore_fields))
    self.numdiffs = numdiffs
    self.rtol = rtol
    self.atol = atol
    if (tolerance is not None):
        warnings.warn('"tolerance"    was    deprecated    in    version    2.0    and    will    be    removed    in    a    future    version.    Use    argument    "rtol"    instead.', AstropyDeprecationWarning)
        self.rtol = tolerance
    self.ignore_blanks = ignore_blanks
    self.ignore_blank_cards = ignore_blank_cards
    self.diff_hdu_count = ()
    self.diff_hdus = []
    try:
        super(FITSDiff, self).__init__(a, b)
    finally:
        if close_a:
            a.close()
        if close_b:
            b.close()
