Abstract
For accurate characterization of grazing-incidence X-ray mirrors, we present a comprehensive framework to fit measured surface shapes (either slope or height) of X-ray mirrors used in synchrotron radiation and free-electron laser facilities. We summarize the closed-form expressions of some typical surface shapes of X-ray mirrors including elliptic cylinders, hyperbolic cylinders, ellipsoids, hyperboloids, and diaboloids. This framework is composed of four layers: definition of standard shapes with closed-form expressions, generation of theoretical surface with pose parameters (six degrees of freedom defining an object's position and orientation relative to a coordinate system), parameter optimization with the ability to select which parameters are fit and which are held constant, and the development of user-friendly fitting function wrappers for particular fitting tasks. A few practical fitting examples are demonstrated to verify the effectiveness of the proposed fitting framework. We discuss the physical meanings of the fitting parameters, and provide several examples using the elliptic cylinder and ellipsoid shapes to highlight some features of the framework. Moreover, we provide the presented framework as open-source codes (MATLAB and Python codes available at https://github.com/nsls2omf/xmf) to the community to encourage academic collaboration and further improvements.