Skip to main content

Questions tagged [numpy]

NumPy is one of the many modules in Python that adds support of large multidimensional arrays and matrixes, along with a large library of high-level mathematical functions for operations with these arrays.

-1 votes
0 answers
27 views

DeprecationWarning when using scipy.optimize.minimize [duplicate]

import scipy import math def LR(x): return -(1+x*math.exp(-x))/2 max_LR= scipy.optimize.minimize(LR, [1],bounds =[(0, 1/2)]) I get the following error: DeprecationWarning: Conversion of an ...
Marina Drygala's user avatar
1 vote
1 answer
47 views

weird shape when indexing a jax array

I am experiencing a weird issue when indexing a Jax array using a list. If I place a debugger in the middle of my code, I have the following: This array are created by convering a numpy array. ...
Chutlhu's user avatar
  • 347
0 votes
0 answers
53 views

Efficient way of finding nearest pixel

I have array of floating points Nx2 which is representing the reprojected 3D -> 2D coordinates in a 2D image. I need to find closest (integer) pixel. The naive solution is pretty simple: import ...
Valeria's user avatar
  • 1,592
1 vote
0 answers
27 views

Storing numpy arrays in PostgreSQL: BYTEA vs. ARRAY for large integer arrays

I'm aware that PostgreSQL supports storing arrays directly. Is it more effective to store large numpy arrays of integers using PostgreSQL's native ARRAY type compared to BYTEA? Specifically, my arrays ...
Kawaruto's user avatar
2 votes
2 answers
124 views

Python - RGBA image non-zero pixels extracting - numpy mask speed up

I need to extract non-zero pixels from RGBA Image. Code below works, but because I need to deal with really huge images, some speed up will be salutary. Getting "f_mask" is the longest task. ...
dany's user avatar
  • 359
0 votes
1 answer
53 views

How to read a 1D array from a file generated with FORTRAN using Python

I am trying to read a simple dataset to a 1D numpy array with Python. However, the data was written with Fortran (regular ASCII) and groups repeated values together. For example: 2*0.652384 314*0....
Bruno F's user avatar
  • 65
-1 votes
0 answers
27 views

Load .npy directly to GPU memory with keras tensor format without communicating with system RAM first

I have X_train.npy and y_train.npy How do I can directly load them like this: model.fit(load_npy_to_gpu('X_train.npy'), load_npy_to_gpu('y_train.npy'))
Muhammad Ikhwan Perwira's user avatar
1 vote
1 answer
102 views

Could someone explain simply the syntax related to summing over axes in a Numpy meshgrid to reduce dimension?

I want to generate a function that acts on five 1D arrays and returns a 5D array. Then I want to "sum over" three of the axes of the function to reduce it to a 2D array which is then plotted ...
Cody Payne's user avatar
0 votes
0 answers
15 views

Python flask application is not working properly on Apache 24 in windows

I am using Python 3.8.10 with Apache(2.4.59) and mod_wsgi(4.9.4)on windows10. When running my application, the API requests go into a pending state. After troubleshooting with print statements, I ...
Dee265's user avatar
  • 1
1 vote
1 answer
63 views

Python for loop numpy vectorization

Do you have any suggestions how I can speed up the "f_img_update" function in the code below? I tried adding numba @jit decorator, but without luck. I guess that numpy vectorization might ...
dany's user avatar
  • 359
0 votes
0 answers
72 views

Parallel decorator on Numba routine featuring race condition

I have the following routine aiming to calculate in parallel different SVD of random matrices: import numpy as np from numba import jit,prange @jit(nopython=True,parallel=True) def svd_bn(aa,n): ...
Zarathustra's user avatar
2 votes
1 answer
41 views

Numpy memory error when masking along only certain axis, despite having sufficient RAM

I have a large array and I want to mask out certain values (set them to nodata). But I'm experiencing an out-of-memory error despite having sufficient RAM. I have shown below an example that ...
Placibo's user avatar
  • 33
4 votes
1 answer
42 views

How to get a square wave with specific tails length by using numpy?

I'm trying to represent a special square ware characterized by some feature as represented here: all values are related to thick parameter. Tails are related to the thick parameter and to the total ...
Certes's user avatar
  • 155
1 vote
0 answers
54 views

Copying differently contiguous arrays vs same contiguity arrays

I'm observing different speeds on different machines, but couldn't reason why. Please help me find the reason behind this and how one can handle this difference in performance-critical code - running ...
Vedaant Arya's user avatar
1 vote
1 answer
42 views

Why can't I fit my model to Young's interference data accurately?

I'm trying to fit my experimental data from Young's interference experiment to a theoretical model using Python's scipy.optimize module. I've tried several optimization techniques including curve_fit, ...
bougab's user avatar
  • 65

15 30 50 per page
1
���
3 4
5
6 7
7638