Calculate root mean square of 3D deviation after surface fitting in python
NickName:T_by_PW Ask DateTime:2020-01-26T21:56:12

Calculate root mean square of 3D deviation after surface fitting in python

My goal is to determine the 3D deviation (and its RMS) between a set of 3D data points and a fitted paraboloid in Python.

Starting from this: Paraboloid (3D parabola) surface fitting python, I can compute the RMS. If I understand correctly, the error and the RMS are computed along the Z-axis. Is it right?

I tried (without success) to determine the 3D deviation and RMS between the fitted surface and the data points, but I cannot get their. Does anyone have some advices to solve this, please?

import numpy as np
from scipy.optimize import curve_fit

# Initial guess parameters
p0 = [1.5,0.4,1.5,0.4,1]

# INPUT DATA
x = [0.4,0.165,0.165,0.585,0.585]
y = [.45, .22, .63, .22, .63]
z = np.array([1, .99, .98,.97,.96])

# FIT
def paraBolEqn(data,a,b,c,d,e):
    x,y = data
    return -(((x-b)/a)**2+((y-d)/c)**2)+e

data = np.vstack((x,y))
popt, _ = curve_fit(paraBolEqn,data,z,p0)

# Deviation and RMS along Z axis
modelPredictions = paraBolEqn(data, *popt) 
absError = modelPredictions - z
RMSE = np.sqrt(np.mean(np.square(absError))) # Root Mean Squared Error along Z axis
print('RMSE (along Z axis):', RMSE)

# Deviation and RMS in 3D
# ??

Copyright Notice:Content Author:「T_by_PW」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/59919008/calculate-root-mean-square-of-3d-deviation-after-surface-fitting-in-python

More about “Calculate root mean square of 3D deviation after surface fitting in python” related questions

Calculate root mean square of 3D deviation after surface fitting in python

My goal is to determine the 3D deviation (and its RMS) between a set of 3D data points and a fitted paraboloid in Python. Starting from this: Paraboloid (3D parabola) surface fitting python, I can

Show Detail

calculate coefficient of determination (R2) and root mean square error (RMSE) for non linear curve fitting in python

How to calculate coefficient of determination (R2) and root mean square error (RMSE) for non linear curve fitting in python. Following code does until curve fitting. Then how to calculate R2 and RM...

Show Detail

Calculate root mean square deviation (RMSD) with numpy of Python

I transformed the coordinates of two atoms into an array: coord And I must calculate the root mean squared deviation (RMSD) between the two sets of these coordinates. For this I have: def cal_rmsd_...

Show Detail

slamdata: how to calculate standard deviation and square root?

I have a dataset stored in mongodb database. i would like to calculate the standard deviation and square root of some data. How should i do this? i have done some research about purescript but i...

Show Detail

Root mean square of a function in python

I want to calculate root mean square of a function in Python. My function is in a simple form like y = f(x). x and y are arrays. I tried Numpy and Scipy Docs and couldn't find anything.

Show Detail

Fitting 3D data points to polynomial surface and getting the surface equation back

I am new to Python 3D fitting, and the related optimisation techniques. I tried to understand similar topics and to find an answer based on least squares methods, but my success has been rather lim...

Show Detail

Square root and Looping on Standard Deviation in Ruby

I'm trying to get the difference of each members versus the mean (given mean = 4.5 for example) and the square root of the result of these two using each loop. Following the steps on this link, wha...

Show Detail

R Fitting curves using mean values, standard deviation and N

Normally I use individual data for curve fitting e.g. X <- c( 0, 0, 0, 2.4, 2.4, 2.4, 5.8, 5.8, 5.8, ...) Y <- c( 99, 98, 101, 80, 72, 77, 55, 40, 46, ...) Then I create a dataframe and use...

Show Detail

Local surface fitting to 3d points

I have set of 3d points, but it contains some outliers. My goal is to map original set of 3d points to "smoothed" set of 3d points and get rid of outliers. The approach I choose is - local surface

Show Detail

Data fitting in Python then calculate the value that is smaller than a given share of elements

First of all let me say that I am as new to the python world that I am to statistics. So I apologize in advance if my question seems trivial or even imprecise. I will do my best to express myself r...

Show Detail