Tagged Questions
2
votes
0answers
102 views
Numpy high precision
I am using numpy and pyfits to manipulate spectra and I require high precision (something like 8-10 decimal places on a value which might go as high as 10^12). For that the data type "decimal" would ...
2
votes
0answers
274 views
output operand requires a reduction, but reduction is not enabled Python
import numpy as np
from numpy.linalg import solve,norm,cond,inv,pinv
import math
import matplotlib.pyplot as plt
from scipy.linalg import toeplitz
from numpy.random import rand
c = np.zeros(512)
c[0] ...
2
votes
0answers
160 views
Inverting a numpy boolean array using ~
Can I use ~A to invert a numpy array of booleans, instead of the rather awkward functions np.logical_and() and np.invert()? Indeed, ~ seems to work fine, but I can't find it in any nympy reference ...
1
vote
0answers
96 views
2D Numpy Array Beginner troubles
my issues is with trying to work with arrays that for each elements is a tuple of 2 values.
specifically the problem is to generate a random 2-dimensional walk of 200 (but for testing say 2) steps ...
1
vote
0answers
122 views
Multiplying Numpy 3D arrays by 1D arrays
I am trying to multiply a 3D array by a 1D array, such that each 2D array along the 3rd (depth: d) dimension is calculated like:
1D_array[d]*2D_array
And I end up with an array that looks like, say:
...
1
vote
0answers
121 views
Reading file in Fortran-90 written out by Python f.write()
So someone wrote this code which outputs x,y,z positions of some particles.
if rs.contains_block(file+'.hdf5',"POS ",parttype=1):
d1 = rs.read_block(file, "POS ",parttype=1,verbose=False)
...
1
vote
0answers
180 views
search in a pytables array
I have a multidimensional array stored in pytables.
how do I perform a search on it?
For example: I like to do a search to return a dimension of the array in which the sum of all values โโof this ...
1
vote
0answers
215 views
Python Memory Use With Large Array Computation
I'm working with large arrays (900, 1000, 10,000) and I need to do simple computations (multiply, divide, etc.). However, I am receiving memory errors. Is there a way to do the following more ...
1
vote
0answers
485 views
masked arrays in numpy error
I input a file using genfromtxt and some of the values are missing so I generate a masked array. When I try to index some of the values of the records of the masked array I get an error which I ...
0
votes
0answers
34 views
Fastest algorithm for planar graph covering with rectangles
I would like to find the most efficient algorithm for covering a planar graph with rectangles. To be specific, the input to the algorithm would be an n X n matrix of integer entries each of which is ...
0
votes
0answers
26 views
Print an image showing the boundaries of a classification process - possibly python
I have a classification process that for different x and y over the plane returns me a class (represented as an int between 0 and 31).
I would like to give a representation of it by creating an image ...
0
votes
0answers
41 views
COM restructuring an Array of Arrays returned to VBA
I am working on an application in VBA (PPT, DOC, and XLS add-ins) that uses Python to interact with SPSS Dimensions Table Object Model to automate the production of graphics & tables in MS Office ...
0
votes
0answers
57 views
Transferring vector of vectors from c++ to python numpy arrays or vice versa
BACKGROUND:
I am currently working with another individual who writes code in c++, and I write in python. Neither of us are extremely experienced, I personally only do mathematical programming in ...
0
votes
0answers
109 views
Divide an array into bins
I have a file.dat with three columns (x,y and z) like this:
2.89e+13 1.56 5.78
4.76e+12 7.12 2.35
2.01e+10 4.53 7.23
........ .... ....
I would like to divide the x array into three bins ...
0
votes
0answers
213 views
Total size of numpy array
I'm trying to manipulate a list into a matrix and for some reason it's not working...
import numpy as np
dcd=np.load('dcd_250.npy')
#4. write the dcd into an array
print 'Length of ...