Re: [typhon] pint dependencies

2016-09-19 Thread Gerrit Holl
Hi,

On 19 September 2016 at 15:34, Lukas Kluft  wrote:
> I committed the necessary changes to our package structure. Hopefully all
> imports are fixed by now (tests and doc build work fine).
> Even though the file structure changed quite a bit all code under
> typhon.physics.units is still available with this very import. Only
> typhon.physics.em moved to typhon.physics.units.em.
> My last commit also contains a first idea on how said wrapper functions
> could look like. But I am open for suggested improvements as I am unfamiliar
> with pint.

It looks good.

I wonder if we could dynamically generate such wrapper functions with
a clever use of function annotations, probably Pythons most
underutilised language feature.  I have a feeling I might benefit from
the typing module but I don't really know very well how I should use
it.

Gerrit.
___
typhon.mi mailing list
typhon.mi@lists.uni-hamburg.de
https://mailman.rrz.uni-hamburg.de/mailman/listinfo/typhon.mi


Re: [typhon] pint dependencies

2016-09-19 Thread Lukas Kluft
Hey,

I committed the necessary changes to our package structure. Hopefully all
imports are fixed by now (tests and doc build work fine).
Even though the file structure changed quite a bit all code under
typhon.physics.units is still available with this very import. Only
typhon.physics.em moved to typhon.physics.units.em.
My last commit also contains a first idea on how said wrapper functions
could look like. But I am open for suggested improvements as I am
unfamiliar with pint.

/Lukas

2016-09-19 12:55 GMT+02:00 Gerrit Holl :

> Hi,
>
> On 19 September 2016 at 07:23, Oliver Lemke 
> wrote:
>
> > Lukas and me had a discussion on how to handle the functions that
> require pint. We would like to turn the units/pint functionality into a
> subpackage of physics. The idea is that all functions directly under
> physics are operating on SI units without any pint dependency. Functions
> that do support units should go into the units subpackage. For functions in
> physics, small wrapper functions can be added in the units subpackage that
> use pint to convert the inputs to SI units and then call the plain function
> from the physics package. Is that ok with you?
>
> That makes a lot of sense.  Specifically, I think when we say "SI
> units" we mean "base SI units", which is good for consistency even
> though it's sometimes unusual (for example, g/mol is more common than
> kg/mol).  How do you want to handle functions/classes outside the
> physics/ subpackage?  My HIRS reading routine by defaults uses base SI
> frequency radiance [W / sr / m² / Hz], but this is very unusual and
> confused two colleagues already, so I added an option to return what
> everybody else uses, [W / sr / m² / cm^-1]; I use pint to convert
> between the two (a third alternative would be [W / sr / m], likely to
> confuse equally if not more).
>
> Gerrit.
> ___
> typhon.mi mailing list
> typhon.mi@lists.uni-hamburg.de
> https://mailman.rrz.uni-hamburg.de/mailman/listinfo/typhon.mi
>
___
typhon.mi mailing list
typhon.mi@lists.uni-hamburg.de
https://mailman.rrz.uni-hamburg.de/mailman/listinfo/typhon.mi