<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 2, 2017 at 8:46 AM, <span dir="ltr"><<a href="mailto:josef.pktd@gmail.com" target="_blank">josef.pktd@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="gmail-">On Wed, Nov 1, 2017 at 6:55 PM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I think the biggest issues could be resolved if __array_concatenate__ were finished. Unfortunately I don't feel like I can take that on right now.<br><br></div>See Ryan May's talk at scipy about using an ndarray subclass for units and the issues he's run into:<br><br><a href="https://www.youtube.com/watch?v=qCo9bkT9sow" target="_blank">https://www.youtube.com/watch?<wbr>v=qCo9bkT9sow</a></div></blockquote><div><br></div><div><br></div></span><div>Interesting talk, but I don't see how general library code should know what units the output has.</div><div>for example if units are some flows per unit of time and we average, sum or integrate over time, then what are the new units? (e.g. pandas time aggregation)</div><div>What are units of covariance or correlation between two variables with the same units, and what are they between variables with different units?</div><div><br></div><div>How do you concatenate and operate arrays with different units?</div><div><br></div><div>interpolation or prediction would work with using the existing units.</div><div><br></div><div>partially related:</div><div>statsmodels uses a wrapper for pandas Series and DataFrames and tries to preserve the index when possible and make up a new DataFrame or Series if the existing index doesn't apply.</div><div>E.g. predicted values and residuals are in terms of the original provided index, and could also get original units assigned. That would also be possible with prediction confidence intervals. But for the rest, see above.</div></div></div></div></blockquote><div><br></div><div>using pint</div><div><br></div><div><div>>>> x</div><div><Quantity([0 1 2 3 4], 'meter')></div></div><div><div>>>> x / x</div><div><Quantity([ nan 1. 1. 1. 1.], 'dimensionless')></div><div><br></div><div>>>> x / (1 + x)</div><div>Traceback (most recent call last):</div><div> File "<stdin>", line 1, in <module></div><div> File "C:\...\python-3.4.4.amd64\lib\site-packages\pint\quantity.py", line 669, in __add__</div><div> raise DimensionalityError(self._units, 'dimensionless')</div><div> return self._add_sub(other, operator.add)</div><div> File "C:\...\python-3.4.4.amd64\lib\site-packages\pint\quantity.py", line 580, in _add_sub</div><div>pint.errors.DimensionalityError: Cannot convert from 'meter' to 'dimensionless'</div><div><br></div><div>np.exp(x) </div><div>raises<br></div><div>pint.errors.DimensionalityError: Cannot convert from 'meter' ([length]) to 'dimensionless' (dimensionless)<br></div><div><br></div><div><br></div><div>Josef<br></div></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="gmail-HOEnZb"><font color="#888888"><div><br></div><div>Josef</div></font></span><span class="gmail-"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br></div><div class="gmail-m_-2325588783691903944HOEnZb"><div class="gmail-m_-2325588783691903944h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 1, 2017 at 5:50 PM, Marten van Kerkwijk <span dir="ltr"><<a href="mailto:m.h.vankerkwijk@gmail.com" target="_blank">m.h.vankerkwijk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From my experience with Quantity, routines that properly ducktype work<br>
well, those that feel the need to accept list and blatantly do<br>
`asarray` do not - even if in many cases they would have worked if<br>
they used `asanyarray`... But there are lots of nice surprises, with,<br>
e.g., `np.fft.fftfreq` just working as one would hope. Anyway, bottom<br>
line, I think you should let this stop you from trying only if you<br>
know something important does not work. -- Marten<br>
<div class="gmail-m_-2325588783691903944m_-3775220417982547320HOEnZb"><div class="gmail-m_-2325588783691903944m_-3775220417982547320h5">______________________________<wbr>_________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/numpy-discussion</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/numpy-discussion</a><br>
<br></blockquote></span></div><br></div></div>
</blockquote></div><br></div></div>