Repository navigation
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.
I have no idea what "ch" and "lea" are, comments after each case would be helpful
|
Requesting @philippjfr since this is a CZI task |
philippjfr
left a comment
There was a problem hiding this comment.
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
* Allow users to provide custom units of measurement * Validate ScaleBar.unit against ScaleBar.dimensional * Make sure validator functions start with '_check' * Adapt to DictLike type * Allow to generate defaults' baseline * Add unit tests for ScaleBar * Shift basis computation to bokehjs * Add visual integration tests * Update tests and emphasis in the documentation * Properly encode escape sequences with json5 * Allow to define long unit names * Update docstrings * Add basic/annotations/scale_bar_custom_units.py
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The original implementation of
ScaleBarin PR #13319 didn't allow for easy definition of any other units of measurement than metric length. This PR addresses that issue by makingMetricmodel non-abstract and thus allowing e.g.Metric(base_unit="eV")units.MetricLengthmodel 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