import numpy
import numexpr


def get_variance_from_sigma(
    dataset_sigma: numpy.ndarray, Dummy: float = 0.0
) -> numpy.ndarray:
    return numexpr.evaluate("where(dataset_sigma <= 0.0, Dummy, dataset_sigma ** 2)")


def is_dataset(dataset: numpy.ndarray) -> bool:
    if dataset is None:
        return False
    if isinstance(dataset, numpy.ndarray):
        if dataset.size == 0:
            return False
    return True
