magtomo.Reconstruction.Reconstruction#
- class Reconstruction(magnetization, rotations, projections, pol=1j, iterations=10, mask=None, learning_parameter=10)#
Bases:
ExperimentPerforms a reconstruction from dichroic projections, inherits the properties that are specified by an
magtomo.Experiment.Experiment.- Parameters:
- magnetizationnp.ndarray
The initial guess for the magnetization.
- rotationsnp.ndarray
Stack of rotation matrices describing the sample orientations that were measured; shaped (n, 3, 3).
- projectionsnp.ndarray
Stack of projections obtained at the corresponding rot value.
- polarray_like (optional)
Single polarization used for all projections, stack of polarizations matching the number of projections or stack of polarization pairs. Linear polarization represented using values from 0 to 180 (in degrees). Circular left and right polarization represented using complex ±1j.
- iterationsint (optional)
Number of reconstruction iterations to perform.
- masknp.ndarray (optional)
Binary mask for the magnetization.
- learning_parameterfloat (optional)
The learning parameter for gradient descent.
Methods
Calculates a normalization factor (number of pixels in the projections) for scaling the error metric.
Calculates the sinogram.
Computes the error between the current reconstruction and a provided reference.
orientation_to_tensorPlots the calculated sinogram.
Performs the reconstructions and updates the magnetization.
tensor_to_orientationComputes the angular difference between the current reconstruction and a provided reference.
Attributes
The error metric value at each iteration.
The number of reconstruction iterations.
The learning parameter for gradient descent.
The magnetic configuration of the sample.
Binary mask for the magnetization.
The interpolation order for performing rotations.
The polarization of the incident beam.
The measured projections.
The stack of measured orientation described by rotation matrices.
The calculated sinogram.
- calc_error_norm()#
Calculates a normalization factor (number of pixels in the projections) for scaling the error metric.
- Returns:
- int
The normalization factor (number of pixels in the projections).
- calculate_sinogram()#
Calculates the sinogram.
- configuration_error(reference, axial=False)#
Computes the error between the current reconstruction and a provided reference.
- Parameters:
- referencenp.ndarray
Reference structure as a numpy array that will be compared with the current reconstruction.
- axialbool (optional)
Set to True if reconstructing orientation fields (e.g. linear dichroic projections).
- Returns:
- float
The configuration error.
Notes
The configuration error, \(\varepsilon_c\) is evaluated for directional (vector) and axial (orientation) fields using:
\[\begin{split}\varepsilon_c = \begin{cases} \vec{m}_r - \vec{m} & \text{directional} \\ \min\left(\left\lvert \vec{m}_r - \vec{m} \right\rvert, \left\lvert \vec{m}_r + \vec{m} \right\rvert\right) & \text{axial} \end{cases}\end{split}\]where \(\vec{m}_r\) is the reconstruction and \(\vec{m}\) is the reference.
- property error_metric#
The error metric value at each iteration.
- property iterations#
The number of reconstruction iterations.
- property learning_parameter#
The learning parameter for gradient descent.
- property magnetization#
The magnetic configuration of the sample.
- property mask#
Binary mask for the magnetization.
- property order#
The interpolation order for performing rotations.
- plot_sinogram(cmap='Spectral')#
Plots the calculated sinogram.
- property pol#
The polarization of the incident beam.
- property projections#
The measured projections.
- reconstruct()#
Performs the reconstructions and updates the magnetization.
- property rotations#
The stack of measured orientation described by rotation matrices.
- property sinogram#
The calculated sinogram.
- theta_error(reference, axial=False)#
Computes the angular difference between the current reconstruction and a provided reference.
- Parameters:
- referencenp.ndarray
Reference structure as a numpy array that will be compared with the current reconstruction.
- axialbool (optional)
Set to True if reconstructing orientation fields (e.g. linear dichroic projections).
- Returns:
- float
The angular error in radians.
- Parameters:
reference (ndarray)
axial (bool)
Notes
The angular error, \(\varepsilon_\theta\) is evaluated for directional (vector) and axial (orientation) fields using:
\[\begin{split}\varepsilon_c = \begin{cases} \arccos\left( \frac{\vec{m_r} \cdot \vec{m}}{|\vec{m_r}||\vec{m}|} \right) & \text{directional} \\ \arccos\left( \frac{\left\lvert \vec{m_r} \cdot \vec{m} \right\rvert}{|\vec{m_r}| |\vec{m}|} \right) & \text{axial} \end{cases}\end{split}\]where \(\vec{m}_r\) is the reconstruction and \(\vec{m}\) is the reference.