Skip to content

Conversation

@MilesCranmer
Copy link
Member

@MilesCranmer MilesCranmer commented Jul 9, 2023

This PR is the continuation of #27, fixing #26.

It also now includes a symbolic dimensions object, to help with the JuMP.jl requirements: trulsf/UnitJuMP.jl#18. This means you can operate with units without needing to convert to base units, like:

julia> us"km/h"
1.0 km h⁻¹

julia> expand_units(us"km/h")  # equivalent of u"km/h"
0.2777777777777778 m s⁻¹

TODO:

  • Add back docs on units
  • Verify constants docstrings show up on documentation
  • Add docs page on symbolic dimensions
  • Enable constants with namespace collisions, equal to their expanded forms

@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2023

Benchmark Results

main e6bd940... t[main]/t[e6bd940...]
creation/Quantity(x) 3.2 ± 0.1 ns 2.9 ± 0.1 ns 1.1
creation/Quantity(x, length=y) 3.3 ± 0.1 ns 3.3 ± 0.1 ns 1
time_to_load 0.123 ± 0.0031 s 0.133 ± 0.00024 s 0.929
with_numbers/*real 2.9 ± 0.1 ns 3.3 ± 0.1 ns 0.879
with_numbers/^int 20.9 ± 1.6 ns 20.7 ± 1.4 ns 1.01
with_numbers/^int * real 21.2 ± 1.4 ns 21.3 ± 1.7 ns 0.995
with_quantity/+y 5.7 ± 0.2 ns 5.7 ± 0.2 ns 1
with_quantity//y 3.7 ± 0.1 ns 3.7 ± 0.1 ns 1
with_self/dimension 1.6 ± 0.1 ns 1.6 ± 0.1 ns 1
with_self/inv 3.3 ± 0.1 ns 3.7 ± 0.1 ns 0.892
with_self/ustrip 1.6 ± 0.1 ns 1.6 ± 0.1 ns 1

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.
Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).

@MilesCranmer
Copy link
Member Author

After merging, can add some stuff to the README about this.

@MilesCranmer MilesCranmer merged commit 7ff1ee3 into main Jul 9, 2023
@MilesCranmer MilesCranmer deleted the constants branch July 9, 2023 18:53
@MilesCranmer MilesCranmer mentioned this pull request Jul 9, 2023
MilesCranmer added a commit that referenced this pull request Jul 9, 2023
[Diff since v0.5.0](v0.5.0...v0.6.0)

**Closed issues:**
- Physical constants (#26)

**Merged pull requests:**
- Create (1) physical constants, and (2) symbolic dimensions object (#32) (@MilesCranmer)
MilesCranmer added a commit that referenced this pull request Jul 10, 2023
[Diff since v0.5.0](v0.5.0...v0.6.0)

**Closed issues:**
- Physical constants (#26)

**Merged pull requests:**
- Create (1) physical constants, and (2) symbolic dimensions object (#32) (@MilesCranmer)
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

Successfully merging this pull request may close these issues.

2 participants