Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
1 answer
54 views

In order to investigate whether the decisions of a CNN for image classification are predominantly driven by image regions related to relatively fine object features, I am looking for an image ...
Adrian Straker's user avatar
4 votes
1 answer
72 views

I am using python to build an OpenGL rendering engine and am using numpy arrays with a custom datatype to store my vertex data. import numpy as np data_type_vertex = np.dtype({ "names": ...
Tom van G's user avatar
0 votes
0 answers
46 views

I'm trying to plot nullclines for a nonlinear system and determine fixed points from the same. However till now my code is not good enough to generate the plots. Presently I'm only able to get a blank ...
Rahul Chakraborty's user avatar
1 vote
1 answer
51 views

I am doing an assignment on matrices and gradients, where the final answer must be expressed as a row vector. vr = np.array([1, 2, 3]) vrr = np.array([[1, 2, 3]]) Mathematically, a row vector should ...
Louis Chua's user avatar
Advice
2 votes
5 replies
78 views

There is a difference in behaviour on macOS with arm64 CPU vs other Linux with amd64. For numpy v1 on arm64, it seems there is an internal logic guaranteeing the imaginary part to be exactly 0: >&...
Anton's user avatar
  • 302
2 votes
1 answer
63 views

I'm building a molecule properties displaying website using django and sqlite. The database takes a numpy array and stores it as a BLOB. Currently, it just outputs the numpy array back out when asked ...
Giggabite's user avatar
0 votes
0 answers
91 views

I'm trying to perform a Gaussian Process Regression on series of data points Y and ln(X+(10^-4)) (The X values are used in log scale to create the model) X ln(X+(10^-4)) Y 0.00001 -9.11503019 ...
Josep's user avatar
  • 1
2 votes
1 answer
32 views

I have downloaded the HEALPix5 DECaPS 3D dust extinction map (from arXiv:2503.02657) and imported it as a numpy array meanmap. The array gives an expected result (51415400, 1, 120) to the meanmap....
Peter Barnes's user avatar
2 votes
1 answer
106 views

originally I was trying to install opencv-python which fails on trying to install numpy:2.2.6 So I am trying to just install this numpy and for some obscure reason it tries to build it! instead of ...
62mkv's user avatar
  • 1,584
3 votes
3 answers
107 views

I have a black box function baseball that determines the magnitude of the distance that a baseball travels when launched. It takes the initial speed, the angle of launch and the initial spin. Assuming ...
panji's user avatar
  • 47
1 vote
1 answer
91 views

I need to compute the Hessian of a function involving cross products in Python. As an experiment, I consider the simple function def func(x): return np.sum(np.cross(x[0:3], x[3:6])) and compute the ...
CW279's user avatar
  • 153
1 vote
0 answers
66 views

I’m computing peristimulus time histograms (PSTHs) in Python. Each trial aligns spikes to a reach-start timestamp and bins them into fixed-width bins. I see vertical “gaps” (low counts) at exact bin ...
May Ren's user avatar
  • 11
0 votes
1 answer
47 views

I have a set of 3D ROI label stacks stored as TIFF files, where each ROI represents a single cell. I want to generate surface meshes(I use trimesh) suitable for downstream shape analysis. I tried ...
Roua Rouatbi's user avatar
-4 votes
0 answers
59 views

I am trying to install and import numpy on my Mac but in the terminal of Pycharm, it comes up with a error message as shown below. I am a relatively new coder in python so I am extremely confused. ...
confused and tired's user avatar
Best practices
1 vote
1 replies
90 views

I am implementing cosine similarity to my vector database using python and numpy. I would like to know if I should loop through every database entry and find the cosine similarity or is there a way of ...
user20617578's user avatar
0 votes
1 answer
45 views

I was trying to do something for a project where I create two random 3D vectors, project them onto a 2D plane by removing their x-component, taking the dot product between the two to find their ...
Mr. L's user avatar
  • 1
Advice
0 votes
4 replies
62 views

Evening, Is there any way to find a specific sequence of numerical values, matching certain logic (in the same way as in a regex), within a numpy/torch array or matrix row? I know i could just convert ...
Ghost's user avatar
  • 1,594
3 votes
1 answer
84 views

I am trying to have a Pen Tool in my pyqt6 application. I am trying to make it how Inkscape's PenTool works. For now, I am trying to achieve the 'B-Spline' mode. The issue is that my curve does not ...
Tom's user avatar
  • 75
3 votes
2 answers
134 views

Having this kind of pandas dataframe df = pd.DataFrame({ 'ts_diff':[0, 0, 738, 20, 29, 61, 42, 18, 62, 41, 42, 0, 0, 729, 43, 59, 42, 61, 44, 36, 61, 61, 42, 18, 62, 41, 42, 0, 0] }) ts_diff - is ...
ihtus's user avatar
  • 2,863
Advice
2 votes
1 replies
72 views

De Casteljau's algorithm is used to interpolate a Bézier curve and consists a recursive (or iterative) procedure to reduce the number of linear segments until only one is left and the interpolation ...
mins's user avatar
  • 7,776
2 votes
2 answers
129 views

I make a web app, the server side is running Python and processes data with numpy. I want to display charts from the numpy data on the browser. On the server I encode a list of numpy arrays with ...
mguijarr's user avatar
  • 8,030
1 vote
1 answer
142 views

I am working on some array T and a condition based on the array D: import numpy as np T = np.array([[ 1, 2], [ 3, 4], [ 5, 6], [ 7, 8]]) D = np.array([-6, ...
Andrew's user avatar
  • 1,226
1 vote
0 answers
163 views

I am regressing Y~(X1, X2) such that this fit is perfect (R squared is 1), where the R squared for Y~X1 and Y~X2 are chosen somewhere in the interval $(0,1)$. I am trying to create the numerical ...
turtlesandwich's user avatar
3 votes
2 answers
242 views

I’m building a simulation in BPTK-Py and need a power with a variable exponent inside a node equation: Resale_Value_DM1.equation = 1 - Depreciation_DM Resale_Value_DM2.equation = Resale_Value_DM1 ** ...
Teguh Juang Sinaga's user avatar
-5 votes
0 answers
58 views

I recently upgraded to Python 3.14. This caused the below weird output in my dataframe: Stock Price ATM Theta Return Roll Avg 0 SOFI np.float64(29.68) np....
Shawn Duffy's user avatar
0 votes
2 answers
85 views

I tried to install pytidycensus per these instructions: https://mmann1123.github.io/pytidycensus/index.html pip install pytidycensus OS Windows 11, current as of 10/31/2025, with Python 3.13.7 ...
Pietro Calogero's user avatar
4 votes
3 answers
118 views

What is an efficient numpy way of achieving an array of results based on a pair of index datasets? So, lets say there are 2 arrays these are the row and column headers in the table underneath: a = [1,...
ShaunMc's user avatar
  • 93
0 votes
0 answers
100 views

I am trying to use YouCompleteMe in Vim for getting python documentation (using YcmCompleter GetDoc and the vim pop up menu). This works well for normal python commands, but there seems to be various ...
Riley Kavanagh's user avatar
1 vote
1 answer
75 views

I have a directory of ca. 1600 PNGs (1000x400 res. previews of frames) and want to generate an EDL so I do not have to render the same frame several times. So far, I have successfully run the ...
Rain's user avatar
  • 21
3 votes
2 answers
136 views

I have huge np.memmap objects and need to expand them regularly. I was wondering if my current approach is safe and also the most efficient one and started searching the internet. I stumbled across ...
Babypopo's user avatar
  • 183
3 votes
1 answer
144 views

Related post: Compile numpy WITHOUT Intel MKL/BLAS/ATLAS/LAPACK Recent versions of numpy use meson for build configuration, I can build numpy from source but failed to exclude BLAS/LAPACK/... deps. ...
nochenon's user avatar
  • 376
1 vote
0 answers
162 views

I found some similar questions about quiver plots and direction fields, but I’m still confused about the meaning of these two lines in many examples: What do dx = np.ones_like(f) and dy = f mean in a ...
Youness Ansarey's user avatar
2 votes
1 answer
112 views

Consider the example code: from functools import partial from jax import jit import jax.numpy as jnp @partial(jit, static_argnums=(0,)) def my_function(n): idx = jnp.tile(jnp.arange(n, dtype=int)...
Ben's user avatar
  • 539
0 votes
0 answers
127 views

I’m creating a Python program that converts NetCDF files into GeoTIFFs, allowing the user to select the variable and time step using a Tkinter interface. The conversion works, but I’m having a ...
Aya's user avatar
  • 9
1 vote
2 answers
112 views

I scan for a trigger and when I get it, load a .npy file and process it. It started to take almost 2 seconds to load the NumPy file from within the process but when I tried to load the same file from ...
user2037777's user avatar
4 votes
1 answer
96 views

I tried to calculate the cumulative products for my list elements as below. In my list, each element is two-dimensional list: import numpy as np Orig_list = [[[1,2,3], [4,5,6], [7,8,9]], [[11,3,4], [...
Bogaso's user avatar
  • 3,896
1 vote
1 answer
91 views

I have a TIFF file with a size of (48000, 432000) and I would like to upload only a piece of the image, for example, pass a parameter like (X, Y, wid, hei), where X, Y are the coordinates of the upper-...
senek's user avatar
  • 85
0 votes
0 answers
95 views

Code: import numpy as np import sklearn as skl data = np.genfromtxt("water_potability.csv", delimiter = ",", names = True) print(data) print(data.shape) print(type(data[0])) ...
Alison's user avatar
  • 77
-4 votes
1 answer
117 views

Today I wanted to use the following command to subset a numpy high-dimensional array, but was surprised to find that the two methods were completely different. I'm very curious why numpy reorders the ...
samll fat's user avatar
1 vote
1 answer
112 views

I have 3 2D DataFrames, all with identical indexes (datetime range) and column names, but different data for these labels. I would like to combine these three 2D dataframes into 1 3D DataFrame with an ...
cma0014's user avatar
  • 1,599
1 vote
1 answer
96 views

I have two DataFrames, data1 and data2, with 3-level multiindices. The first two levels are floats, and correspond to spatial coordinates (say longitude and latitude). The third level, time, is based ...
peich's user avatar
  • 33
2 votes
1 answer
109 views

The example code creates a 2D visualization of angles relative to the center. Contour lines with labels are added to show lines of constant angle. import numpy as np import matplotlib.pyplot as plt n ...
Pieter Vermeulen's user avatar
5 votes
1 answer
209 views

I'm encountering a strange RuntimeWarning: divide by zero encountered in matmul when performing a simple matrix multiplication on my new Apple M4 machine. The most peculiar part is that this warning ...
Md. Mursalatul Islam Pallob's user avatar
4 votes
1 answer
118 views

Given a closed-form function f(x,y,z), what is the most efficient way to fill up a 3D ndarray arr[z][y][x] with the values of f(x,y,z)? For example, if I wanted a 3D ndarray arr[z][y][x] with each ...
Towelmonkey's user avatar
4 votes
2 answers
209 views

I've been trying to parallelize some code that I wrote in python. The actual work is embarrassingly parallel, but I don't have much experience with multiprocessing in Python. The actual code I'm ...
user2506833's user avatar
2 votes
1 answer
139 views

I am trying to detect the beginning of a quasi-steady regime in time series data representing drag (Fx) and lift (Fy) forces after an initial transient. Initially, I used a slope-based method, but it ...
SaleGauss's user avatar
2 votes
1 answer
109 views

If I know the shape of a numpy array like (1000, 50), and I have an arbitrary selection expressed as an IndexExpression, let's say np.s_[:200, :], how can I evaluate the shape of the sliced array (in ...
Kyle's user avatar
  • 364
-1 votes
1 answer
122 views

I am trying to make an app in python that takes in equations and outputs them in a graph or solves the equation(s). However in the equation-parsing function, I cannot work out which types are required ...
awesomecoder291's user avatar
2 votes
2 answers
119 views

I am performing some tests on the normality of the numpy random generator. Running the following code, the stats.normaltest shows some seeds with low pvalue (which highlights non-normal distribution). ...
GAP's user avatar
  • 113
0 votes
1 answer
93 views

`I’m deploying a Streamlit app on Streamlit Cloud that uses PyTorch and Torchvision for image segmentation. Locally, everything works fine, but when I deploy on Streamlit Cloud I get this error: File &...
Khushi Badsra's user avatar

1
2 3 4 5
2306