Regression in io.fits due to undefined variable
See original GitHub issue@mwcraig @embray - I’m running into the following failure in glue due to the recent changes in io.fits:
def _read_next_hdu(self):
"""
Lazily load a single HDU from the fileobj or data string the `HDUList`
was opened from, unless no further HDUs are found.
Returns True if a new HDU was loaded, or False otherwise.
"""
if self._read_all:
return False
saved_compression_enabled = compressed.COMPRESSION_ENABLED
fileobj, data, kwargs = self._file, self._data, self._open_kwargs
try:
self._in_read_next_hdu = True
if ('disable_image_compression' in kwargs and
kwargs['disable_image_compression']):
compressed.COMPRESSION_ENABLED = False
# read all HDUs
try:
if fileobj is not None:
try:
# Make sure we're back to the end of the last read
# HDU
if len(self) > 0:
last = self[len(self) - 1]
if last._data_offset is not None:
offset = last._data_offset + last._data_size
fileobj.seek(offset, os.SEEK_SET)
hdu = _BaseHDU.readfrom(fileobj, **kwargs)
except EOFError:
self._read_all = True
return False
except ValueError:
# A ValueError can occur when trying to perform I/O
# on a closed file
if fileobj.closed:
self._read_all = True
return False
else:
raise
except IOError:
if fileobj.writeonly:
self._read_all = True
return False
else:
raise
else:
if not data:
self._read_all = True
return False
hdu = _BaseHDU.fromstring(data, **kwargs)
self._data = data[hdu._data_offset + hdu._data_size:]
super(HDUList, self).append(hdu)
if len(self) == 1:
# Check for an extension HDU and update the EXTEND
# keyword of the primary HDU accordingly
self.update_extend()
hdu._new = False
if 'checksum' in kwargs:
hdu._output_checksum = kwargs['checksum']
# check in the case there is extra space after the last HDU or
# corrupted HDU
except (VerifyError, ValueError) as exc:
warnings.warn(
'Error validating header for HDU #{} (note: Astropy '
'uses zero-based indexing).\n{}\n'
'There may be extra bytes after the last HDU or the '
'file is corrupted.'.format(
> len(hdulist), indent(str(exc))), VerifyWarning)
E NameError: global name 'hdulist' is not defined
../../../miniconda/envs/test/lib/python2.7/site-packages/astropy/io/fits/hdu/hdulist.py:1150: NameError
============================ pytest-warning summary ============================
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Tutorial: Understanding Regression Error Metrics in Python
Error metrics are short and useful summaries of the quality of our data. We dive into four common regression metrics and discuss their...
Read more >Can we treat discrete variable as continuous ... - Stack Overflow
In general, it is risky to treat a discrete numerical variable as though it is equivalent to a continuous variable.
Read more >Imprecise Regression
This is a sample data set with two undefined variables that each have a lower and upper value recorded for every observation.
Read more >Linear Regression - SAS - GSU Library Research Guides
The third table shows us our model fit statistics to judge how well our independent variables explain the variance of wages. The column...
Read more >Creating a regression model in Databricks - Tropos.io
Now that the data is checked and cleaned, we can transform it to the variable types we need. Since vendor ID is a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Definitely an under-tested corner case 😛
@mwcraig - yep, any file that is not a FITS file that has unicode: