astrofrog / sedfitter

Python version of the SED fitter from Robitaille et al., 2007, ApJS 169 328
http://sedfitter.readthedocs.org
BSD 2-Clause "Simplified" License
20 stars 22 forks source link

sedfitter plot function returns unit conversion error #69

Closed lkeller closed 1 year ago

lkeller commented 4 years ago

Just starting with sedfitter. Installed latest versions of the package and dependencies. Running python 3.7.6. Testing with example.py (verbatim from sedfitter/examples except for paths to data). fit function completes with no errors, but plot function dies with:

UnitConversionError: '' (dimensionless) and 'um' (length) are not convertible

Can't find the culprit. Any suggestions?

Thanks--

Full traceback:

Delete directory plots_seds? [y/[n]] y

Traceback (most recent call last):

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/astropy/units/quantity.py", line 1332, in _to_own_unit _value = value.to_value(self.unit)

AttributeError: 'numpy.ndarray' object has no attribute 'to_value'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/astropy/units/quantity.py", line 731, in to_value scale = self.unit._to(unit)

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/astropy/units/core.py", line 951, in _to f"'{self!r}' is not a scaled version of '{other!r}'")

UnitConversionError: 'Unit(dimensionless)' is not a scaled version of 'Unit("um")'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/Users/lkeller/Documents/Teaching/Research/sedfitter_example.py", line 44, in plot('output.fitinfo', 'plots_seds', plot_max=100, select_format=select_format)

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/sedfitter/plot.py", line 322, in plot lines.append(np.column_stack([s.wav, flux]))

File "<__array_function__ internals>", line 6, in column_stack

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/astropy/units/quantity.py", line 1493, in array_function return super().array_function(function, types, args, kwargs)

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/numpy/lib/shape_base.py", line 656, in column_stack return _nx.concatenate(arrays, 1)

File "<__array_function__ internals>", line 6, in concatenate

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/astropy/units/quantity.py", line 1498, in __array_function__ args, kwargs, unit, out = function_helper(*args, **kwargs)

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/astropy/units/quantity_helper/function_helpers.py", line 377, in concatenate arrays, kwargs, unit, out = _iterable_helper(*arrays, out=out, axis=axis)

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/astropy/units/quantity_helper/function_helpers.py", line 369, in _iterable_helper arrays, unit = _quantities2arrays(*args)

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/astropy/units/quantity_helper/function_helpers.py", line 350, in _quantities2arrays arrays = tuple((q._to_own_unit(arg)) for arg in args)

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/astropy/units/quantity_helper/function_helpers.py", line 350, in arrays = tuple((q._to_own_unit(arg)) for arg in args)

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/astropy/units/quantity.py", line 1339, in _to_own_unit _value = as_quantity.to_value(self.unit)

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/astropy/units/quantity.py", line 734, in to_value value = self._to_value(unit, equivalencies)

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/astropy/units/quantity.py", line 665, in _to_value equivalencies=equivalencies)

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/astropy/units/core.py", line 987, in to return self._get_converter(other, equivalencies=equivalencies)(value)

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/astropy/units/core.py", line 918, in _get_converter raise exc

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/astropy/units/core.py", line 904, in _get_converter self, other, self._normalize_equivalencies(equivalencies))

File "/Users/lkeller/opt/anaconda3/lib/python3.7/site-packages/astropy/units/core.py", line 888, in _apply_equivalencies unit_str, other_str))

UnitConversionError: '' (dimensionless) and 'um' (length) are not convertible

astrofrog commented 1 year ago

This should be fixed in main and will be in a release shortly