.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples\example_06_fit_real_concave_ellipsoid_with_tol.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_example_06_fit_real_concave_ellipsoid_with_tol.py: Example 06: Fit real data of a concave ellipsoid ================================================ This example shows how to fit real data of a concave ellipsoid using the XMF library. .. GENERATED FROM PYTHON SOURCE LINES 8-62 .. image-sg:: /auto_examples/images/sphx_glr_example_06_fit_real_concave_ellipsoid_with_tol_001.png :alt: Concave Ellipsoid, Fitting, Residual :srcset: /auto_examples/images/sphx_glr_example_06_fit_real_concave_ellipsoid_with_tol_001.png :class: sphx-glr-single-img .. code-block:: Python import os from scipy.io import loadmat import xmf # Load the data concave_ellipsoid_map = loadmat(os.path.join('..', '..', '..', 'real_data', 'sample_03_concave_ellipsoid_height_map.mat')) p = concave_ellipsoid_map['params_target'][0][0][0][0][0] q = concave_ellipsoid_map['params_target'][0][0][1][0][0] theta = concave_ellipsoid_map['params_target'][0][0][2][0][0] x_i = concave_ellipsoid_map['params_target'][0][0][3][0][0] y_i = concave_ellipsoid_map['params_target'][0][0][4][0][0] z_i = concave_ellipsoid_map['params_target'][0][0][5][0][0] alpha = concave_ellipsoid_map['params_target'][0][0][6][0][0] beta = concave_ellipsoid_map['params_target'][0][0][7][0][0] gamma = concave_ellipsoid_map['params_target'][0][0][8][0][0] x2d = concave_ellipsoid_map['x2d'] y2d = concave_ellipsoid_map['y2d'] z2d_measured = concave_ellipsoid_map['z2d'] # Target parameters as dictionary target_params_dict = { 'p': p, 'q': q, 'theta': theta, 'x_i': x_i, 'y_i': y_i, 'z_i': z_i, 'alpha': alpha, 'beta': beta, 'gamma': gamma } # Set input parameters as dictionary input_params_dict = { 'p': p, 'q': q, 'theta': theta } # Set the tolerance dictionary opt_dict = { 'p': 0, 'q': 0, 'theta': 0, 'y_i': [-0.5e-3, 0.5e-3], } # Fit the surface shape z2d_res, z2d_fit, opt_params_dict, opt_params_ci_dict, _ = xmf.fit_concave_ellipsoid_height(x2d, y2d, z2d_measured, input_params_dict, opt_dict) # Show fitting results xmf.fig_show_2d_fitting_map(x2d, y2d, z2d_measured, z2d_fit, z2d_res, target_params_dict, opt_params_dict, opt_params_ci_dict,'Concave Ellipsoid') .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.317 seconds) .. _sphx_glr_download_auto_examples_example_06_fit_real_concave_ellipsoid_with_tol.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_06_fit_real_concave_ellipsoid_with_tol.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_06_fit_real_concave_ellipsoid_with_tol.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: example_06_fit_real_concave_ellipsoid_with_tol.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_