Skip to content

Add uconvert and chemistry example #48

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 20 commits into from
Oct 14, 2023

Conversation

gaurav-arya
Copy link
Collaborator

@gaurav-arya gaurav-arya commented Sep 23, 2023

I was doing my chemistry homework using DynamicQuantities.jl, and thought it might make for a nice docs example! This is on top of #47, making the diff a bit noisier.

Edit: This PR now also implements uconvert, see #48 (comment).

@github-actions
Copy link
Contributor

github-actions bot commented Sep 23, 2023

Benchmark Results

main 4c34768... t[main]/t[4c34768...]
Quantity/creation/Quantity(x) 3.1 ± 0.1 ns 3.4 ± 0 ns 0.912
Quantity/creation/Quantity(x, length=y) 3.4 ± 0 ns 3.7 ± 0 ns 0.919
Quantity/with_numbers/*real 3.4 ± 0 ns 3.4 ± 0 ns 1
Quantity/with_numbers/^int 11.2 ± 3.4 ns 11.5 ± 4.1 ns 0.974
Quantity/with_numbers/^int * real 11.8 ± 3.9 ns 12.1 ± 4.3 ns 0.975
Quantity/with_quantity/+y 7.7 ± 0.001 ns 6.8 ± 0.1 ns 1.13
Quantity/with_quantity//y 4 ± 0 ns 3.7 ± 0.1 ns 1.08
Quantity/with_self/dimension 1.7 ± 0 ns 1.7 ± 0 ns 1
Quantity/with_self/inv 3.4 ± 0 ns 3.7 ± 0 ns 0.919
Quantity/with_self/ustrip 1.7 ± 0 ns 1.7 ± 0 ns 1
QuantityArray/broadcasting/multi_array_of_quantities 0.226 ± 0.025 ms 0.226 ± 0.025 ms 1
QuantityArray/broadcasting/multi_normal_array 0.0782 ± 0.005 ms 0.0762 ± 0.0018 ms 1.03
QuantityArray/broadcasting/multi_quantity_array 0.255 ± 0.0014 ms 0.255 ± 0.0013 ms 0.999
QuantityArray/broadcasting/x^2_array_of_quantities 0.0421 ± 0.0035 ms 0.0434 ± 0.0031 ms 0.97
QuantityArray/broadcasting/x^2_normal_array 9.1 ± 1.8 μs 9.3 ± 1.8 μs 0.979
QuantityArray/broadcasting/x^2_quantity_array 10 ± 1.1 μs 10 ± 1.2 μs 1
QuantityArray/broadcasting/x^4_array_of_quantities 0.133 ± 0.0035 ms 0.136 ± 0.0058 ms 0.979
QuantityArray/broadcasting/x^4_normal_array 0.0688 ± 0.0008 ms 0.0692 ± 0.0014 ms 0.994
QuantityArray/broadcasting/x^4_quantity_array 0.0981 ± 0.0028 ms 0.103 ± 0.0015 ms 0.95
time_to_load 0.169 ± 0.0017 s 0.169 ± 0.0021 s 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).

- Motive: for consistency with Unitful
- Also, we make the first argument the symbolic quantity
Copy link
Collaborator Author

@gaurav-arya gaurav-arya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove string method

@MilesCranmer MilesCranmer changed the title Add chemistry homework example Add uconvert and chemistry example Oct 14, 2023
Copy link
Member

@MilesCranmer MilesCranmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Great work @gaurav-arya!!

@MilesCranmer MilesCranmer merged commit 0c665e2 into SymbolicML:main Oct 14, 2023
MilesCranmer added a commit that referenced this pull request Oct 16, 2023
[Diff since v0.7.3](v0.7.3...v0.7.4)

**Merged pull requests:**
- Add `uconvert` and chemistry example (#48) (@gaurav-arya)
- Add `uconvert` method for `QuantityArray` (#61) (@MilesCranmer)
- Deprecate `expand_units` -> `uexpand` (#62) (@MilesCranmer)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants