NaNs and Infs when decomposing EDS

### Describe the bug

![image](https://user-images.githubusercontent.com/115000993/193821091-c81abc88-3d20-4267-9c41-6742ce558f04.png)


### Steps/Code to Reproduce

![image](https://user-images.githubusercontent.com/115000993/193821217-41c152ce-fa8d-4d03-a5f0-970b4ea27584.png)


### Expected Results

I have ran the code before and it worked fine but I am unsure about why it is giving me the NaNs and Infs error now 

### Actual Results

ValueError                                Traceback (most recent call last)
Input In [29], in <cell line: 4>()
      1 scrop.change_dtype('float32')
----> 4 scrop.decomposition(True, algorithm='svd', output_dimension=15)
      6 scrop.learning_results.save('LowSite4_pca_15_results')
      8 scrop.plot_decomposition_results()

File /usr/local/anaconda3/lib/python3.9/site-packages/hyperspy/learn/mva.py:451, in MVA.decomposition(self, normalize_poissonian_noise, algorithm, output_dimension, centre, auto_transpose, navigation_mask, signal_mask, var_array, var_func, reproject, return_info, print_info, svd_solver, copy, **kwargs)
    448 mean = None
    450 if algorithm == "SVD":
--> 451     factors, loadings, explained_variance, mean = svd_pca(
    452         data_,
    453         svd_solver=svd_solver,
    454         output_dimension=output_dimension,
    455         centre=centre,
    456         auto_transpose=auto_transpose,
    457         **kwargs,
    458     )
    460 elif algorithm == "MLPCA":
    461     if var_array is not None and var_func is not None:

File /usr/local/anaconda3/lib/python3.9/site-packages/hyperspy/learn/svd_pca.py:285, in svd_pca(data, output_dimension, svd_solver, centre, auto_transpose, svd_flip, **kwargs)
    282     else:
    283         auto_transpose = False
--> 285 U, S, V = svd_solve(
    286     data,
    287     output_dimension=output_dimension,
    288     svd_solver=svd_solver,
    289     svd_flip=svd_flip,
    290     **kwargs,
    291 )
    293 explained_variance = S ** 2 / N
    295 if auto_transpose is False:

File /usr/local/anaconda3/lib/python3.9/site-packages/hyperspy/learn/svd_pca.py:153, in svd_solve(data, output_dimension, svd_solver, svd_flip, u_based_decision, **kwargs)
    149     if not sklearn_installed:  # pragma: no cover
    150         raise ImportError(
    151             "svd_solver='randomized' requires scikit-learn to be installed"
    152         )
--> 153     U, S, V = randomized_svd(data, n_components=output_dimension, **kwargs)
    154 elif svd_solver == "arpack":
    155     if Version(scipy.__version__) < Version("1.4.0"):  # pragma: no cover

File /usr/local/anaconda3/lib/python3.9/site-packages/sklearn/utils/extmath.py:395, in randomized_svd(M, n_components, n_oversamples, n_iter, power_iteration_normalizer, transpose, flip_sign, random_state)
    391 if transpose:
    392     # this implementation is a bit faster with smaller shape[1]
    393     M = M.T
--> 395 Q = randomized_range_finder(
    396     M,
    397     size=n_random,
    398     n_iter=n_iter,
    399     power_iteration_normalizer=power_iteration_normalizer,
    400     random_state=random_state,
    401 )
    403 # project M to the (k + p) dimensional space using the basis vectors
    404 B = safe_sparse_dot(Q.T, M)

File /usr/local/anaconda3/lib/python3.9/site-packages/sklearn/utils/extmath.py:237, in randomized_range_finder(A, size, n_iter, power_iteration_normalizer, random_state)
    235     Q = safe_sparse_dot(A.T, Q)
    236 elif power_iteration_normalizer == "LU":
--> 237     Q, _ = linalg.lu(safe_sparse_dot(A, Q), permute_l=True)
    238     Q, _ = linalg.lu(safe_sparse_dot(A.T, Q), permute_l=True)
    239 elif power_iteration_normalizer == "QR":

File /usr/local/anaconda3/lib/python3.9/site-packages/scipy/linalg/decomp_lu.py:209, in lu(a, permute_l, overwrite_a, check_finite)
    152 """
    153 Compute pivoted LU decomposition of a matrix.
    154 
   (...)
    206 
    207 """
    208 if check_finite:
--> 209     a1 = asarray_chkfinite(a)
    210 else:
    211     a1 = asarray(a)

File /usr/local/anaconda3/lib/python3.9/site-packages/numpy/lib/function_base.py:488, in asarray_chkfinite(a, dtype, order)
    486 a = asarray(a, dtype=dtype, order=order)
    487 if a.dtype.char in typecodes['AllFloat'] and not np.isfinite(a).all():
--> 488     raise ValueError(
    489         "array must not contain infs or NaNs")
    490 return a

**ValueError: array must not contain infs or NaNs**

### Versions

```shell
Hyperspy 1.7.2
Scikit-learn 1.0.2
Conda version 22.9.0
```

COMMENT:
%matplotlib qt5
import hyperspy.api as hs
import numpy as np

import h5py

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.colors import to_rgb, LinearSegmentedColormap
from matplotlib import cm



import scipy
from scipy import ndimage as ndi

import skimage as ski
from skimage.segmentation import random_walker
from skimage.feature import peak_local_max
from skimage import exposure
from skimage import measure
from skimage import morphology as mph
from skimage import restoration
from skimage.filters import threshold_otsu
from skimage.color import rgb2gray
from skimage.transform import hough_line, hough_line_peaks, rescale
from skimage.color import label2rgb
from skimage import io

import pandas as pd

import sklearn as skl
from sklearn import preprocessing
from sklearn.decomposition import PCA, NMF
from sklearn.cluster import DBSCAN
from sklearn.mixture import GaussianMixture

MPL_COLORS_RGB = [to_rgb('C{}'.format(i)) for i in range(10)]

LINEWIDTH = 7.5
def full_width_figure(aspect_ratio):
    return plt.figure(figsize=(LINEWIDTH, aspect_ratio * LINEWIDTH))
def half_width_figure(aspect_ratio):
    return plt.figure(figsize=(0.5 * LINEWIDTH, 0.5 * aspect_ratio * LINEWIDTH))

def scatter_loadings(loadings, c='k', aspect_ratio=1):
    fig = full_width_figure(aspect_ratio)
    gridspec = plt.GridSpec(2, 2)
    ax01 = fig.add_subplot(gridspec[0, 0], aspect='equal')
    ax01.scatter(loadings[:, 0], loadings[:, 1], s=0.25, c=c, edgecolor='none')
    ax01.set_xlabel('Loading 0')
    
    ax21 = fig.add_subplot(gridspec[0, 1], aspect='equal')
    ax21.scatter(loadings[:, 2], loadings[:, 1], s=0.25, c=c, edgecolor='none')
    ax21.set_xlabel('Loading 2')
    ax21.set_ylabel('Loading 1')
    
    ax23 = fig.add_subplot(gridspec[1, 1], aspect='equal')
    ax23.scatter(loadings[:, 2], loadings[:, 3], s=0.25, c=c, edgecolor='none')
    ax23.set_ylabel('Loading 3')
    
    ax03 = fig.add_subplot(gridspec[1, 0], aspect='equal')
    ax03.scatter(loadings[:, 0], loadings[:, 3], s=0.25, c=c, edgecolor='none')
    
    width_ratio = np.diff(ax21.get_xlim()) / np.diff(ax01.get_xlim())
    height_ratio = np.diff(ax03.get_ylim()) / np.diff(ax01.get_ylim())
    gridspec.set_width_ratios([1, width_ratio])
    gridspec.set_height_ratios([1, height_ratio])
    
    plt.tight_layout()


s=hs.load('LowSite41024_1.rpl',signal_type="EDS_SEM")
s=s.transpose(navigation_axes=(1,2))
scrop=s.deepcopy()
spect=scrop.sum(axis=(0,1))


scrop.change_dtype('float32')
scrop.decomposition(True, algorithm='svd', output_dimension=15)
scrop.learning_results.save('LowSite4_pca_15_results')
scrop.plot_decomposition_results()
scrop.plot_explained_variance_ratio(log=True,vline=True)

Labels: Bug, Needs Triage