Category "scipy"

Bilinear interpolation on quadrilateral

I am interpolating data from the vertices of a quadrilateral to any random point inside the quadrilateral. I implement this by first doing a coordinate transfor

Assign values from irregular grid points to standard grid points using interpolation

I have (a lot of) data like below y = [1, 3, 4, 5] which corresponds to the grid points x = [1, 2, 3, 4] On the other hand, I have a standard grid X = [1, 3]

Cublic Spline Interpolation of Phase Space Plot

I am creating a phase-space plot of first derivative of voltage against voltage: I want to interpolate the plot so so it is smooth. So far, I have approached t

Python: Is there any way to get the n-th order antiderivative of a periodic 3D signal/field without padding data?

As stated in the title, I want to obtain the n-th (e.g. 4-th) order antiderivative of a 3D field (e.g. array with shape (1024,1024,1024) ) with period L on each

Why is the mean = 0 to calculate the confidence intervals of a distribution when using stats.norm?

I somewhat understand how to calculate the Confidence interval in this manner but why is it that in this code, they used the mean=0 within the stats.norm se = n

Solution to a system of non-linear equations in R^2

I am trying to find a solution to the following system where f and g are R^2 -> R^2 functions: f(x1,x2) = (y1,y2) g(y1,y2) = (x1,x2) I tried solving it using

Function minimization with non-linear constraints using scipy.optimize.minimize 'SLSQP' method Error

I'm trying to minimize a maximum likelihood function with non linear constraints: #Maximum Likelihood import math from scipy import optimize #Define functi

Understanding `leafsize` in scipy.spatial.KDTree

Problem statement: I have 150k points in a 3D space with their coordinates stored in a matrix with dimension [150k, 3] in mm. I want to find all the neighbors o

Normal-gamma distribution in Python

Is there an implementation of the Normal-Gamma distribution for Python? I have looked over the internet, including scipy, and could not find it.

Cannot install Scipy in FreeBSD 13 with Python 3.10

I am trying install scipy in FreeBSD 13. I have built python 3.10 on FreebSD 13 and managed to install pandas, matplotlib and numpy on a virtual environment whi

No BLAS/LAPACK libraries found when installing SciPy on macOS

I am using python 3.9.8 and pycharm on a macbook m1. I have already installed openblas with homebrew but I still get the error below. I tried installing SciPy v

Python 3 RuntimeWarning: overflow encountered in double-scalars - trying to fit multiple gaussians and an offset using scipy.optimise.curve_fit

Hi all as with many peeps, I am new to python. Updated script that runs to completion but has a OptimizeWarning: Covariance of the parameters could not be estim

How can I use scipy interp1d with N-D array for x without for loop

How can I use scipy.interpolate.interp1d when my x array is an N-D array, instead of a 1-D array, without using a loop? The function f from interp1d then needs

Define correct scipy.signal.spectrogram input parameters

I have the following code: sampling_rate=128 N = sampling_rate _f, t, Sxx = signal.spectrogram(_signal, sampling_rate, nperseg=N, nfft=N, noverlap=N-1, mode="co

Signal correlation shift and lag correct only if arrays subtracted by mean

If I have two arrays that are identical except for a shift: import numpy as np from scipy import signal x = [4,4,4,4,6,8,10,8,6,4,4,4,4,4,4,4,4,4,4,4,4,4,4] y =

Sine fitting using scipy is not returning good fit

trying to fit some sine wave to data i collected. But Amplitude and Frequency are way off. Any suggestions? x=[0,1,3,4,5,6,7,11,12,13,14,15,16,18,20,21,22,24,26

How to adapt emcee to work with odeint numerical solution

I'm trying to constrain the function with the use of MCMC methods (emcee) without the analytical form of this function. I'm using the odeint to obtain the funct

Complex interpolation for Isotopic data

I have another question, is there a package that interpolates precipitation data taking into account mountains and oceans? I have so far used Numpy and Basemap

scipy.fftpack.fft with multiprocessing, how to avoid performance losses?

I would like to use scipy.fftpack.fft (and rfft) inside a multiprocessing structure, I have observed significant performances losses due to an apparent incompat

Difference between cosine similarity and cosine distance

It looks like scipy.spatial.distance.cdist cosine similariy distance: link to cos distance 1 1 - u*v/(||u||||v||) is different from sklearn.metrics.pairwis