So the test that is failing is:
sunraster/tests/test_spectrogram.py::test_ndcube_components_after_slicing
at
sunraster/spectrogram.py:258: in __str__
if self.time.isscalar:
with TypeError: Unsupported operand type(s) for ufunc add: 'Time,Quantity',
Situation before it fails
function = <ufunc 'add'>, method = '__call__', args = (<Time object: scale='utc' format='iso' value=2017-01-01 00:00:00.000>, <Quantity [nan] s>), ufunc_helper = <function get_converters_and_unit at 0x7f6ee0f7e040>, units = [None, Unit("s")], converters = [False, None]
The test is using:
(Pdb) spectrogram_instrument_axes
<sunraster.spectrogram.SpectrogramCube object at 0x7ff87753a970>
SpectrogramCube
---------------
Time Period: ['2017-01-01 00:00:00.000' '2017-01-01 00:00:01.000']
Instrument axes: ['a' 'b' 'c']
Pixel dimensions: [2 2 3] pix
Longitude range: [2159.96856373 3600. ] arcsec
Latitude range: [4.56894119e-02 1.80000000e+03] arcsec
Spectral range: [1.02e-09 1.06e-09] m
Data unit: ct
The constructed test Cube also has the same problem:
(Pdb) spectrogram_instrument_axes.data[item]
array([[[0.563]]])
(Pdb) spectrogram_instrument_axes.uncertainty[item]
UnknownUncertainty([[[0.75033326]]])
(Pdb) spectrogram_instrument_axes.mask[item]
array([[[False]]])
(Pdb) ec0
['time', 0, <Time object: scale='utc' format='iso' value=['2017-01-01 00:00:00.000']>]
(Pdb) spectrogram_instrument_axes.wcs[item]
WCS Keywords
Number of WCS axes: 3
CTYPE : 'WAVE' 'HPLT-TAN' 'HPLN-TAN'
CRVAL : 1e-09 0.5 1.0
CRPIX : 0.0 2.0 2.0
PC1_1 PC1_2 PC1_3 : 1.0 0.0 0.0
PC2_1 PC2_2 PC2_3 : 0.0 1.0 0.0
PC3_1 PC3_2 PC3_3 : 0.0 0.0 1.0
CDELT : 2.0000000000000002e-11 0.5 0.4
NAXIS : 1 1 1
It goes to:
Time(self._get_axis_coord(self._time_name, self._time_loc))
and errors on self._get_axis_coord, which is from self.axis_world_coords(wcs=self.extra_coords[axis_name])[0]
Here the wcs is ExtraCoords(time ((0,)) None: TimeTableCoordinate ['time'] [None]: ['2017-01-01 00:00:00.000'])
Inside that, it errors in axis_world_coords from ndcube, at
axes_coords = values_to_high_level_objects(
*axes_coords, low_level_wcs=wcs)
with the inputs to that being:
(Pdb) axes_coords
[<Quantity [nan] s>]
(Pdb) wcs
<WCS(output_frame=TemporalFrame, input_frame=PixelFrame, forward_transform=Model: Tabular1D
N_inputs: 1
N_outputs: 1
Parameters:
points: (<Quantity [0.] pix>,)
lookup_table: [0.] s
method: linear
fill_value: nan
bounds_error: False)>
and axes_coords comes from self._generate_world_coords(pixel_corners, wcs) with the input being:
(Pdb) pixel_corners, wcs
(False, <ndcube.extra_coords.extra_coords.ExtraCoords object at 0x7fae6699d760>
ExtraCoords(time ((0,)) None: TimeTableCoordinate ['time'] [None]: ['2017-01-01 00:00:00.000']))
#184 (comment)
The problem is that the sliced extra_coords wcs return nan for the world value of the 0th pixel:
>>> sliced_cube.extra_coords["time"].wcs.pixel_to_world_values(0)
nan
where
>>> sliced_cube.extra_coords["time"].wcs
<WCS(output_frame=TemporalFrame, input_frame=PixelFrame, forward_transform=Model: Tabular1D
N_inputs: 1
N_outputs: 1
Parameters:
points: (<Quantity [0.] pix>,)
lookup_table: [0.] s
method: linear
fill_value: nan
bounds_error: False)>
The question is why is this happening?
So the test that is failing is:
sunraster/tests/test_spectrogram.py::test_ndcube_components_after_slicingat
with
TypeError: Unsupported operand type(s) for ufunc add: 'Time,Quantity',Situation before it fails
The test is using:
The constructed test Cube also has the same problem:
It goes to:
and errors on
self._get_axis_coord, which is fromself.axis_world_coords(wcs=self.extra_coords[axis_name])[0]Here the wcs is
ExtraCoords(time ((0,)) None: TimeTableCoordinate ['time'] [None]: ['2017-01-01 00:00:00.000'])Inside that, it errors in
axis_world_coordsfrom ndcube, atwith the inputs to that being:
and
axes_coordscomes fromself._generate_world_coords(pixel_corners, wcs)with the input being:#184 (comment)
The problem is that the sliced extra_coords wcs return nan for the world value of the 0th pixel:
where
The question is why is this happening?