On Mar 20, 10:31 pm, Jason Grout <jason-s...@creativetrax.com> wrote: > Maurizio wrote: > > Not yet... I think I was previously asking whether some of you guys > > are interested in trying to contact them, if you do think it does > > makes sense. > > > I mean, if this community is interested in having this feature, the > > Quantities developers are going to find some good feedback, otherwise, > > we could just probably end up losing a good occasion, because things > > are not ready yet (although I hope that's not the case)! > > I think there are a good number of people now that would like to have > the feature, and as you well know, there are lots and *lots* of future > users that would like to have the functionality. > > I'd say it's time to contact them and see if they can help. If there > needs to be changes made to Quantities, then making them now, while it > is still solidifying, would be advantageous.
Hello, I am Darren Dale, the developer of Quantities. Thank you Maurizio for contacting me. I would like to request that discussions concerning Quantities on this list also be sent to my gmail account. My work will keep me very busy for the next 10 weeks, and since it seems this list gets a fair amount of traffic and I am not yet a sage user, I would prefer not to follow the list too closely, at least for now. Let me explain my background and that of quantities. I am a scientist at the Cornell High Energy Syncrotron Source (CHESS), and have been a developer on the matplotlib project for several years. I have been interested in having a units package for python for a long time. I have considered all the units packages discussed so far in this thread, but did not find one that suited my needs. I make heavy use of numpy arrays for my work, and wanted a numpy subclass that handled physical quantities. It has taken several iterations but I finally found an appropriate abstraction for such a package. Quantities is already in pretty good shape, in large part because it does not try to do too much. I am currently trying to improve Quantities interaction with numpy's builtin functions, however, I have run into some limitations in numpy, mainly in the implementation of ufuncs. If you are interested, please search the numpy archives for my name. I have suggested on that list how things could be improved, but the devs are busy preparing to release numpy-1.3. I will try to engage them again after 1.3 is out. I have been spending most of my effort on Quantities recently improving the unit tests. This uncovered a few bugs in numpy that have been fixed in time for the 1.3 release. If you run pq.test() with numpy-1.2, you will encounter errors that have been fixed in 1.3. I would be willing to consider how quantities can be improved so it can be used in the sage environment, but it sounds like there are some existing issues with the interaction of sage types and numpy arrays which need to be worked out first. Have I understood correctly? I have been meaning to change addition/subtraction in Quantities to allow things like m+cm without explicitly rescaling one of the operands. I will change it so the result has the same units as the left operand. I am not interested implementing the feature proposed in post #16 in this thread. Dealing with physical quantities can be somewhat thorny, because there are lots of use cases and everybody seems to have their own ideas about how it should behave. Case in point, the proposal in post #16 would keep units the way you like them for scalars, but it would create additional overhead in cases like 1m-0.999999m. In that case, I guess the proposed behavior would be to yield 1um as the result, which means quantities would have to a) determine the appropriate final unit and b) would have to perform additional arithmetic. Quantities is not really designed to handle item a. I've tried to keep the package as simple as possible in order to keep the problem tractable in my limited free time. Item b would be unacceptable to those concerned about speed. Automatically rescaling the result becomes more complicated with arrays, since you would then have to inspect the min, max or mean in order to determine how to rescale the output, and there are plenty of compound operations sqrt(x +y**3/(...)...) where the user would only be interested in rescaling the final result, not the result of each individual step of arithmetic. There are plenty of examples, like operations involving constants for quantum mechanics or astrophysics, where the user wants the result in the units specified by the constants. I guess the question I have for this list is, what would be required for quantities to work in sage? I would prefer to try to work out the numpy issues I alluded to before quantities gets too much exposure, in case changes in API are required (unlikely). Darren --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---