Closed st-automaton-01 closed 4 years ago
A file is missing.
Error Message
OSError: error opening file a (j6lq01011_crj.fits): FileNotFoundError: 2
Stacktrace
self = <astropy.io.fits.diff.FITSDiff object at 0x7f34e2775b70>
a = 'j6lq01011_crj.fits'
b = '/srv/jenkins/workspace/RT/hstcal/clone/tests_output/test_fullframe_j6lq01010_outro0/j6lq01011_crj_ref.fits'
ignore_hdus = []
ignore_keywords = ['filename', 'date', 'iraf-tlm', 'fitsdate', 'opus_ver', 'cal_ver', ...]
ignore_comments = [], ignore_fields = [], numdiffs = 10, rtol = 1e-07, atol = 0
ignore_blanks = True, ignore_blank_cards = True
def __init__(self, a, b, ignore_hdus=[], ignore_keywords=[],
ignore_comments=[], ignore_fields=[],
numdiffs=10, rtol=0.0, atol=0.0,
ignore_blanks=True, ignore_blank_cards=True):
"""
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_hdus : sequence, optional
HDU names to ignore when comparing two FITS files or HDU lists; the
presence of these HDUs and their contents are ignored. Wildcard
strings may also be included in the list.
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`.
.. versionadded:: 2.0
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).
"""
if isinstance(a, str):
try:
> a = fitsopen(a)
/srv/jenkins/workspace/RT/hstcal/miniconda/envs/tmp_env0/lib/python3.6/site-packages/astropy/io/fits/diff.py:273:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'j6lq01011_crj.fits', mode = 'readonly', memmap = None
save_backup = False, cache = True, lazy_load_hdus = True
kwargs = {'uint': True}, conf = <astropy.io.fits.Conf object at 0x7f34d5d10c50>
def fitsopen(name, mode='readonly', memmap=None, save_backup=False,
cache=True, lazy_load_hdus=None, **kwargs):
"""Factory function to open a FITS file and return an `HDUList` object.
Parameters
----------
name : file path, file object, file-like object or pathlib.Path object
File to be opened.
mode : str, optional
Open mode, 'readonly', 'update', 'append', 'denywrite', or
'ostream'. Default is 'readonly'.
If ``name`` is a file object that is already opened, ``mode`` must
match the mode the file was opened with, readonly (rb), update (rb+),
append (ab+), ostream (w), denywrite (rb)).
memmap : bool, optional
Is memory mapping to be used? This value is obtained from the
configuration item ``astropy.io.fits.Conf.use_memmap``.
Default is `True`.
save_backup : bool, optional
If the file was opened in update or append mode, this ensures that
a backup of the original file is saved before any changes are flushed.
The backup has the same name as the original file with ".bak" appended.
If "file.bak" already exists then "file.bak.1" is used, and so on.
Default is `False`.
cache : bool, optional
If the file name is a URL, `~astropy.utils.data.download_file` is used
to open the file. This specifies whether or not to save the file
locally in Astropy's download cache. Default is `True`.
lazy_load_hdus : bool, optional
To avoid reading all the HDUs and headers in a FITS file immediately
upon opening. This is an optimization especially useful for large
files, as FITS has no way of determining the number and offsets of all
the HDUs in a file without scanning through the file and reading all
the headers. Default is `True`.
To disable lazy loading and read all HDUs immediately (the old
behavior) use ``lazy_load_hdus=False``. This can lead to fewer
surprises--for example with lazy loading enabled, ``len(hdul)``
can be slow, as it means the entire FITS file needs to be read in
order to determine the number of HDUs. ``lazy_load_hdus=False``
ensures that all HDUs have already been loaded after the file has
been opened.
.. versionadded:: 1.3
uint : bool, optional
Interpret signed integer data where ``BZERO`` is the central value and
``BSCALE == 1`` as unsigned integer data. For example, ``int16`` data
with ``BZERO = 32768`` and ``BSCALE = 1`` would be treated as
``uint16`` data. Default is `True` so that the pseudo-unsigned
integer convention is assumed.
ignore_missing_end : bool, optional
Do not issue an exception when opening a file that is missing an
``END`` card in the last header. Default is `False`.
checksum : bool, str, optional
If `True`, verifies that both ``DATASUM`` and ``CHECKSUM`` card values
(when present in the HDU header) match the header and data of all HDU's
in the file. Updates to a file that already has a checksum will
preserve and update the existing checksums unless this argument is
given a value of 'remove', in which case the CHECKSUM and DATASUM
values are not checked, and are removed when saving changes to the
file. Default is `False`.
disable_image_compression : bool, optional
If `True`, treats compressed image HDU's like normal binary table
HDU's. Default is `False`.
do_not_scale_image_data : bool, optional
If `True`, image data is not scaled using BSCALE/BZERO values
when read. Default is `False`.
character_as_bytes : bool, optional
Whether to return bytes for string columns, otherwise unicode strings
are returned, but this does not respect memory mapping and loads the
whole column in memory when accessed. Default is `False`.
ignore_blank : bool, optional
If `True`, the BLANK keyword is ignored if present.
Default is `False`.
scale_back : bool, optional
If `True`, when saving changes to a file that contained scaled image
data, restore the data to the original type and reapply the original
BSCALE/BZERO values. This could lead to loss of accuracy if scaling
back to integer values after performing floating point operations on
the data. Default is `False`.
output_verify : str
Output verification option. Must be one of ``"fix"``,
``"silentfix"``, ``"ignore"``, ``"warn"``, or
``"exception"``. May also be any combination of ``"fix"`` or
``"silentfix"`` with ``"+ignore"``, ``+warn``, or ``+exception"
(e.g. ``"fix+warn"``). See :ref:`verify` for more info.
Returns
-------
hdulist : an `HDUList` object
`HDUList` containing all of the header data units in the file.
"""
from astropy.io.fits import conf
if memmap is None:
# distinguish between True (kwarg explicitly set)
# and None (preference for memmap in config, might be ignored)
memmap = None if conf.use_memmap else False
else:
memmap = bool(memmap)
if lazy_load_hdus is None:
lazy_load_hdus = conf.lazy_load_hdus
else:
lazy_load_hdus = bool(lazy_load_hdus)
if 'uint' not in kwargs:
kwargs['uint'] = conf.enable_uint
if not name:
raise ValueError(f'Empty filename: {name!r}')
return HDUList.fromfile(name, mode, memmap, save_backup, cache,
> lazy_load_hdus, **kwargs)
/srv/jenkins/workspace/RT/hstcal/miniconda/envs/tmp_env0/lib/python3.6/site-packages/astropy/io/fits/hdu/hdulist.py:165:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'astropy.io.fits.hdu.hdulist.HDUList'>
fileobj = 'j6lq01011_crj.fits', mode = 'readonly', memmap = None
save_backup = False, cache = True, lazy_load_hdus = True
kwargs = {'uint': True}
@classmethod
def fromfile(cls, fileobj, mode=None, memmap=None,
save_backup=False, cache=True, lazy_load_hdus=True,
**kwargs):
"""
Creates an `HDUList` instance from a file-like object.
The actual implementation of ``fitsopen()``, and generally shouldn't
be used directly. Use :func:`open` instead (and see its
documentation for details of the parameters accepted by this method).
"""
return cls._readfrom(fileobj=fileobj, mode=mode, memmap=memmap,
save_backup=save_backup, cache=cache,
> lazy_load_hdus=lazy_load_hdus, **kwargs)
/srv/jenkins/workspace/RT/hstcal/miniconda/envs/tmp_env0/lib/python3.6/site-packages/astropy/io/fits/hdu/hdulist.py:405:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'astropy.io.fits.hdu.hdulist.HDUList'>
fileobj = 'j6lq01011_crj.fits', data = None, mode = 'readonly', memmap = None
save_backup = False, cache = True, lazy_load_hdus = True
kwargs = {'uint': True}
@classmethod
def _readfrom(cls, fileobj=None, data=None, mode=None,
memmap=None, save_backup=False, cache=True,
lazy_load_hdus=True, **kwargs):
"""
Provides the implementations from HDUList.fromfile and
HDUList.fromstring, both of which wrap this method, as their
implementations are largely the same.
"""
if fileobj is not None:
if not isinstance(fileobj, _File):
# instantiate a FITS file object (ffo)
> fileobj = _File(fileobj, mode=mode, memmap=memmap, cache=cache)
/srv/jenkins/workspace/RT/hstcal/miniconda/envs/tmp_env0/lib/python3.6/site-packages/astropy/io/fits/hdu/hdulist.py:1054:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<[AttributeError("'_File' object has no attribute '_file'",) raised in repr()] _File object at 0x7f34d4336e80>, 'j6lq01011_crj.fits')
kwargs = {'cache': True, 'memmap': None, 'mode': 'readonly'}, i = 0
message = '"clobber" was deprecated in version 2.0 and will be removed in a future version. '
@functools.wraps(function)
def wrapper(*args, **kwargs):
for i in range(n):
message = (f'"{old_name[i]}" was deprecated in version '
f'{since[i]} and will be removed in a future '
'version. ')
# The only way to have oldkeyword inside the function is
# that it is passed as kwarg because the oldkeyword
# parameter was renamed to newkeyword.
if old_name[i] in kwargs:
value = kwargs.pop(old_name[i])
# Display the deprecation warning only when it's not
# pending.
if not pending[i]:
if new_name[i] is not None:
message += f'Use argument "{new_name[i]}" instead.'
elif alternative:
message += f'\n Use {alternative} instead.'
warnings.warn(message, warning_type, stacklevel=2)
# Check if the newkeyword was given as well.
newarg_in_args = (position[i] is not None and
len(args) > position[i])
newarg_in_kwargs = new_name[i] in kwargs
if newarg_in_args or newarg_in_kwargs:
if not pending[i]:
# If both are given print a Warning if relax is
# True or raise an Exception is relax is False.
if relax[i]:
warnings.warn(
f'"{old_name[i]}" and "{new_name[i]}" '
'keywords were set. '
f'Using the value of "{new_name[i]}".',
AstropyUserWarning)
else:
raise TypeError(
f'cannot specify both "{old_name[i]}" and '
f'"{new_name[i]}".')
else:
# Pass the value of the old argument with the
# name of the new argument to the function
if new_name[i] is not None:
kwargs[new_name[i]] = value
# If old argument has no replacement, cast it back.
# https://github.com/astropy/astropy/issues/9914
else:
kwargs[old_name[i]] = value
# Deprecated keyword without replacement is given as
# positional argument.
elif (not pending[i] and not new_name[i] and position[i] and
len(args) > position[i]):
if alternative:
message += f'\n Use {alternative} instead.'
warnings.warn(message, warning_type, stacklevel=2)
> return function(*args, **kwargs)
/srv/jenkins/workspace/RT/hstcal/miniconda/envs/tmp_env0/lib/python3.6/site-packages/astropy/utils/decorators.py:535:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <[AttributeError("'_File' object has no attribute '_file'",) raised in repr()] _File object at 0x7f34d4336e80>
fileobj = 'j6lq01011_crj.fits', mode = 'readonly', memmap = True
overwrite = False, cache = True
@deprecated_renamed_argument('clobber', 'overwrite', '2.0')
def __init__(self, fileobj=None, mode=None, memmap=None, overwrite=False,
cache=True):
self.strict_memmap = bool(memmap)
memmap = True if memmap is None else memmap
if fileobj is None:
self._file = None
self.closed = False
self.binary = True
self.mode = mode
self.memmap = memmap
self.compression = None
self.readonly = False
self.writeonly = False
self.simulateonly = True
self.close_on_error = False
return
else:
self.simulateonly = False
# If fileobj is of type pathlib.Path
if isinstance(fileobj, pathlib.Path):
fileobj = str(fileobj)
elif isinstance(fileobj, bytes):
# Using bytes as filename is tricky, it's deprecated for Windows
# in Python 3.5 (because it could lead to false-positives) but
# was fixed and un-deprecated in Python 3.6.
# However it requires that the bytes object is encoded with the
# file system encoding.
# Probably better to error out and ask for a str object instead.
# TODO: This could be revised when Python 3.5 support is dropped
# See also: https://github.com/astropy/astropy/issues/6789
raise TypeError("names should be `str` not `bytes`.")
# Holds mmap instance for files that use mmap
self._mmap = None
if mode is not None and mode not in IO_FITS_MODES:
raise ValueError(f"Mode '{mode}' not recognized")
if isfile(fileobj):
objmode = _normalize_fits_mode(fileobj_mode(fileobj))
if mode is not None and mode != objmode:
raise ValueError(
"Requested FITS mode '{}' not compatible with open file "
"handle mode '{}'".format(mode, objmode))
mode = objmode
if mode is None:
mode = 'readonly'
# Handle raw URLs
if (isinstance(fileobj, str) and
mode not in ('ostream', 'append', 'update') and _is_url(fileobj)):
self.name = download_file(fileobj, cache=cache)
# Handle responses from URL requests that have already been opened
elif isinstance(fileobj, http.client.HTTPResponse):
if mode in ('ostream', 'append', 'update'):
raise ValueError(
f"Mode {mode} not supported for HTTPResponse")
fileobj = io.BytesIO(fileobj.read())
else:
self.name = fileobj_name(fileobj)
self.closed = False
self.binary = True
self.mode = mode
self.memmap = memmap
# Underlying fileobj is a file-like object, but an actual file object
self.file_like = False
# Should the object be closed on error: see
# https://github.com/astropy/astropy/issues/6168
self.close_on_error = False
# More defaults to be adjusted below as necessary
self.compression = None
self.readonly = False
self.writeonly = False
# Initialize the internal self._file object
if isfile(fileobj):
self._open_fileobj(fileobj, mode, overwrite)
elif isinstance(fileobj, str):
> self._open_filename(fileobj, mode, overwrite)
/srv/jenkins/workspace/RT/hstcal/miniconda/envs/tmp_env0/lib/python3.6/site-packages/astropy/io/fits/file.py:193:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <[AttributeError("'_File' object has no attribute '_file'",) raised in repr()] _File object at 0x7f34d4336e80>
filename = 'j6lq01011_crj.fits', mode = 'readonly', overwrite = False
def _open_filename(self, filename, mode, overwrite):
"""Open a FITS file from a filename string."""
if mode == 'ostream':
self._overwrite_existing(overwrite, None, True)
if os.path.exists(self.name):
with fileobj_open(self.name, 'rb') as f:
magic = f.read(4)
else:
magic = b''
ext = os.path.splitext(self.name)[1]
if not self._try_read_compressed(self.name, magic, mode, ext=ext):
> self._file = fileobj_open(self.name, IO_FITS_MODES[mode])
/srv/jenkins/workspace/RT/hstcal/miniconda/envs/tmp_env0/lib/python3.6/site-packages/astropy/io/fits/file.py:574:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
filename = 'j6lq01011_crj.fits', mode = 'rb'
def fileobj_open(filename, mode):
"""
A wrapper around the `open()` builtin.
This exists because `open()` returns an `io.BufferedReader` by default.
This is bad, because `io.BufferedReader` doesn't support random access,
which we need in some cases. We must call open with buffering=0 to get
a raw random-access file reader.
"""
> return open(filename, mode, buffering=0)
E FileNotFoundError: [Errno 2] No such file or directory: 'j6lq01011_crj.fits'
/srv/jenkins/workspace/RT/hstcal/miniconda/envs/tmp_env0/lib/python3.6/site-packages/astropy/io/fits/util.py:396: FileNotFoundError
During handling of the above exception, another exception occurred:
self = <tests.acs.test_wfc_asn.TestFullFrameASN object at 0x7f34d427deb8>
rootname = 'j6lq01010', outroots = ['j6lq01011', 'j6lq01ndq']
@pytest.mark.parametrize(
('rootname', 'outroots'),
[('j6lq01010', ['j6lq01011', 'j6lq01ndq']),
('jbdf08010', ['jbdf08011', 'jbdf08uhq'])])
def test_fullframe(self, rootname, outroots):
asn_file = rootname + '_asn.fits'
# Prepare input files.
self.get_input_file(asn_file)
# Run CALACS
subprocess.call(['calacs.e', asn_file, '-v'])
# Compare results.
# The first outroot is the output from whole ASN,
# the rest are individual members.
outputs = [('{}_crj.fits'.format(outroots[0]),
'{}_crj_ref.fits'.format(outroots[0])),
('{}_crc.fits'.format(outroots[0]),
'{}_crc_ref_gen2cte.fits'.format(outroots[0]))]
for outroot in outroots[1:]:
outputs += [('{}_flt.fits'.format(outroot),
'{}_flt_ref.fits'.format(outroot)),
('{}_flc.fits'.format(outroot),
'{}_flc_ref_gen2cte.fits'.format(outroot))]
> self.compare_outputs(outputs, ignore_keywords_overwrite=TestFullFrameASN.ignore_keywords)
/srv/jenkins/workspace/RT/hstcal/clone/tests/acs/test_wfc_asn.py:51:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/srv/jenkins/workspace/RT/hstcal/clone/tests/helpers.py:284: in compare_outputs
ignore_keywords=ignore_keywords)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <astropy.io.fits.diff.FITSDiff object at 0x7f34e2775b70>
a = 'j6lq01011_crj.fits'
b = '/srv/jenkins/workspace/RT/hstcal/clone/tests_output/test_fullframe_j6lq01010_outro0/j6lq01011_crj_ref.fits'
ignore_hdus = []
ignore_keywords = ['filename', 'date', 'iraf-tlm', 'fitsdate', 'opus_ver', 'cal_ver', ...]
ignore_comments = [], ignore_fields = [], numdiffs = 10, rtol = 1e-07, atol = 0
ignore_blanks = True, ignore_blank_cards = True
def __init__(self, a, b, ignore_hdus=[], ignore_keywords=[],
ignore_comments=[], ignore_fields=[],
numdiffs=10, rtol=0.0, atol=0.0,
ignore_blanks=True, ignore_blank_cards=True):
"""
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_hdus : sequence, optional
HDU names to ignore when comparing two FITS files or HDU lists; the
presence of these HDUs and their contents are ignored. Wildcard
strings may also be included in the list.
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`.
.. versionadded:: 2.0
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).
"""
if isinstance(a, str):
try:
a = fitsopen(a)
except Exception as exc:
raise OSError("error opening file a ({}): {}: {}".format(
> a, exc.__class__.__name__, exc.args[0]))
E OSError: error opening file a (j6lq01011_crj.fits): FileNotFoundError: 2
/srv/jenkins/workspace/RT/hstcal/miniconda/envs/tmp_env0/lib/python3.6/site-packages/astropy/io/fits/diff.py:276: OSError
Nothing associated with this test has changed (software or input/reference/truth files) in recent history to cause this test to fail. More importantly, the previous seven days of this regression test, as well as the one day of regression testing after this reported failure have all successfully processed. The test fails as an output file which must be compared to its truth file is not generated. However, there is no indication that I can see in the log why the file is not present. Having said this, I have seen spurious failures akin to this on occasion.
Closing this issue as it self-corrected.
Regression Testing (RT) Summary:
Configuration: release
Report: https://plwishmaster.stsci.edu:8081/job/RT/job/hstcal/test_results_analyzer/