def METHOD_NAME(shape, dim, dtype, metadata):
    data = np.arange(np.product(shape)).reshape(shape).astype(dtype)
    if dim == 1:
        if len(shape) > 2:
            s = hs.signals.EELSSpectrum(data)
            if metadata:
                s.set_microscope_parameters(
                    beam_energy=100.0, convergence_angle=1.0, collection_angle=10.0
                )
        else:
            s = hs.signals.EDSTEMSpectrum(data)
            if metadata:
                s.set_microscope_parameters(
                    beam_energy=100.0,
                    live_time=1.0,
                    tilt_stage=2.0,
                    azimuth_angle=3.0,
                    elevation_angle=4.0,
                    energy_resolution_MnKa=5.0,
                )
    else:
        s = hs.signals.BaseSignal(data).transpose(signal_axes=dim)
    if metadata:
        s.metadata.General.date = "2016-08-06"
        s.metadata.General.time = "10:55:00"
        s.metadata.General.title = "Test title"
    for i, axis in enumerate(s.axes_manager._axes):
        i += 1
        axis.offset = i * 0.5
        axis.scale = i * 100
        axis.name = "%i" % i
        if axis.navigate:
            axis.units = "m"
        else:
            axis.units = "eV"
    return s