TIE reconstruction

Transport of intensity (TIE) based methods of phase reconstruction.

TIE module

class PyLorentz.phase.tie.TIE(tfs: ThroughFocalSeries, save_dir: PathLike | None = None, name: str | None = None, sym: bool = False, qc: float | None = None, verbose: int = 1)[source]

Bases: BaseTIE

Class for performing Transport of Intensity Equation (TIE) phase reconstruction.

__init__(tfs: ThroughFocalSeries, save_dir: PathLike | None = None, name: str | None = None, sym: bool = False, qc: float | None = None, verbose: int = 1)[source]

Initialize the TIE object.

Parameters:
  • tfs (ThroughFocalSeries) – Through Focal Series dataset.

  • save_dir (Optional[os.PathLike], optional) – Directory to save results. Default is None.

  • name (Optional[str], optional) – Name for the reconstruction. Default is None.

  • sym (bool, optional) – Whether to symmetrize the images. Default is False.

  • qc (Optional[float], optional) – Tikhonov regularization parameter. Default is None.

  • verbose (int, optional) – Verbosity level. Default is 1.

reconstruct(index: int | None = None, name: str | None = None, sym: bool = False, qc: float | None = None, flip: bool | None = None, save_mode: bool | str | List[str] = False, save_dir: PathLike | None = None, verbose: int | bool = 1, pbcs: bool | None = None, overwrite: bool = False) TIE[source]

Perform TIE reconstruction.

Parameters:
  • index (Optional[int], optional) – Index of the image to reconstruct. Default is None.

  • name (Optional[str], optional) – Name for the reconstruction. Default is None.

  • sym (bool, optional) – Whether to symmetrize the images. Default is False.

  • qc (Optional[float], optional) – Tikhonov regularization parameter. Default is None.

  • flip (Optional[bool], optional) – Whether to use flip images. Default is None.

  • save_mode (Union[bool, str, List[str]], optional) – Whether and what to save. Default is False.

  • save_dir (Optional[os.PathLike], optional) – Directory to save results. Default is None.

  • verbose (Union[int, bool], optional) – Verbosity level. Default is 1.

  • pbcs (Optional[bool], optional) – Whether to apply periodic boundary conditions. Default is None.

  • overwrite (bool, optional) – Whether to overwrite existing files. Default is False.

Returns:

The TIE instance after reconstruction.

Return type:

TIE

save_results(save_mode: bool | str | List[str] = True, save_dir: PathLike | None = None, name: str | None = None, overwrite: bool = False) TIE[source]

Save the reconstruction results.

Parameters:
  • save_mode (Union[bool, str, List[str]], optional) – Keys to save. Default is True.

  • save_dir (Optional[os.PathLike], optional) – Directory to save results. Default is None.

  • name (Optional[str], optional) – Name for the reconstruction. Default is None.

  • overwrite (bool, optional) – Whether to overwrite existing files. Default is False.

Returns:

The TIE instance.

Return type:

TIE

property recon_defval: float | None

Get the defocus value used for reconstruction.

Returns:

Defocus value.

Return type:

Optional[float]

property flip: bool

Get the flip status.

Returns:

Flip status.

Return type:

bool

property phase_E: numpy.ndarray

Get the electrostatic phase shift.

Returns:

Electrostatic phase shift.

Return type:

np.ndarray

visualize(cbar: bool = False, plot_scale: bool | str = True)[source]

Visualize the phase and induction maps.

Parameters:
  • cbar (bool, optional) – Whether to display a colorbar. Default is False.

  • plot_scale (Union[bool, str], optional) – Whether and what scale to plot. Default is True.

show_phase_E(show_scale: bool = True, **kwargs)[source]

Show the electrostatic phase shift.

Parameters:

show_scale (bool, optional) – Whether to show the scale. Default is True.

SITIE module

class PyLorentz.phase.sitie.SITIE(dd: DefocusedDataset, save_dir: PathLike | None = None, name: str | None = None, sym: bool = False, qc: float | None = None, verbose: int = 1)[source]

Bases: BaseTIE

Class for phase reconstruction using the SITIE method.

__init__(dd: DefocusedDataset, save_dir: PathLike | None = None, name: str | None = None, sym: bool = False, qc: float | None = None, verbose: int = 1)[source]

Initialize the SITIE object.

Parameters:
  • dd (DefocusedDataset) – Defocused dataset.

  • save_dir (Optional[os.PathLike], optional) – Directory to save results. Default is None.

  • name (Optional[str], optional) – Name for the reconstruction. Default is None.

  • sym (bool, optional) – Whether to symmetrize the images. Default is False.

  • qc (Optional[float], optional) – Tikhonov regularization parameter. Default is None.

  • verbose (int, optional) – Verbosity level. Default is 1.

classmethod from_array(image: numpy.ndarray, scale: float | int | None = None, defval: List[float] | None = None, beam_energy: float | None = None, name: str | None = None, sym: bool = False, qc: float | None = None, save_dir: PathLike | None = None, simulated: bool = False, verbose: int | bool = 1) SITIE[source]

Create SITIE object from a numpy array.

Parameters:
  • image (np.ndarray) – Input image array.

  • scale (Union[float, int, None], optional) – Scale factor for the dataset. Default is None.

  • defvals (Optional[List[float]], optional) – List of defocus values. Default is None.

  • beam_energy (Optional[float], optional) – Beam energy for the reconstruction. Default is None.

  • name (Optional[str], optional) – Name for the reconstruction. Default is None.

  • sym (bool, optional) – Whether to symmetrize the images. Default is False.

  • qc (Optional[float], optional) – Tikhonov regularization parameter. Default is None.

  • save_dir (Optional[os.PathLike], optional) – Directory to save results. Default is None.

  • simulated (bool, optional) – Whether the data is simulated. Default is False.

  • verbose (Union[int, bool], optional) – Verbosity level. Default is 1.

Returns:

An instance of the SITIE class.

Return type:

SITIE

reconstruct(index: int | None = None, name: str | None = None, sym: bool = False, qc: float | None = None, save: bool | str | List[str] = False, save_dir: PathLike | None = None, verbose: int | None = None, pbcs: bool | None = None, overwrite: bool = False) SITIE[source]

Perform SITIE reconstruction.

Parameters:
  • index (Optional[int], optional) – Index of the image to reconstruct. Default is None.

  • name (Optional[str], optional) – Name for the reconstruction. Default is None.

  • sym (bool, optional) – Whether to symmetrize the images. Default is False.

  • qc (Optional[float], optional) – Tikhonov regularization parameter. Default is None.

  • save (Union[bool, str, List[str]], optional) – Whether and what to save. Default is False.

  • save_dir (Optional[os.PathLike], optional) – Directory to save results. Default is None.

  • verbose (Union[int, bool], optional) – Verbosity level. Default is 1.

  • pbcs (Optional[bool], optional) – Whether to apply periodic boundary conditions. Default is None.

  • overwrite (bool, optional) – Whether to overwrite existing files. Default is False.

Returns:

The SITIE instance after reconstruction.

Return type:

SITIE

save_results(save_mode: bool | str | List[str] = True, save_dir: PathLike | None = None, name: str | None = None, overwrite: bool = False) SITIE[source]

Save the reconstruction results.

Parameters:
  • save_mode (Union[bool, str, List[str]], optional) – Keys to save. Default is True.

  • save_dir (Optional[os.PathLike], optional) – Directory to save results. Default is None.

  • name (Optional[str], optional) – Name for the reconstruction. Default is None.

  • overwrite (bool, optional) – Whether to overwrite existing files. Default is False.

Returns:

The TIE instance.

Return type:

TIE

property recon_defval: float | None

Get the defocus value used for reconstruction.

Returns:

Defocus value.

Return type:

Optional[float]

visualize(cbar: bool = False, plot_scale: bool | str = True) SITIE[source]

Visualize the phase and induction maps.

Parameters:
  • cbar (bool, optional) – Whether to display a colorbar. Default is False.

  • plot_scale (Union[bool, str], optional) – Whether and what scale to plot. Default is True.

Returns:

The SITIE instance.

Return type:

SITIE

base_TIE module

PyLorentz.phase.base_tie.warning_on_one_line(message, category, filename, lineno, file=None, line=None)[source]
class PyLorentz.phase.base_tie.BaseTIE(save_dir: PathLike | None = None, scale: float | None = None, beam_energy: float | None = None, name: str | None = None, sym: bool = False, qc: float | None = None, verbose: int | bool = 1)[source]

Bases: BasePhaseReconstruction

A base class for Transport of Intensity Equation (TIE) reconstruction.

__init__(save_dir: PathLike | None = None, scale: float | None = None, beam_energy: float | None = None, name: str | None = None, sym: bool = False, qc: float | None = None, verbose: int | bool = 1)[source]

Initialize the BaseTIE object.

Parameters:
  • save_dir (Optional[os.PathLike], optional) – Directory to save results. Default is None.

  • scale (Optional[float], optional) – Scale factor for the dataset. Default is None.

  • beam_energy (Optional[float], optional) – Beam energy for the reconstruction. Default is None.

  • name (Optional[str], optional) – Name for the reconstruction. Default is None.

  • sym (bool, optional) – Whether to symmetrize the images. Default is False.

  • qc (Optional[float], optional) – Tikhonov regularization parameter. Default is None.

  • verbose (Union[int, bool], optional) – Verbosity level. Default is 1.

property sym

Get the symmetrization flag.

property qc

Get the Tikhonov regularization parameter.

property beam_energy

Get the beam energy.