dev module¶
This module defines the basic stem acquisitions objects used for processing. These objects are:
The 3D spectrum-image,
The 2D HAADF image,
-
class
inpystem.dev.
AbstractDev
(key, data, mask=None, sigma=None, seed=None, normalize=True, verbose=True)¶ Abstract Dev acquisition class.
This is an abstract class, which mean you can not instantiate such object.
It defines the structure for a Dev acquisition object.
- key: str
1-word description of the Dev2D image.
- data: (m,n) or (m, n, l) numpy array
The Dev2D image data before the noise step. Its dimension is (m,n).
- ndata: (m,n) or (m, n, l) numpy array
The noised Dev2D image. If
snr
is None,ndata
is None. Its dimension is (m,n).- sigma: float
The noise standard deviation.
- seed: optional, int
The random noise matrix seed.
- normalize: bool
If :code:normalize` is True, the data will be centered and normalize before the corruption steps.
- mean_std: None, 2-tuple
It stores the data mean and std in case normalize is True.
- verbose: bool
If True, information will be displayed. Default is True.
-
__init__
(key, data, mask=None, sigma=None, seed=None, normalize=True, verbose=True)¶ AbstractDev constructor.
- Parameters
key (str) – 1-word description of the Dev2D image. Generally, it’s common to the stem acquisition object.
data ((m, n) or (m, n, l) numpy array) – The noise-free image data.
mask ((m, n) numpy array) – The sampling mask.
sigma (optional, None, float) – The desired standard deviation used to model noise. Dafault is None for no additional noise.
seed (optional, None, int) – The random noise matrix seed. Dafault is None for no seed initialization.
normalize (optional, bool) – If :code:normalize` is True, the data will be centered and normalize before the corruption steps. Default is True.
verbose (optional, bool) – If True, information will be displayed. Default is True.
-
property
seed
¶ seed property getter.
-
property
sigma
¶ sigma property getter.
-
set_ndata
()¶ Constructs the noised data.
It is also used to draw a new noise matrix.
-
class
inpystem.dev.
Dev2D
(key, hsdata, scan=None, modif_file=None, sigma=None, seed=None, normalize=True, verbose=True)¶ Dev2D Class.
- Variables
key (str) – 1-word description of the Dev2D image.
hsdata (Signal2D hyperspy data) – The hyperspy Signal2D image. Its dimension is denoted (m,n). This is used to communicate with the parrent class.
data ((m,n) numpy array) – The Dev2D image data before the noise step. Its dimension is (m,n).
ndata ((m,n) numpy array) – The noised Dev2D image. If
snr
is None,ndata
is None. Its dimension is (m,n).scan (optional, Scan object) – The sampling scan object associated with the data. Default is None for full sampling.
sigma (float) – The noise standard deviation.
seed (optional, int) – The random noise matrix seed.
normalize (bool) – If :code:normalize` is True, the data will be centered and normalize before the corruption steps.
mean_std (None, 2-tuple) – It stores the data mean and std in case normalize is True.
verbose (bool) – If True, information will be displayed. Default is True.
-
__init__
(key, hsdata, scan=None, modif_file=None, sigma=None, seed=None, normalize=True, verbose=True)¶ SpectrumImage constructor.
- Parameters
key (str) – 1-word description of the Dev2D image. Generally, it’s common to the stem acquisition object.
hsdata (Signal2D hyperspy data) – The noise-free Dev2D image data. Its dimension is denoted (m,n).
scan (optional, None, Scan object) – The sampling scan object associated with the data. Default is None for full sampling.
modif_file (optional, None, str) – A .conf configuration file to remove rows, columns or dead pixels. Default is None for no modification.
sigma (optional, None, float) – The desired standard deviation used to model noise. Dafault is None for no additional noise.
seed (optional, None, int) – The random noise matrix seed. Dafault is None for no seed initialization.
normalize (optional, bool) – If :code:normalize` is True, the data will be centered and normalize before the corruption steps. Default is True.
verbose (optional, bool) – If True, information will be displayed. Default is True.
-
restore
(method='interpolation', parameters={}, verbose=None)¶
-
plot
(noised=False)¶ Plots the haadf image.
- Parameters
noised (optional, bool) – If True, the noised data is used. If False, the noise-free data is shown. Default is False.
-
class
inpystem.dev.
Dev3D
(key, hsdata, scan=None, modif_file=None, sigma=None, seed=None, normalize=True, PCA_transform=False, PCA_th='auto', verbose=True)¶ Dev3D Class
- Variables
key (str) – 1-word description of the Dev3D.
hsdata (Signal1D hyperspy data) – The hyperspy Signal2D image. Its dimension is denoted (m,n). This is used to communicate with the parrent class.
data ((m,n,l) numpy array) – The Dev3D data before the noise step. Its dimension is (m,n,l).
ndata ((m,n,l) numpy array) – The noised Dev3D data. If snr is None, ndata is None. Its dimension is (m,n,l).
snr (optional, float) – The desired snr used for the noising step.
sigma (float) – The noise standard deviation.
seed (optional, int) – The random noise matrix seed.
normalize (bool) – If normalize is True, the data will be centered and normalize before the corruption steps.
PCA_transform (bool) – If PCA_transformed is True, a PCA transformation has been applied to the data.
PCA_info (None, dictionary) – If PCA_transformed is True, PCA_info contains informations about the reduction. Otherwise, it is None.
PCA_operator (PcaHandler) – The PCA operator.
verbose (bool) – If True, information will be displayed. Default is True.
-
__init__
(key, hsdata, scan=None, modif_file=None, sigma=None, seed=None, normalize=True, PCA_transform=False, PCA_th='auto', verbose=True)¶ Dev3D __init__ function.
- Parameters
key (str) – 1-word description of the Dev3D image. Generally, it’s common to the stem acquisition object.
hsdata (Signal1D hyperspy data) – The noise-free Dev3D image data. Its dimension is denoted (m,n, l).
scan (optional, None, Scan object) – The sampling scan object associated with the data. Default is None for full sampling.
modif_file (optional, None, str) – A .conf configuration file to remove rows, columns or dead pixels. Default is None for no modification.
sigma (optional, None, float) – The desired standard deviation used to model noise. Dafault is None for no additional noise.
seed (optional, None, int) – The random noise matrix seed. Dafault is None for no seed initialization.
normalize (optional, bool) – If :code:normalize` is True, the data will be centered and normalize before the corruption steps. Default is True.
PCA_transform (optional, bool) – If PCA_transformed is True, a PCA transformation is applied to the data. Default is False.
PCA_th (optional, str, int) –
The desired data dimension after dimension reduction. Possible values are:
’auto’ for automatic choice,
’max’ for maximum value
an int value for user value.
Default is ‘auto’.
verbose (optional, bool) – If True, information will be displayed. Default is True.
-
direct_transform
(data)¶ Applies the Dev3D PCA transformation and normalization steps to data.
- Parameters
data ((m, n, l) numpy array, hs image) – Data whose shape is the same as self.data.
-
inverse_transform
(data)¶ Applies the Dev3D PCA inverse transformation and inverse normalization steps to spim.
- Parameters
data ((m, n, l) numpy array, hs image) – Data whose shape is the same as self.data.
-
restore
(method='interpolation', parameters={}, PCA_transform=None, PCA_th='auto', verbose=None)¶
-
show_sum
(noised=False)¶ Shows the sum of the data along the last axis.
- Parameters
noised (optional, bool) – If True, the noised data is used. If False, the noise-free data is shown. Default is False.
-
plot_as2D
(noised=False)¶ Implements the HypersSpy tool to visualize the image for a given band.
- Parameters
noised (optional, bool) – If True, the noised data is used. If False, the noise-free data is shown. Default is False.
-
plot_as1D
(noised=False)¶ Implements the HypersSpy tool to visualize the spectrum for a given pixel.
- Parameters
noised (optional, bool) – If True, the noised data is used. If False, the noise-free data is shown. Default is False.
-
plot_roi
(noised=False)¶ Implements the Hyperspy tool to analyse regions of interest.
- Parameters
noised (optional, bool) – If True, the noised data is used. If False, the noise-free data is shown. Default is False.