Hi,
I have generalized np.atleast_1d, np.atleast_2d, np.atleast_3d with a
function np.atleast_nd in PR#7804
(https://github.com/numpy/numpy/pull/7804).
As a result of this PR, I have a couple of questions about
`np.atleast_3d`. `np.atleast_3d` appears to do something weird with
the dimensions: If the input is 1D, it prepends and appends a size-1
dimension. If the input is 2D, it appends a size-1 dimension. This is
inconsistent with `np.atleast_2d`, which always prepends (as does
`np.atleast_nd`).
- Is there any reason for this behavior?
- Can it be cleaned up (e.g., by reimplementing `np.atleast_3d` in
terms of `np.atleast_nd`, which is actually much simpler)? This would
be a slight API change since the output would not be exactly the same.
Thanks,
-Joe
Hi All,
I would like to release Numpy 1.11.2rc1 this weekend. It will contain a few
small fixes and enhancements for windows and the last Scipy release. If
there are any pending PRs that you think should go in or be backported for
this release, please speak up.
Chuck
Hi all,
What is the official spelling of NumPy/Numpy/numpy?
The documentation is not consistent and it mixes both NumPy and Numpy. For example, the reference manual uses both spellings in the introduction paragraph (http://docs.scipy.org/doc/numpy/reference/):
"This reference manual details functions, modules, and objects included in Numpy, describing what they are and what they do. For learning how to use NumPy, see also NumPy User Guide."
However, in all docs taken together "NumPy" is most frequently used (74%):
% find . -name "*.rst" -exec grep Numpy -ow {} \; | wc -l
161
% find . -name "*.rst" -exec grep NumPy -ow {} \; | wc -l
471
I also reported it as an issue: https://github.com/numpy/numpy/issues/7986
Yours,
Bartosz
Hello,
I have mesh (more exactly: just a bunch of nodes) description with values associated to the nodes in a file, e.g. for a
3x3 mesh:
0 0 10
0 0.3 11
0 0.6 12
0.3 0 20
0.3 0.3 21
0.3 0.6 22
0.6 0 30
0.6 0.3 31
0.6 0.6 32
What is best way to read it in and get data structures like the ones I get from np.meshgrid?
Of course, I know about np.loadtxt, but I'm having trouble getting the resulting arrays (x, y, values) in the right form
and to retain association to the values.
Thanks,
Florian
Hi all
There are several ways on how to use C/C++ code from Python with NumPy, as
given in http://docs.scipy.org/doc/numpy/user/c-info.html . Furthermore,
there's at least pybind11.
I'm not quite sure which approach is state-of-the-art as of 2016. How would
you do it if you had to make a C/C++ library available in Python right now?
In my case, I have a C library with some scientific functions on matrices
and vectors. You will typically call a few functions to configure the
computation, then hand over some pointers to existing buffers containing
vector data, then start the computation, and finally read back the data.
The library also can use MPI to parallelize.
Best regards,
Michael
Is there a clean way to include the last element when subindexing numpy arrays?
Since the default behaviour of numpy arrays is to omit the “stop index”.
So for,
>>> A
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> A[0:5]
array([0, 1, 2, 3, 4])
This issue recently came up on Stack Overflow:
http://stackoverflow.com/questions/39145795/masking-a-series-with-a-boolean….
The poster attempted to index an ndarray with a pandas boolean Series
object (all False), but the result was as if he had indexed with an array
of integer zeros.
Can someone explain this behavior? I can see two obvious possibilities:
1. ndarray checks if the input to __getitem__ is of exactly the right
type, not using instanceof.
2. pandas actually uses a wider datatype than boolean internally, so
indexing with the series is in fact indexing with an integer array.
In my attempt to reproduce the poster's results, I got the following
warning:
FutureWarning: in the future, boolean array-likes will be handled as a
boolean array index
This indicates that the issue is probably #1 and that a fix is already on
the way. Please correct me if I am wrong. Also, where does the code for
ndarray.__getitem__ live?
Thanks,
-Joe
Hi All,
According to the documentation page:
http://docs.scipy.org/doc/numpy/reference/distutils.html
Function add_library allows the following keywords:
extra_f77_compiler_args
extra_f90_compiler_args
however setting them seem to have no effect for my extension. Digging deeper, I discovered,
the documentation is inconsistent with the implementation, as per
https://github.com/numpy/numpy/blob/v1.11.0/numpy/distutils/fcompiler/__ini…https://github.com/numpy/numpy/blob/v1.11.0/numpy/distutils/fcompiler/__ini…
And indeed, setting extra_f77_compile_arg has the effect I was looking for.
Fixing it is easy, but I am less certain whether we should fix the docs, or the code.
Given that add_extension lists extra_compile_args, extra_f77_compile_args, etc, I would think it
Is the documentation that need to change.
Please confirm, and I will open up a pull request for this.
Thank you,
Oleksandr