curve-fitting

Is Gaussian & Mean Curvatures Applicable for Rough Surfaces?

主宰稳场 提交于 2019-12-11 06:13:35
问题 For a project I am working on, I have successfully performed the SFM procedure on road image data, and have been able to generate a .ply file containing point cloud coordinates (X, Y, Z), RGB values, and normals (nx, ny, nz). Now, I am interested in calculating curvature values for each point from the data I have. I have come across Surface Curvature MATLAB Equivalent in Python, but the implementation is said to work only when X, Y, and Z are 2D arrays. Is Gaussian and Mean curvatures

What exactly is the variance on the parameters of SciPy curve fit? (Python)

纵饮孤独 提交于 2019-12-11 06:07:23
问题 I'm currently using the curve_fit function of the scipy.optimize package in Python, and know that if you take the square root of the diagonal entries of the covariance matrix that you get from curve_fit, you get the standard deviation on the parameters that curve_fit calculated. What I'm not sure about, is what exactly this standard deviation means. It's an approximation using a Hesse matrix as far as I understand, but what would the exact calculation be? Standard deviation on the Gaussian

Python matplotli.psd fitting

雨燕双飞 提交于 2019-12-11 05:33:59
问题 I'm trying to make a fit using matplotlib.psd function. My datafile has 8 columns with displacement and speed for a particle (positionX, positionY, positionZ, AveragePositionXYZ, speedX, speedY, speedZ, AverageSpeedXYZ). Using the positionX for example, I try to get the Power Spectrum with matplotlib.psd: power, freqs = plt.psd(data, len(data), Fs = 256, scale_by_freq=True, return_line=0) Then, I try to make a curve fitting using linear regression with scipy stas.linregress: slope, inter, r2,

Solving coefficients of data set using curve_fit from scipy.optimize

て烟熏妆下的殇ゞ 提交于 2019-12-11 05:07:50
问题 I have an array A exported from excel, containing data values as shown. 1st column x and 2nd column y are dependent variables, while 3rd column z are independent variables (the output). from xlrd import open_workbook Data = open_workbook("simple.xls") sheet = Data.sheet_by_name('Sheet1') A=[] # Read row by row for rownum in range(sheet.nrows): rowValues = sheet.row_values(rownum) A.append(rowValues) A = np.array(A) A= [[ 0.00000000e+00 1.49761692e-05 0.00000000e+00] [ 8.85000000e+02 1

Curve Fitting with Known Integrals Python

眉间皱痕 提交于 2019-12-11 04:54:39
问题 I have some data that are the integrals of an unknown curve within bins. For your interest, the data is ocean wave energy and the bins are for directions, e.g. 0-15 degrees. If possible, I would like to fit a curve on to the data that conserves the integrals within the bins. I've tried sketching it on a notepad with a pencil and it seems like it could be possible. Does anyone know of any curve-fitting tool in Python to do this, for example in the scipy interpolation sub-package? Thanks in

Troubles fitting exponential with gnuplot

被刻印的时光 ゝ 提交于 2019-12-11 04:47:43
问题 I have a file called 'dataset.txt' with inside these data #Temperature (K) - Pressure (kPa) 310.2 5.349 315.6 6.682 320.2 8.015 325.2 10.681 330.2 14.680 335.2 17.346 340.2 22.678 345.2 28.010 350.2 34.675 355.2 44.006 360.2 52.004 365.2 62.668 370.2 73.332 I have to fit the curve given by data with an exponential of the form f(x) = a * exp(x * b) + c So i digit f(x) = a*exp(x*b) + c fit f(x) 'dataset.txt' u 1:2 via a, b, c but I get an error of the type Current data point ===================

Creating a python lmfit Model with arbitrary number of parameters

邮差的信 提交于 2019-12-11 04:27:27
问题 Is there a way to construct a an lmfit Model based on a function with an arbitrary number of dependent variables? For example: from lmfit import Model def my_poly(x, *params): func = 0 for i in range(len(params)): func+= params[i]*z**i return func #note: below does not work my_model = Model(my_poly, independent_vars = ['x'], param_names = ['A','B','C']) Something similar to the above would be wonderful if I am interested in a polynomial series and want to test the performance as the series

multivariable non-linear curve_fit with scipy

社会主义新天地 提交于 2019-12-11 04:24:32
问题 I have been trying to use scipy.optimize curve_fit using multiple variables. It works fine with the test code I created but when I try to implement this on my actual data I keep getting the following error TypeError: only arrays length -1 can be converted to python scalars The shape of the arrays and the data types of their elements in my test code and actual code are exactly the same so I am confused as to why I get this error. Test code: import numpy as np import scipy from scipy.optimize

curve fitting by a sum of gaussian with scipy

天涯浪子 提交于 2019-12-11 04:05:42
问题 I'm doing bioinformatics and we map small RNA on mRNA. We have the mapping coordinate of a protein on each mRNA and we calculate the relative distance between the place where the protein bound the mRNA and the site that is bound by a small RNA. I obtain the following dataset : dist eff -69 3 -68 2 -67 1 -66 1 -60 1 -59 1 -58 1 -57 2 -56 1 -55 1 -54 1 -52 1 -50 2 -48 3 -47 1 -46 3 -45 1 -43 1 0 1 1 2 2 12 3 18 4 18 5 13 6 9 7 7 8 5 9 3 10 1 13 2 14 3 15 2 16 2 17 2 18 2 19 2 20 2 21 3 22 1 24

curve_fit with polynomials of variable length

与世无争的帅哥 提交于 2019-12-11 03:37:31
问题 I'm new to python (and programming in general) and want to make a polynomial fit using curve_fit , where the order of the polynomials (or the number of fit parameters) is variable. I made this code which is working for a fixed number of 3 parameters a,b,c # fit function def fit_func(x, a,b,c): p = np.polyval([a,b,c], x) return p # do the fitting popt, pcov = curve_fit(fit_func, x_data, y_data) But now I'd like to have my fit function to only depend on a number N of parameters instead of a,b,c