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
create or adapt or include a units package #3852
Comments
comment:1
Okay, so that was four projects! |
comment:3
yet another project recently started: |
comment:5
Attachment: trac_3852.patch.gz FIRST REFEREE REPORT on trac_3852.patch:
The actual failures:
|
comment:6
Google also turns up this existing module: http://www.inference.phy.cam.ac.uk/dimpy/ |
comment:7
dimpy helped me with my e&m hw. positive review :) |
comment:8
Do you mean that tongue-in-cheek, or do you mean that you've gone through and made sure all of the objections above were taken care of? |
comment:9
my apologies, I hadn't properly read the issue, much less the patch, and I meant to retract the post. I was actually referring to the dimpy module, not the patch above, and it was definitely tongue-in-cheek. Upon further investigation I found that dimpy doesn't integrate well with sage's types system. I've now read the patch and will try to find time to run the tests. |
This comment has been minimized.
This comment has been minimized.
Attachment: trac_3852-part2.patch.gz |
comment:13
Attachment: trac_3852-part3.patch.gz Hm, it is not easy to find out what units() is actually supposed to be used for.. File: /Users/sschym/Programs/sage/local/lib/python2.6/site-packages/sage/symbolic/units.py Type: <type ‘instance’> Definition: units( [noargspec] ) Docstring:
I could not find anything useful in the documentation, either. Do I have to compile the documentation separately? Cheers |
comment:14
All three patches still apply fine to sage-4.3.5. |
comment:15
I'm working on reviewing this and noticed that much of the part2 and part3 patches is simply removing tabs and doing minor whitespace fixups. The three main patches leave some tabs in the relevant files, so I fixed that up. Hooray for emacs' untabify. attachment: trac_3852_fix_whitespace.patch is big but makes no functional changes. |
comment:16
Some questions and comments: In A minor point: the string representation of collections of units uses strange/incorrect grammar. "Collection area of units" sounds like units do collecting in a certain area. I think "Collection of units of area" is better. How about something like
in the In the descriptions of the mass units, the solar mass refers to the size of the earth -- but you mean the mass of the earth. Size is length, area, or volume; different units! Perhaps we should include "metre" and "litre" as synonyms; it seems that the official spelling, according to the SI Brochure, is "metre", and that's a common spelling anyway. The liter/litre isn't an official SI unit, but it is frequently spelled as litre, so might as well put in both. This would also allow non-Americans putting units into their LaTeX documents to get correctly-spelled units. This module should get added to the reference manual (perhaps we can do that in another ticket), and a bunch of little bits in the docstrings need to be fixed up. One suggestion: change the title at the very top of units.py to "Units of measurement" to avoid confusion with multiplicatively invertible elements of a ring. Line 600 or so: I would find it much less confusing if ton_force was described with "Defined to be 2000 pounds of force". In line 685: the documentation for candela has some goofy stuff near the end. According to the official brochure, you need "1/683 watt per steradian". Overall, I think this is a great addition to Sage. The code is pretty simple, works well, and is thoroughly doctested. Once the above issues are addressed, this can get a positive review. I can whip up a patch making the above changes, or can review someone else's patch. |
comment:17
One more comment:
|
Author: David Ackerman, William Stein |
comment:18
attachment: trac_3852_referee.patch adds the units module to the reference manual and makes some minor changes to docstrings. It doesn't change any code. I'm marking this as "needs review"; if someone could look over my referee patch, we can give this entire ticket a positive review. |
Reviewer: Dan Drake |
comment:19
Thanks for pushing this ticket closer to the finish Dan. Though I don't think fixing the whitespace problems of
I don't think rebasing the patch on the other changes is worth it. We should either have an understanding that this ticket is merged after all the other actual bug fixes, and the failures in applying this patch are ignored, or change this patch to fix only the relevant sections of the file. (Actually, I wouldn't mind if this was a general policy on whitespace fixes.) Otherwise, I'm willing to give Dan's changes and this ticket a positive review. |
comment:20
Replying to @burcin:
I see. If the big whitespace patch messes up a bunch of other patches, then we should postpone it. I'll take out the hunks that affect expression.pyx, and confine all the changes to units.py, since I don't think there are any other tickets that depend on this one. I would like to see some tab/whitespace cleanup -- there are (again) tons of tabs in the Sage library. I understand that coordinating this sort of thing is difficult, though. |
Attachment: trac_3852_fix_whitespace.patch.gz remove tabs, trailing whitespace from units.py |
Attachment: trac_3852_referee.patch.gz |
comment:21
The new fix_whitespace patch only affects units.py, and the referee patch only touches the convert() function in expression.pyx. Burcin, do these patches play nicely with the other symbolics tickets? |
comment:22
Replying to @dandrake:
I definitely give that referee patch a positive review. Very nice! It's going to be great getting this code into Sage. |
comment:23
The new white space fix patch (attachment:trac_3852_fix_whitespace.patch) applies cleanly, and all tests pass. I give a positive review to the referee patch (attachment:trac_3852_referee.patch). Thanks a lot for fixing this Dan! Patches to be applied are: |
comment:24
Merged in 4.4.alpha0:
(I think these patches cause some warning when building the reference manual. Those can be fixed on a follow-up ticket.) |
Merged: sage-4.4.alpha0 |
See this sage-wiki page for some ideas.
Here are three possibilities:
It looks like this package is part of an actively maintained library, ScientificPython (http://dirac.cnrs-orleans.fr/plone/software/scientificpython/). Here is a link for a printing package for this module: http://python.net/crew/bhoel/PyLaTeX-0.2/html/PyLaTeX.UnitPrint.html
It looks like this package is dead; last release was in 2005. It is GPL.
The Pyre units package (http://www.cacr.caltech.edu/projects/pyre/). This was last updated in 2005, I think (you have to check out pythia 0.8).
The enthought units package (which is apparently based on the pyre package), as well as the blockcanvas unit functions.
A thread about adding a units package to scipy: http://projects.scipy.org/pipermail/scipy-user/2005-March/004263.html
Another thread: http://aspn.activestate.com/ASPN/Mail/Message/scipy-user/3176352
Another page in a book mentioning two packages: http://books.google.com/books?id=j7QbD83-h8AC&pg=PA157&lpg=PA157&dq=python+physicalquantities&source=web&ots=C-JZyCFWn2&sig=x62bQ0jWyQerBGAvgJOBQuMQeWM&hl=en&sa=X&oi=book_result&resnum=10&ct=result
A recent (July 2008!) trac ticket about the enthought units package: https://svn.enthought.com/enthought/ticket/1524 Related checkins seem to include: https://svn.enthought.com/enthought/changeset/21093
Apparently the enthought units code is undergoing refactorization. See https://mail.enthought.com/pipermail/enthought-dev/2008-July/015717.html
I'd say we ought to keep our eye (or help out with) the enthought package refactorization.
Component: basic arithmetic
Author: David Ackerman, William Stein
Reviewer: Dan Drake
Merged: sage-4.4.alpha0
Issue created by migration from https://trac.sagemath.org/ticket/3852
The text was updated successfully, but these errors were encountered: