def __init__(self, fpath): """ Visualisation and data extraction from pyxe data object/hdf5 file. Builds on the PeakAnalysis class, allowing for the 1d/2d vizualisation of 1d/2d/3d data acquisition arrays. Provides functionality for array re-alignment (flipping, swapping axes, re-centering). Also allows for data to be saved to a text file. Args: fpath (str): Path to pyxe hdf5 file. """ self.fpath = fpath with h5py.File(fpath, 'r') as f: self.ndim, self.d1, self.d2, self.d3 = data_extract(f, 'dims') self.q, self.I, self.phi = data_extract(f, 'raw') self.peaks, self.peaks_err = data_extract(f, 'peaks') self.fwhm, self.fwhm_err = data_extract(f, 'fwhm') self.strain, self.strain_err = data_extract(f, 'strain') self.strain_tensor = data_extract(f, 'tensor')[0] self.E, self.v, self.G = data_extract(f, 'material') self.stress_state, self.analysis_state = data_extract(f, 'state') self.detector = detector_extract(f) if self.stress_state is None: self.stress_eqn = None else: p_strain = self.stress_state == 'plane strain' self.stress_eqn = plane_strain if p_strain else plane_stress
def __init__(self, fpath): """ Analysis class for the calculation of peaks and strain. The analysis is based around two peak fitting methods - single peak and Pawley refinement. The Pawley refinement requires a more complete description of the constituent material/phases and returns a lattice parameter, whereas the single peak analysis returns a particular lattice spacing, d0, or rather the reciprocal equivalent, q0. The strain analysis follows naturally from this via a simple strain calculation (e = delta_a / a0), with the variation in strain wrt. azimuthal position allowing for the computation of the full strain tensor (e_xx, e_yy, e_xy). It is then possible to finalise the analytical procedure and calculate stress, which relies on the material system being in a plane strain or plane stress state. The in-plane stress state can then be determined. Args: fpath (str): Path to an analyzed (integrated) pyxe hdf5 file """ self.fpath = fpath with h5py.File(fpath, 'r') as f: self.ndim, self.d1, self.d2, self.d3 = data_extract(f, 'dims') self.q, self.I, self.phi = data_extract(f, 'raw') self.peaks, self.peaks_err = data_extract(f, 'peaks') self.fwhm, self.fwhm_err = data_extract(f, 'fwhm') self.strain, self.strain_err = data_extract(f, 'strain') self.strain_tensor = data_extract(f, 'tensor')[0] self.E, self.v, self.G = data_extract(f, 'material') self.stress_state, self.analysis_state = data_extract(f, 'state') self.detector = detector_extract(f) if self.stress_state is None: self.stress_eqn = None else: p_strain = self.stress_state == 'plane strain' self.stress_eqn = plane_strain if p_strain else plane_stress