All Questions
616 questions
2
votes
2
answers
140
views
How can I seperate the fringes that have been calculated with findpeaks
I would like to seperate the fringes (the red curved lines) that I have calculated with scipy findpeaks how can I achive it. I would like to seperate them and store in the text file.
import numpy as ...
1
vote
1
answer
40
views
find_peaks - trimming both peak array and prominences
I have two arrays of data from a scipy signal.find_peaks function.
p, prom_data = signal.find_peaks(spec, prominence=0.000010)
prom = prom_data['prominences']
p contains a list of indices ...
0
votes
1
answer
69
views
Self differencing function for 2D numpy array (correlation?)
I have a 2D array mat of shape ~ (3000, 5). Now I want to subtract every column from the others and ignore the self subtraction. This is what I have right now and what works. I just want a more ...
0
votes
2
answers
58
views
Fill an array with matrices along thr k-th diagonal
Is there an elegant way or function to fill a square 2D-array along its k-th diagonal with sub-matrices?
I am looking for something similar to what scpiy.linalg.block_diag() does but for lets say the ...
1
vote
0
answers
92
views
linearly interpolate 1D array against n dimensional arrays over axis in parallel
Is there any way to interpolate an 1D array against two n-dimensional arrays along certain axis?
In particular, I have x and y arrays with shapes (6, 2, 10). I also have an x_in array with shape(10, ) ...
0
votes
1
answer
42
views
Getting Size Error When Putting Dictionary Values In One Way ANOVA Method
When I try to put the values of my dictionary into the SciPy f_oneway function it gives me an error saying that input is too short (must be greater than 1), but the length of it is 3 so it should be ...
0
votes
0
answers
37
views
Integrating with an array of upper limits without sacrificing time efficiency [duplicate]
I am working on an algorithm to compute some model. Let's say
def model(z):
return z ** 2
Now, I need to use an array of upper limits to compute an array of values for definite integrals of this ...
1
vote
1
answer
299
views
Solving double integration in python using scipy.integrate
I want to compute this integral:
I have a data file providing values of cos(theta), phi and g.
I am trying to solve it using the trapezoid method of scipy.integrate. But I am unsure if this is the ...
2
votes
1
answer
100
views
Integrate a function that takes as input a scalar value and outputs a matrix
I have a function that takes as an input a scalar value, and outputs a matrix (following is an MRE with size 2x2, my actual function has problem specific matrix dimensions, like say 100x100). I'd like ...
1
vote
1
answer
102
views
Match close element pairs from two numpy arrays
I have two numpy arrays, I would like to have a one-to-one mapping between the two arrays so that elements that are closest to each other get mapped to each other. I have written the following script ...
0
votes
0
answers
49
views
Chunking up a 3D array with periodic boundary conditions into subarrays
I have a 3D numpy array of shape [N,N,N]. I want to split it into subcubes of size [n,n,n] and store them in an array of shape [N_subcubes, n, n, n, 1]. I also would like each subcube to overlap the ...
0
votes
1
answer
127
views
"No matching signature found" error in python scipy ndimage.label() function used with boolean array
I have a boolean array to indicate dry days:
dry_bool
0 False
1 False
2 False
3 False
4 False
...
15336 False
15337 False
15338 False
15339 False
...
-1
votes
2
answers
245
views
How to reverse the slope of a graphed line
I'm trying to make a simple budget line graph that you would see in an economics class. But I need the slope of my line to be from 60 to 15 (inverse of what it is now).
I tried inversing the axis ...
2
votes
1
answer
3k
views
Error in calculating Dynamic Time Warping
I am using this github codes (https://github.com/nageshsinghc4/-Dynamic-Time-Warping-DTW-/blob/main/Dynamic_Time_Warping(DTW).ipynb) to calculate Dynamic Time Warping. However, when run dtw_distance, ...
3
votes
1
answer
252
views
Efficient Weighted Jaccard distance
I am trying to find the weighted jaccard distance for every pair of rows in a ~8000*8000 pandas df matrix. I've tried the following :
import pandas as pd
import numpy as np
def weighted_j_sim(array1,...