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

The as conflicts with Unitful's attoseconds #30

Closed
cmichelenstrofer opened this issue Apr 30, 2022 · 5 comments
Closed

The as conflicts with Unitful's attoseconds #30

cmichelenstrofer opened this issue Apr 30, 2022 · 5 comments

Comments

@cmichelenstrofer
Copy link
Collaborator

cmichelenstrofer commented Apr 30, 2022

#28 added as as an alias for arcsecond that allows prefixes. This however conflicts with seconds * 10^-18 (attoseconds, as).

julia> using Unitful

julia> using UnitfulAngles

julia> 1u"as"
┌ Warning: Symbol as was found in multiple registered unit modules.
│ We will use the one from UnitfulAngles.
└ @ Unitful ~/.julia/packages/Unitful/SUQzL/src/user.jl:715
1 as

help?> Unitful.as
  Unitful.as


  A prefixed unit, equal to 10^-18 s.

  Dimension: 𝐓

  See also: Unitful.s.
''''
@aplavin
Copy link
Collaborator

aplavin commented Apr 30, 2022

Curious what the solution could be.
mas and μas are widely used in astronomy, but I don't think I ever saw as without prefixes anywhere. Can we allow prefixed use only?

@cmichelenstrofer
Copy link
Collaborator Author

I was wondering what the use case was! I did not know it was common to use SI prefixes on arcseconds! It seems that the two prefixes you mention are the only ones commonly used. I can think of two options

Option 1: Allow the arcsecond (and possibly the arcminute for consistency) to have prefixes. This has the advantage of not duplicating the arcsecond unit (currently: one that can be prefixed and one that can't). It also has the advantage that the changes would be propagated to UnitfulAstro.jl which already imports arcsecond and arcminute from UnitfulAngles. One downside is that typing

julia> 1μarcsecond
1 μ″

is a bit awkward. Another downside is that the units are displayed as μ″ rather than the more common μas. Users could redefine inside their own code as μas = μarcsecond, which would solve the first issue but not the second.

Option 2: Define the two common prefixed versions as their own units. The package would include all the units in this table. It would not allow for general prefixing of the arcsecond or arcminute, but this does not seem to be common anyways. Line 46 in UnitfulAstro.jl

import UnitfulAngles: arcminute, arcsecond

would need to be modified to include these new units.

@cmichelenstrofer
Copy link
Collaborator Author

cmichelenstrofer commented Apr 30, 2022

I would prefer option 2. It would look something like:

@unit mas    "mas"    Milliarcsecond    Arcsecond//1_000        false 
@unit μas    "μas"    Microarcsecond    Arcsecond//1_000_000    false 

@cmichelenstrofer
Copy link
Collaborator Author

Note however that this table does not include symbols for these two units, only abbreviations. I'm not sure what that's about.

@cmichelenstrofer
Copy link
Collaborator Author

das is also problematic (deciarcsecond vs decasecond)

@cmichelenstrofer cmichelenstrofer changed the title The as conflicts with Unitful's atto seconds The as conflicts with Unitful's attoseconds May 4, 2022
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