summaryrefslogtreecommitdiff
path: root/pint/numpy_func.py
Commit message (Collapse)AuthorAgeFilesLines
* Create NumPy FacetHernan2022-05-071-936/+0
|
* Moved Unit and Quantity to plain facetHernan2022-05-071-2/+2
| | | | | | Note: the word 'plain' was chosen instead of 'base' as BaseUnit or BaseQuantity as the latter might be interpreted physically and not a part of the class hierarchy as intented.
* Run new stable black versionJules Chéron2022-03-301-8/+8
|
* implement `numpy.nanprod` (#1369)keewis2022-02-021-25/+40
| | | | | | | * add tests for nanprod * fix the exponent for nanprod * use `helpers.assert_quantity_equal` instead of `self.assertQuantityEqual` * add a entry to `CHANGES`
* fix typoKeewis2021-03-031-1/+1
|
* provide a default to also work with earlier numpy versionsKeewis2021-03-031-3/+5
|
* implement lib.stride_tricks.sliding_window_viewKeewis2021-03-031-1/+8
|
* Fix numpy.linalg.solve units output.Jules Chéron2021-02-161-2/+12
| | | | | | | | | | Update get_op_output_unit with new type invdiv. It outputs the product of the following units over the first one in the args list. Update tests with values & np.dot(A, x) == b. Where x = np.linalg.solve(A, b) Closes #1246
* Merge #1224bors[bot]2021-01-071-4/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | 1224: Updated linter r=hgrecco a=hgrecco - [x] Closes #1223 (insert issue number) - [x] Executed ``pre-commit run --all-files`` with no errors - [ ] The change is fully covered by automated unit tests - [ ] Documented in docs/ as appropriate - [ ] Added an entry to the CHANGES file Co-authored-by: Hernan <hernan.grecco@gmail.com>
| * Run linter on all filesHernan2021-01-071-4/+2
| |
* | Add sign to numpy_func.pyRobin Tesse2020-10-311-1/+1
|/
* use UnitStrippedWarning to warn about stripped unitsKeewis2020-06-201-1/+2
|
* Merge #1120bors[bot]2020-06-181-9/+15
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1120: revise the unit computation for np.prod r=hgrecco a=keewis #1087 left out the case where `axis` and `where` are specified and also used the size of the result to compute the output unit if only `axis` was specified. This changes that to use `a.shape[axis]` instead and also implements the support for both `axis` and `where` by broadcasting `where` against the array, applying `np.sum` along `axis` and using the only one unique value (`0` doesn't count) as an exponent. In case there's more than that, it will try to cast to `dimensionless`. I'm not quite sure if using `np.broadcast_arrays` is the best way to get the exponents, though. Edit: **Todo**: make the error message easier to understand - [x] Closes #867 - [x] Executed ``black -t py36 . && isort -rc . && flake8`` with no errors - [x] The change is fully covered by automated unit tests - [ ] Documented in docs/ as appropriate - [ ] Added an entry to the CHANGES file Co-authored-by: Keewis <keewis@posteo.de>
| * implement the case of axis *and* whereKeewis2020-06-181-2/+10
| |
| * use np.sum directlyKeewis2020-06-181-1/+1
| |
| * treat the axis and where case the same as all othersKeewis2020-06-181-2/+1
| |
| * compute the units before the resultKeewis2020-06-181-2/+2
| |
| * compute the units for pure axis using the shapeKeewis2020-06-181-2/+1
| |
* | remove the obsolete prod entry in op_units_output_ufuncsKeewis2020-06-181-1/+0
|/
* make sure the case of calling prod without args works, tooKeewis2020-06-171-0/+2
|
* implement numpy.prodKeewis2020-04-231-0/+22
|
* Merge branch 'master' into fix-interpKeewis2020-04-011-2/+10
|\
| * getattr guard the correct functionKeewis2020-03-191-1/+4
| |
| * don't try to implement a function that does not existKeewis2020-03-191-1/+4
| |
| * implement quantile / nanquantileKeewis2020-03-191-0/+2
| |
* | allow passing mixed args to interpKeewis2020-03-211-0/+3
|/
* Treat bare zeros/NaNs as acceptable in all numpy functionsGuido Imperiale2020-03-131-54/+23
| | | | | | | | Negative tests C
* add, iadd, eq, gt, etc. to treat bare NaN like 0Guido Imperiale2020-03-121-6/+7
| | | | | | | | | | | Trivial Bugfix on legacy numpy black
* don't require rtol / atol to be quantitiesKeewis2020-03-081-1/+1
|
* fix for key error in numpy.padmark-boer2020-02-211-4/+3
|
* also allow nan as a special valueKeewis2020-02-051-1/+1
|
* remove the unneeded else:Keewis2020-01-201-7/+6
|
* change the implementation of `pad` to treat non-quantities as dimensionlessKeewis2020-01-201-3/+7
|
* Add implementations and tests for allclose and intersect1dJon Thielen2020-01-081-0/+2
|
* Rename sequence-of-quantities helper, with tests for size zero Quantity ↵Jon Thielen2020-01-071-5/+6
| | | | creation from ndarray by multiplication
* Add any, all, cbrt, linalg.solveJon Thielen2019-12-301-3/+35
|
* Add explicit support for duck arrays/downcast types along with ↵Jon Thielen2019-12-291-1/+2
| | | | force_ndarray_like option
* Fixes W293Hernan2019-12-271-11/+11
|
* Manual edits after pymentHernan2019-12-271-95/+36
|
* Run pyment -w --convert -o numpydoc .Hernan2019-12-271-28/+132
|
* Add np.pad and np.resize implementationsJon Thielen2019-12-261-0/+26
|
* Merge #940bors[bot]2019-12-201-9/+53
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 940: Reimplement cumulative product NumPy functions r=hgrecco a=jthielen This PR resolves two issues from #905 that were identified in #939: First, `convert_arg` in `numpy_func.py` presumes `pre_calc_units` is a `Unit` or `None`, but there are instances where it was passed a string by way of `inputs_units` in `implement_func`. Now, any `inputs_units` as a string are converted to a `Unit` before being passed to `convert_to_consistent_units`. Second, the cumulative product functions were using `implement_func` with `input_units` set to something other than `None`, which was incorrect, since these functions have arguments that should not have units (namely `axis`). These functions have been reimplemented accordingly. - [x] Closes #939 - [x] Executed ``black -t py36 . && isort -rc . && flake8`` with no errors - [x] The change is fully covered by automated unit tests - ~~Documented in docs/ as appropriate~~ - ~~Added an entry to the CHANGES file~~ (fixup to previous change: #905) Co-authored-by: Jon Thielen <github@jont.cc>
| * Add documentation for implement_func parametersJon Thielen2019-12-191-1/+24
| |
| * Cumululative products should only have unit handling on first argument, not allJon Thielen2019-12-181-6/+20
| |
| * convert_to_consistent_units should only take Unit or NoneJon Thielen2019-12-181-2/+9
| |
* | Fix infinite recursion with array raised to scalar quantity powerJon Thielen2019-12-181-1/+4
|/
* Remove redundant encoding information (utf8 is the default)Guido Imperiale2019-12-131-1/+0
|
* isortGuido Imperiale2019-12-131-2/+2
|
* flake8 fixesGuido Imperiale2019-12-131-28/+31
|
* blackGuido Imperiale2019-12-131-182/+307
|