You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't compose units from equivalent units that have prefixes #4104
So not really a bug. But I'm tempted to say that if the units list explicitly contains prefix units (suggesting that I explicitly wanted them), include_prefix_units should be automatic. But my suspicion is that there were internal reasons (such as passing in the si module as an argument?) for filtering out prefix units by default.
Maybe instead it should only filter out prefix units if that unit's base unit was included.
Looking at old units issues, I'm slightly torn about this one. There is an argument to be made that if you put in a specific set of units, that is what should be used. Of course, all that is needed is to do something like:
if include_prefix_units is None:
include_prefix_units = units is not None
Anyone who is interested in having this should feel free to submit a PR.
I will continue to research, I am still very new to astropy. This is/was going to be my first project! Please let me know if there is a way to address this or what code I should study. I am still happy that I got all the github steps working. I am hoping to pick up another task during the holidays!
I made changes so that if the unit specified is a list or a tuple (and not a module etc.), then include_prefix_units is turned to True. As suspected by @embray , this was originally causing a problem when the input unit was a module such as u.cgs.
Activity
embray commentedon Aug 28, 2015
Nevermind, I didn't notice the
include_prefix_unitsargument:So not really a bug. But I'm tempted to say that if the
unitslist explicitly contains prefix units (suggesting that I explicitly wanted them),include_prefix_unitsshould be automatic. But my suspicion is that there were internal reasons (such as passing in thesimodule as an argument?) for filtering out prefix units by default.Maybe instead it should only filter out prefix units if that unit's base unit was included.
mhvk commentedon Aug 11, 2016
Looking at old units issues, I'm slightly torn about this one. There is an argument to be made that if you put in a specific set of units, that is what should be used. Of course, all that is needed is to do something like:
Anyone who is interested in having this should feel free to submit a PR.
Bugfix for issue astropy#4104
fastakash commentedon Dec 10, 2017
@mhvk I made the change as you suggested and initially thought the test failure I was seeing was not related to my change!
Before the change:
After the change:
I will continue to research, I am still very new to astropy. This is/was going to be my first project! Please let me know if there is a way to address this or what code I should study. I am still happy that I got all the github steps working. I am hoping to pick up another task during the holidays!
fastakash commentedon Dec 16, 2017
I made changes so that if the unit specified is a list or a tuple (and not a module etc.), then include_prefix_units is turned to True. As suspected by @embray , this was originally causing a problem when the input unit was a module such as u.cgs.
I hope you can review/comment!
Bugfix for issue astropy#4104