Repository navigation
Add DN as new unit - #11591
Add DN as new unit#11591
Conversation
mhvk
left a comment
There was a problem hiding this comment.
👍 in general, but a question about whether the unit should just be on its own, and whether prefixes are warranted.
| # EVENTS | ||
|
|
||
| def_unit((['ct', 'count'], ['count']), | ||
| def_unit((['ct', 'count', 'DN'], ['count']), |
There was a problem hiding this comment.
👍 to adding DN. One question, though: should it really be the same as count? Or might it be better as an alias of adu (see below) or just be its own unit?
One reason I ask is that to me prefixes (like milliDN) do not really make sense, but for count` we're stuck with having them (which I think is a bit of a mistake, but too late to fix!).
There was a problem hiding this comment.
Good question! I don't have a strong opinion. Generally DN is synonymous with counts in my experience. I think probably adu should be the same. It is a count. Same unit, different name. Any reason they are different units in astropy? Am I opening a can of worms? 😅
Agree prefixes don't make sense.
There was a problem hiding this comment.
Oh, and I see you can have millicounts but not picocounts? And I see why (%). 🤯
Would be nice to put that horse back into the stable. 😂
Anyway, if DN was on its own as a unit, could it least have an equivalency to u.ct and u.adu? That would seem useful. I see that currently u.ct != u.adu.
There was a problem hiding this comment.
Yes, I was wondering about removing the prefixes and seeing if anyone notices...
There was a problem hiding this comment.
👍 for removing stupid prefixes. Maybe after a qiuck search on github for u.milicounts ;-)
|
(Taking this out of the code review since perhaps a discussion that should not be just "resolved away") On equivalencies and/or whether the units should be the same, I'd be more inclined to go the equivalency route, since at least to me As for equivalencies, right now it is not easy for units to have built-in equivalencies (though it is possible; it is used for the magnitude units, and have been meaning to extend that, if only for Celsius and Fahrenheit). It would of course be quite easy to add an equivalency for all of them, say, |
|
p.s. Just to be sure that we don't let the discussion prevent a simple addition: for now, we could just stick with a simple addition of DN as its own unit (without prefixes!). |
That seems like a good solution to me. I'll update this PR. Thanks for the discussion and example Would both "dn" and "DN" be useful mnemonics for what should be the base |
|
FWIW I don't think DN is the same as count. Even among HST instruments, that is not always true ("count" could be e/s!). Yes to no prefix to DN. Removing prefix for count should be a separate PR. |
|
I think having both |
|
While, |
| @@ -0,0 +1 @@ | |||
| Add a new "DN" unit, ``units.dn``, representing digital number. | |||
There was a problem hiding this comment.
| Add a new "DN" unit, ``units.dn``, representing digital number. | |
| Add a new "DN" unit, ``units.dn`` or ``units.DN``, representing digital number for a detector. |
|
Note to reviewer: If you don't think we need What's New entry for this, please remove the label, thanks! |
31245e1 to
cd10efd
Compare
mhvk
left a comment
There was a problem hiding this comment.
Looks good now! Would you mind terribly squashing the commits together? (I can do it too if you prefer)
cd10efd to
023a1ed
Compare
|
Super, thanks! Will now merge. |
Description
This pull request adds the name "DN" as a string that can generate a count unit,
u.ct. "DN", or digital number, is a common name used for counts in the FITS header keyword BUNIT and in FITS binary table column units. In fact, an example in the existing Astropy documentation has this unithttps://docs.astropy.org/en/stable/io/fits/usage/table.html?highlight=DN
but that unit doesn't currently parse into a
u.ct. This PR enables that.