Skip to content
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 units with aliases but no symbol #809

Merged
merged 2 commits into from
May 23, 2019
Merged

Conversation

Jellby
Copy link
Contributor

@Jellby Jellby commented May 16, 2019

This should fix #808. As suggested, I used _ as a placeholder for no symbol, but it could be changed.

I updated the default definitions accordingly, and noticed that the delta_ prefix was not being added to the aliases, only to the canonical name of an non-multiplicative unit, so I "fixed" this too.

Using "_" as a symbol sets symbol no None, using "_"
as an alias is ignored.

Update the default definitions file accordingly.
@hgrecco
Copy link
Owner

hgrecco commented May 23, 2019

bors r+

@hgrecco
Copy link
Owner

hgrecco commented May 23, 2019

Great! Thanks

bors bot added a commit that referenced this pull request May 23, 2019
809: Allow units with aliases but no symbol r=hgrecco a=Jellby

This should fix #808. As suggested, I used `_` as a placeholder for no symbol, but it could be changed.

I updated the default definitions accordingly, and noticed that the `delta_` prefix was not being added to the aliases, only to the canonical name of an non-multiplicative unit, so I "fixed" this too.

Co-authored-by: Jellby <jellby@yahoo.com>
@bors
Copy link
Contributor

bors bot commented May 23, 2019

Build succeeded

@bors bors bot merged commit 0f9acf7 into hgrecco:master May 23, 2019
bors bot added a commit that referenced this pull request May 25, 2019
811: Update to new SI definition and CODATA 2018 r=hgrecco a=Jellby

The SI has been redefined, by giving exact values to the Planck, Boltzmann and Avogadro constants, and the elementary charge. There are also new recommended values for other constants (CODATA 2018).

I've rewritten the `constants-en.txt` and `default-en.txt` according to these changes and also, I believe, for a better structure. The most significant changes:

* All units and constants defined from a few "experimental" values.
* For as much as I could find them, all factors are exact, except when noted. Floating point representation can introduce inaccuracies, though.
* US and imperial units may have changed their "reference" (to what I considered is most reasonable or authoritative), in practice values stay the same within floating point errors.
* Added some units and quantities.
* Fixed some units like Nm or au and parsec.
* Set the default Btu to the "ISO" Btu, and the default year to the Julian year (as recommended by the IAU)
* Defined units of the Gaussian system consistently, which makes them have different dimensionality from the corresponding SI units. Added a Gaussian context to allow conversions (with some caveats).
* Removed some units for which I could find no definition or reasonable use: chemical_faraday, physical_faraday, sidereal_hour, sidereal_minute, sidereal_second, work_year, work_month (they can of course be added back, hopefully with a better formal definition).
* Added atomic and Planck systems.
* Rearranged the order of units to "importance" (kind of) or field, rather than alphabetic.

I'm happy to undo some of the changes if they are considered undesirable. Note if/when #809 is accepted, I'd like to apply some minor fixes here.


Had to modify a couple of tests:

* For some reason (floating point errors, I guess), 4 mM -> mole/liter is no longer equal to 4e-3 M, only "almost equal".
* Updated the value of the Boltzmann constant in a test, a difference of 1.45e-5 % seems to be too much.

Co-authored-by: Jellby <jellby@yahoo.com>
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.

Define unit without symbol
2 participants