ImageD11.forward_model package¶
Submodules¶
ImageD11.forward_model.forward_model module¶
ImageD11.forward_model.io module¶
- ImageD11.forward_model.io.camera_names_ID11()¶
- ImageD11.forward_model.io.convert_h52_tif(h5name, save_path, prefix_name='proj', save_stack=False, ctrl_name='1.1/measurement/marana3', data_format='uint16')¶
- ImageD11.forward_model.io.convert_to_list(input_data)¶
- ImageD11.forward_model.io.delete_file_if_exists(filepath)¶
- ImageD11.forward_model.io.delete_group_from_h5(h5name, group_name)¶
- ImageD11.forward_model.io.get_scan_h5(experiment, scan_type=['dct'])¶
- ImageD11.forward_model.io.guess_camera_name(h5name, scan='1.1')¶
- ImageD11.forward_model.io.im_fabio(data)¶
- ImageD11.forward_model.io.im_scaling(im_in, scale=(0.3741496598639456,))¶
- ImageD11.forward_model.io.is_mat_v7p3(file_path)¶
- ImageD11.forward_model.io.read_h5_file(file_path)¶
- ImageD11.forward_model.io.read_h5_struct(file_path)¶
suitable for reading matlab file saved as a struct, e.g. parameters.mat
- ImageD11.forward_model.io.read_images_from_h5(h5name, scan='1.1', detector=None, StartIndex=None, EndIndex=None)¶
- ImageD11.forward_model.io.read_matlab_file(file_path)¶
- ImageD11.forward_model.io.read_motor_posisitions_from_h5(h5name, scan='1.1')¶
- ImageD11.forward_model.io.read_tomo_from_hdf5(hdf5name, ctrl_name='/entry0000/reconstruction/results/data', StartIndex=None, EndIndex=None, scale=(1.0,), diffrz_offset=None)¶
- ImageD11.forward_model.io.write_edf(data, edfname)¶
- ImageD11.forward_model.io.write_pct_vol(h5name, data, ctrl_name='/entry0000/reconstruction/results/data')¶
- ImageD11.forward_model.io.write_xdmf(h5name, xdmf_filename=None, ctrl='recon_mlem', attributes=['recon_mlem'], voxelsize=[0.0002, 0.0002, 0.0002])¶
ImageD11.forward_model.ori_converter module¶
- ImageD11.forward_model.ori_converter.axangle2u(axis, angle, is_normalized=False)¶
Rotation matrix for rotation angle angle around axis
Parameters¶
- axis3 element sequence
vector specifying axis for rotation.
- anglescalar
angle of rotation in radians.
- is_normalizedbool, optional
True if axis is already normalized (has norm of 1). Default False.
Returns¶
- matarray shape (3,3)
rotation matrix for specified rotation
Notes¶
From: http://en.wikipedia.org/wiki/Rotation_matrix#Axis_and_angle
- ImageD11.forward_model.ori_converter.euler2quat(e)¶
- ImageD11.forward_model.ori_converter.euler2u(e)¶
- ImageD11.forward_model.ori_converter.flip_up(q)¶
- ImageD11.forward_model.ori_converter.map_points_out(basis_points, basis_weights, superset, subset, map_indices)¶
- ImageD11.forward_model.ori_converter.multiply(r, a)¶
- ImageD11.forward_model.ori_converter.multiply_first_component(r, a)¶
- ImageD11.forward_model.ori_converter.quat2axangle(quat, identity_thresh=None)¶
Convert quaternion to rotation of angle around axis
Parameters¶
- quat4 element sequence
w, x, y, z forming quaternion.
- identity_threshNone or scalar, optional
Threshold below which the norm of the vector part of the quaternion (x, y, z) is deemed to be 0, leading to the identity rotation. None (the default) leads to a threshold estimated based on the precision of the input.
Returns¶
- thetascalar
angle of rotation.
- vectorarray shape (3,)
axis around which rotation occurs.
Examples¶
>>> vec, theta = quat2axangle([0, 1, 0, 0]) >>> vec array([1., 0., 0.]) >>> np.allclose(theta, np.pi) True
If this is an identity rotation, we return a zero angle and an arbitrary vector:
>>> quat2axangle([1, 0, 0, 0]) (array([1., 0., 0.]), 0.0)
If any of the quaternion values are not finite, we return a NaN in the angle, and an arbitrary vector:
>>> quat2axangle([1, np.inf, 0, 0]) (array([1., 0., 0.]), nan)
Notes¶
A quaternion for which x, y, z are all equal to 0, is an identity rotation. In this case we return a 0 angle and an arbitrary vector, here [1, 0, 0].
The algorithm allows for quaternions that have not been normalized.
- ImageD11.forward_model.ori_converter.quat2euler(q)¶
- ImageD11.forward_model.ori_converter.quat2rod(q)¶
- ImageD11.forward_model.ori_converter.quat2u(q)¶
- ImageD11.forward_model.ori_converter.random_quaternions(n)¶
- ImageD11.forward_model.ori_converter.rod2quat(r)¶
- ImageD11.forward_model.ori_converter.rotate_into_fundamental_zone(q, generators)¶
- ImageD11.forward_model.ori_converter.u2euler(mat, axes='rzxz')¶
Return Euler angles from rotation matrix for specified axis sequence.
Note that many Euler angle triplets can describe one matrix.
Parameters¶
- matarray-like shape (3, 3) or (4, 4)
Rotation matrix or affine.
- axesstr, optional
Axis specification; one of 24 axis sequences as string or encoded tuple - e.g.
sxyz(the default).
Returns¶
- aifloat
First rotation angle (according to axes).
- ajfloat
Second rotation angle (according to axes).
- akfloat
Third rotation angle (according to axes).
Examples¶
>>> R0 = euler2mat(1, 2, 3, 'syxz') >>> al, be, ga = mat2euler(R0, 'syxz') >>> R1 = euler2mat(al, be, ga, 'syxz') >>> np.allclose(R0, R1) True
- ImageD11.forward_model.ori_converter.u2quat(u)¶
ImageD11.forward_model.pars_conversion module¶
ImageD11.forward_model.sample_environment module¶
- class ImageD11.forward_model.sample_environment.admet(filename=None, outname=None)¶
Bases:
objectread data from ADMET stress rig, which is normally save as .mtxData file example: filename = ‘/home/esrf/haixing0a/Downloads/ADMET_testing_20240327/ma5607_HEA2.mtwData’ stress = admet(filename)
- parse_xml_file(xml_file)¶
- plot_data()¶
- read_data()¶
- read_xml_data(element)¶
- save_data(output_name='test.dat')¶
ImageD11.forward_model.schmidt_factor module¶
Created on Wed Feb 12 13:51:26 2020
@author: Arsenic
- ImageD11.forward_model.schmidt_factor.calc_sfs(eulers, slipPlane, lattice)¶
- ImageD11.forward_model.schmidt_factor.degToRad(deg)¶
- ImageD11.forward_model.schmidt_factor.gen_directions(lattice)¶
generates the possible slip directions
- ImageD11.forward_model.schmidt_factor.gen_planes(plane_type)¶
- ImageD11.forward_model.schmidt_factor.get_gamma_angle(plane, direction, eulers)¶
calculates the gamma angle associated to a slip system
- ImageD11.forward_model.schmidt_factor.plane_trace_components(plane, eulers)¶
calculates the trace angle of given plane in given crystal onto sample surface
- ImageD11.forward_model.schmidt_factor.project_direction(direction, eulers)¶
calculates the normed components of a given direction in sample reference frame
- ImageD11.forward_model.schmidt_factor.quats_to_euler(quats)¶
conversion from quaternions to euler angles
- ImageD11.forward_model.schmidt_factor.radToDeg(rad)¶
- ImageD11.forward_model.schmidt_factor.random_quats(n)¶
uniform quats population
- ImageD11.forward_model.schmidt_factor.rot_matrix(eulers)¶
macro base in crystal frame
Module contents¶
forward model for 3DXRD and s3DXRD The aim is to exploit forward model for the following purposes: 1) facilitate analysis for (s)3DXRD by filtering and cleaning peaks for indexed grains, calculating completeness 2) bridging the combined analysis between DCT and (s)3DXRD for the same sample but measured in different geometries/instruments 3) forward model based reconstruction for both near-field and far-field geometries 4) parameters conversion among ImageD11 par, DCT parameters, poni, which all can be converted to a dictionary and compatible with fwd-DCT parameters 5) other auxillary tools for multi-modality analysis, including interacting with PCT, sample environment, orientation conversion, deformation analysis (schmidt factor calc) etc. Copyright (C) 2023-present Haixing Fang
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA