astropy / astropy/astropy

Logarithmic quantities should support some ufuncs

Open
#6,897 9 comments 0 reactions 0 assignees View on GitHub
Bug Package-expert units
Dominant language
Python
Stars
5.3k
Forks
2.2k
Avg merge
1d 18h
Merged PRs (30d)
74

Description

Currently,
```
lq = [2,3,4,5]*u.STmag
lq - lq
#
np.subtract(lq, lq)
# UnitConversionError: Can only apply 'subtract' function to quantities with compatible dimensions
np.minimum(lq, lq)
# UnitConversionError: Can only apply 'minimum' function to quantities with compatible dimensions
```
A combination of the helper functions not working for logarithmic units, and the wrong helper functions being used.

Contributor guide

Open the contributing guide

Research direction

Reproduce the documented examples with logarithmic quantities and compare operator subtraction with np.subtract and np.minimum. Inspect Astropy's logarithmic-unit ufunc helper functions and determine which helpers are used for these operations; done means the NumPy ufunc calls produce compatible results instead of UnitConversionError.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.