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
Separate VEGAMAG and OBMAG #331
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Codecov Report
@@ Coverage Diff @@
## master #331 +/- ##
==========================================
- Coverage 94.31% 94.29% -0.02%
==========================================
Files 14 14
Lines 2005 1999 -6
==========================================
- Hits 1891 1885 -6
Misses 114 114
Continue to review full report at Codecov.
|
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
OK, I think I can see why PHOTLAM = u.def_unit(
'photlam', u.photon / (u.cm**2 * u.s * u.AA),
format={'generic': 'PHOTLAM', 'console': 'PHOTLAM'})
_ob = u.def_unit('OB')
OBMAG = u.mag(_ob)
factor = 100 # calculate as in equivalency
equiv = [(PHOTLAM, OBMAG.physical_unit, lambda x: x*factor, lambda x: x/factor)]
(10*OBMAG).to(PHOTLAM, equivalencies=equiv)
# <Quantity 1.e-06 PHOTLAM> From a quick look, it seems that in your |
Thanks, @mhvk ! That is very helpful. 😸 |
Description
This pull request is to fix #327
This is breaking change! Unit string will change from, say,
'VEGAMAG'
to'mag(VEGA)'
. Also the behavior also changes because it is now a magnitude object, not just "plain Quantity."TODO
stsynphot
against this PR branch. See DO NOT MERGE: Test against synphot_refactor PR 331 stsynphot_refactor#162Blocked by (SOLVED)
@mhvk , I am trying to follow your advice at astropy/astropy#13158 (comment) but I am unable to get the new magnitude definitions to work with existing unit conversion equivalencies. What am I missing?
synphot_refactor/synphot/units.py
Lines 244 to 245 in bd22960
synphot_refactor/synphot/units.py
Lines 291 to 293 in bd22960
synphot_refactor/synphot/units.py
Line 128 in bd22960