glue-viz / glue

Linked Data Visualizations Across Multiple Files
http://glueviz.org
Other
735 stars 153 forks source link

unit-related error when switching "y" and "slice" axes #528

Closed keflavich closed 9 years ago

keflavich commented 9 years ago

I was looking at an ALMA data cube:

glue SgrB2_a_03_7M.lowres.spw0.image.pbcor.fits
2014-12-09 21:23:33.021 python[16286:507] modalSession has been exited prematurely - check for a reentrant call to endModalSession:
/Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/text.py:52: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if rotation in ('horizontal', None):
/Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/text.py:54: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  elif rotation == 'vertical':
Traceback (most recent call last):
  File "/Users/adam/repos/glue/glue/qt/widgets/image_widget.py", line 191, in <lambda>
    ui.slice.slice_changed.connect(lambda: setattr(self, 'slice', self.ui.slice.slice))
  File "/Users/adam/repos/glue/glue/qt/widgets/image_widget.py", line 177, in slice
    self.client.slice = value
  File "/Users/adam/repos/glue/glue/external/echo.py", line 55, in __set__
    self._setter(instance, value)
  File "/Users/adam/repos/glue/glue/clients/util.py", line 235, in wrapper
    FigureCanvasAgg.draw.execute_deferred_calls()
  File "/Users/adam/repos/glue/glue/clients/util.py", line 213, in execute_deferred_calls
    self.method(instance, *args, **kwargs)
  File "/Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 461, in draw
    self.figure.draw(self.renderer)
  File "/Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/matplotlib/figure.py", line 1079, in draw
    func(*args)
  File "/Users/adam/repos/glue/glue/external/wcsaxes/core.py", line 118, in draw
    ticklabels_bbox=self._ticklabels_bbox)
  File "/Users/adam/repos/glue/glue/external/wcsaxes/coordinate_helpers.py", line 347, in _draw
    self._update_ticks(renderer)
  File "/Users/adam/repos/glue/glue/external/wcsaxes/coordinate_helpers.py", line 481, in _update_ticks
    text = self._formatter_locator.formatter(self.lbl_world * tick_world_coordinates.unit, spacing=spacing)
  File "/Users/adam/repos/glue/glue/external/wcsaxes/formatter_locator.py", line 286, in formatter
    precision = -int(np.floor(np.log10(spacing.value)))
AttributeError: 'float' object has no attribute 'value'

I don't know why there is a missing unit; the header is normal. BUNIT won't parse, but I don't think this has anything to do with that. Here's the header:

SIMPLE  =                    T /Standard FITS
BITPIX  =                  -32 /Floating point (32 bit)
NAXIS   =                    3
NAXIS1  =                  216
NAXIS2  =                  216
NAXIS3  =                  816
EXTEND  =                    T
BSCALE  =   1.000000000000E+00 /PHYSICAL = PIXEL*BSCALE + BZERO
BZERO   =   0.000000000000E+00
BMAJ    =   6.369356579251E-03
BMIN    =   2.730435000526E-03
BPA     =  -8.402296447754E+01
BTYPE   = 'Intensity'
OBJECT  = 'SgrB2   '
COMMENT   1 blank line
BUNIT   = 'JY/BEAM '           /Brightness (pixel) unit
EQUINOX =   2.000000000000E+03
RADESYS = 'FK5     '
LONPOLE =   1.800000000000E+02
LATPOLE =  -2.839138888889E+01
PC01_01 =   1.000000000000E+00
PC02_01 =   0.000000000000E+00
PC03_01 =   0.000000000000E+00
PC01_02 =   0.000000000000E+00
PC02_02 =   1.000000000000E+00
PC03_02 =   0.000000000000E+00
PC01_03 =   0.000000000000E+00
PC02_03 =   0.000000000000E+00
PC03_03 =   1.000000000000E+00
CTYPE1  = 'RA---SIN'
CRVAL1  =   2.668308333333E+02
CDELT1  =  -6.944444444444E-04
CRPIX1  =   1.090000000000E+02
CUNIT1  = 'deg     '
CTYPE2  = 'DEC--SIN'
CRVAL2  =  -2.839138888889E+01
CDELT2  =   6.944444444444E-04
CRPIX2  =   1.090000000000E+02
CUNIT2  = 'deg     '
CTYPE3  = 'FREQ    '
CRVAL3  =   9.028711936474E+10
CDELT3  =   2.441372370026E+06
CRPIX3  =   1.000000000000E+00
CUNIT3  = 'Hz      '
PV2_1   =   0.000000000000E+00
PV2_2   =   0.000000000000E+00
RESTFRQ =   9.130000000000E+10 /Rest Frequency (Hz)
SPECSYS = 'LSRK    '           /Spectral reference frame
ALTRVAL =   3.325892391085E+06 /Alternate frequency reference value
ALTRPIX =   1.000000000000E+00 /Alternate frequency reference pixel
VELREF  =                  257 /1 LSR, 2 HEL, 3 OBS, +256 Radio
COMMENT casacore non-standard usage: 4 LSD, 5 GEO, 6 SOU, 7 GAL
TELESCOP= 'ALMA    '
OBSERVER= 'keflavich'
DATE-OBS= '2014-07-01T06:26:21.359998'
TIMESYS = 'UTC     '
OBSRA   =   2.668308333333E+02
OBSDEC  =  -2.839138888889E+01
OBSGEO-X=   2.225061873184E+06
OBSGEO-Y=  -5.440061952280E+06
OBSGEO-Z=  -2.481682085791E+06
DATE    = '2014-09-11T05:03:53.211000' /Date FITS file was written
ORIGIN  = 'CASA 4.2.1 (release r29047)'
END
ChrisBeaumont commented 9 years ago

Hmm, do you think this this a wcsaxes bug @astrofrog?

astrofrog commented 9 years ago

Yep, looks like a bug which may now be fixed in wcsaxes. Will check!