get_decomposition_model_write#

LazyEBSD.get_decomposition_model_write(components: int | List[int] | None = None, dtype_learn: str | dtype | type = 'float32', mbytes_chunk: int = 100, dir_out: str | None = None, fname_out: str | None = None) None[source]#

Write the model signal generated from the selected number of principal components directly to an .hspy file.

The model signal intensities are rescaled to the original signals’ data type range, keeping relative intensities.

Parameters:
components

If not given, rebuilds the signal from all components. If int, rebuilds signal from components in range 0-given int. If list of int, rebuilds signal from only components in given list.

dtype_learn

Data type to set learning results to (default is "float32") before multiplication.

mbytes_chunk

Size of learning results chunks in MB, default is 100 MB as suggested in the Dask documentation.

dir_out

Directory to place output signal in.

fname_out

Name of output signal file.

Notes

Multiplying the learning results’ factors and loadings in memory to create the model signal cannot sometimes be done due to too large matrices. Here, instead, learning results are written to file, read into dask arrays and multiplied using dask.array.matmul(), out of core.