Category "scipy"

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

Trouble computing integral with scipy quad

I'm trying to compute the following definite integral: Integral I want to compute: where rho_ch is and a = 3.66 * 10^(-15) m (in meters) b = 0.54 * 10^(-15) m

Scipy minimize returns a higher value than minimum

As a part of multi-start optimization, I am running differential evolution (DE), the output of which I feed as initial values to scipy minimization with SLSQP (

How can I reduce the artifacts generated during "Thin Plate Spline" interpolation in Python?

At the Top "right", there is the 2D-density plot of the recorded data (actual), fewer in number. On the top-left is the interpolated data (thin-plate), i.e. la

Generating constraints for optimization in scipy using loop

There are lots of constraints which I will use in optimization using scipy; so I need to generate the constraints by loop. Below there's a sample of my constrai

Installing scipy and scikit-learn on apple m1

The installation on the m1 chip for the following packages: Numpy 1.21.1, pandas 1.3.0, torch 1.9.0 and a few other ones works fine for me. They also seem to wo

Why does find_objects give a bunch of Nones and then range of the whole image?

I am trying to find all objects detected in difference of frames, I thougt this would give a list of each area detected in the threshold, but find_objects is gi

Labelling connected components of an image with scipy

Hello I am following this example for labelling connected components of an image. I understand how to measure and label the blobs seen in this link. However how

No strict inequalities in cvxpy problem but still get the error "Strict inequalities are not allowed"

I was using the CVXPY library in Python, trying to solve a particular optimization problem. import cvxpy as cp import numpy as np from scipy.stats import norm

Interpolation function for compass bearings in python

Essentially, I have a CSV file full of compass bearings in radians from 0 to 2pi and attached timestamps that looks something like this: time, bearing 0.36,0.01