115,290 questions
0 votes
0 answers
82 views
Noiseless Gaussian Process Regression not crossing the training points
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 ...
2 votes
1 answer
28 views
How do I fix a "TypeError: bad number of pixels" in a healpy.fitsfunc.write_map call?
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....
2 votes
1 answer
84 views
numpy 2.2.6 tries to build on Windows 11 x64 instead of using wheel
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 ...
3 votes
3 answers
107 views
Numerically finding the minimum value of a variable where a function equals a value
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 ...
1 vote
1 answer
83 views
Scipy Hessian with Numpy cross product
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 ...
1 vote
0 answers
65 views
PSTH with numpy.histogram shows periodic “gaps” at bin boundaries even after integer time conversion—how to bin robustly?
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 ...
0 votes
1 answer
46 views
Creating 3d Mesh from Z stack of ROIs
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 ...
-4 votes
0 answers
54 views
Getting "ERROR: No matching distribution found for numpy" while installing NumPy on Mac
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. ...
0 votes
0 answers
83 views
Checking set in Poker [closed]
I am trying to simulate a deck of cards that can be shuffled, create a hand of 15, then check the hand to see if there is three of a kind within it. I've added the code I have so far used to create ...
Best practices
1 vote
1 replies
89 views
Applying Cosine Similarity to multiple vectors at once
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 ...
0 votes
1 answer
43 views
Multiple CDFS on the same plot with specified ranges
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 ...
Advice
0 votes
4 replies
61 views
Regex-logic in a numpy/torch array
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 ...
3 votes
1 answer
80 views
pyQt - Trying to draw B-Spline curve with mouse
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 ...
3 votes
2 answers
132 views
Calculate cumulative value based on another column [duplicate]
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 ...
Advice
2 votes
1 replies
71 views
Is there a way to vectorize the De Casteljau's algorithm in NumPy?
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 ...