Hello fellow astro Julians.

I’ve finally gotten around to polishing up a package that I’ve wanted to have for a very long time. That is, a units package that includes a bunch of the crazy astronomy units that we’ve come to rely on.

Unitful v0.1.0 made it possible to create packages that extend Unitful with additional units, so we can build on Unitful to provide astronomy units without polluting everybody else’s namespace with Mpc, Gyr, Jy, Msun, etc.

Unitful v0.4.0, which is on the horizon, will add support for logarithmic units. Then we can start to think about also providing units for magnitudes and metallicities, but that’s not here yet.

So I present UnitfulAstro.jl in its current state. You can find the list of available units in the docs or the Github readme. I would really like this package, or something similar, to be used across the Julia astronomy ecosystem, and therefore I’d love to hear any comments or feedback before I go to register this package.

Should UnitfulAstro.jl be moved to the JuliaAstro organization?
Am I missing any units that you would like to have?
Do you also think magnitudes per square arcsecond is the silliest unit you’ve ever seen?

Let me know!

Documentation: http://juliaastro.github.io/UnitfulAstro.jl/latest/
Github: https://github.com/JuliaAstro/UnitfulAstro.jl

Edit (9/22): Updated links after the repository was transferred to JuliaAstro.


I really like the idea!

I think all important units are already there, if I remember other relevant units I’ll open an issue :wink:

I personally believe this could be a useful addition to the organization, so we can use a single package for all units-related stuff.

Also @kbarbary may want to chime in.


Very cool!
If you find it useful and it makes your life easier, consider incorporating UnitfulAngles.jl for everything angle-related in your package. If there are any angles missing, PR any changes you’d like to see!


SFU (solar flux unit) would be nice, 1 SFU = 10^−19 erg s^−1 cm^−2 Hz^−1


I think I was under the impression that UnitfulAngles, was defining 1 turn == 1, instead of 1 rad == 1, which is why I shied away from the package, but I see that this isn’t the case. I think UnitfulAstro could definitely import arcminute, arcsecond, and hourAngle from UnitfulAngles.



Yea, we argued about that, but it all stemmed from a misunderstanding on my part. It’s all good now :stuck_out_tongue:


I pushed: https://github.com/mweastwood/UnitfulAstro.jl/commit/a02c3e87ec4bb2571b2d8a53d6ce533499d91dd6

It would be kind of nice if arcminutes and arcseconds were defined based on degrees instead of turns. This makes the common conversion to/from degrees exact.


I’d support bringing this under the JuliaAstro organization, if @Michael_Eastwood wants to!


Done. Let me know if it’s all good.


Alright, let’s do it!

Looks good to me at first glance, thanks!