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
Allow users to provide custom units of measurement #13625
Allow users to provide custom units of measurement #13625
Conversation
1c59f13
to
e969f3d
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## branch-3.4 #13625 +/- ##
==============================================
- Coverage 92.57% 92.18% -0.39%
==============================================
Files 323 323
Lines 20534 20575 +41
==============================================
- Hits 19009 18968 -41
- Misses 1525 1607 +82 |
e969f3d
to
9ca5f3a
Compare
This is tentatively ready, but there are some unrelated technical issues to resolve, e.g.:
which is an effect of bad encoding of imported files in JS bundles. |
"fur": ( 660, "fur"), | ||
"mi": ( 5280, "mi" ), | ||
"lea": (15840, "lea"), | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea what "ch" and "lea" are, comments after each case would be helpful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting @philippjfr since this is a CZI task |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! My only comment would be a request for adding an example to the docs, the eV example seems fine.
I second the request for docs with an example/explanation. Also, is there a way to have the scale bar length stay consistent while zooming and only have the numbers change? Currently, both the length of the bar and the numbers are changing. This might need a way to format the number string to specify the number of decimal places displayed. Also, does this work for a unit with multiple parts. For example, fT/cm is commonly used as a unit for gradiometers that record spatial derivatives of magnetic fields. In such a case, if a user zooms on the y-axis, we would only want the T part of the unit to scale up or down. Is that configurable? I suppose being able to format the number string to just add '/cm' would suffice. |
537d24a
to
e3528f5
Compare
Use |
Use |
I suppose one could use |
e3528f5
to
405966b
Compare
405966b
to
1cfad03
Compare
The original implementation of
ScaleBar
in PR #13319 didn't allow for easy definition of any other units of measurement than metric length. This PR addresses that issue by makingMetric
model non-abstract and thus allowing e.g.Metric(base_unit="eV")
units.MetricLength
model is preserved and additional models for generic reciprocal, imperial length and angular units of measurement are added.Example:
Screencast.from.16.01.2024.17.09.40.webm