Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sedfitter plot function returns unit conversion error #69

Closed
lkeller opened this issue Jun 7, 2020 · 1 comment
Closed

sedfitter plot function returns unit conversion error #69

lkeller opened this issue Jun 7, 2020 · 1 comment

Comments

@lkeller
Copy link

lkeller commented Jun 7, 2020

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants