# Path: asammdf/blocks/utils.py
# def plausible_timestamps(
#     t: NDArray[Any],
#     minimum: float,
#     maximum: float,
#     exp_min: int = -15,
#     exp_max: int = 15,
# ) -> tuple[bool, NDArray[bool_]]:
#     """check if the time stamps are plausible
# 
#     Parameters
#     ----------
#     t : np.array
#         time stamps array
#     minimum : float
#         minimum plausible time stamp
#     maximum : float
#         maximum plausible time stamp
#     exp_min (-15) : int
#         minimum plausible exponent used for the time stamps float values
#     exp_max (15) : int
#         maximum plausible exponent used for the time stamps float values
# 
#     Returns
#     -------
#     all_ok, idx : (bool, np.array)
#         the *all_ok* flag to indicate if all the time stamps are ok; this can be checked
#         before applying the indexing array.
#     """
# 
#     exps = np.log10(t)
#     idx = (
#         (~np.isnan(t))
#         & (~np.isinf(t))
#         & (t >= minimum)
#         & (t <= maximum)
#         & (exps >= exp_min)
#         & (exps <= exp_max)
#     )
#     if not np.all(idx):
#         all_ok = False
#         return all_ok, idx
#     else:
#         all_ok = True
#         return all_ok, idx


import logging
from ..blocks.utils import plausible_timestamps
    from PyQt5 import QtWidgets
    from .widgets.plot_standalone import PlotWindow



def plot(signals, title="", validate=True, index_only=False):
    """create a stand-alone plot using the input signal or signals

    Arguments
    ---------
    signals : iterable | Signal

    title (""): str
        window title

    validate (True): bool
        consider the invalidation bits

    """

    if QT:
        app = QtWidgets.QApplication([])
        app.setOrganizationName("py-asammdf")
        app.setOrganizationDomain("py-asammdf")
        app.setApplicationName("py-asammdf")

        if validate:
            if isinstance(signals, (tuple, list)):
                signals = [signal.validate() for signal in signals]
            else:
                signals = [signals.validate()]

        for signal in signals:

# Path: asammdf/blocks/utils.py
# def plausible_timestamps(
#     t: NDArray[Any],
#     minimum: float,
#     maximum: float,
#     exp_min: int = -15,
#     exp_max: int = 15,
# ) -> tuple[bool, NDArray[bool_]]:
#     """check if the time stamps are plausible
# 
#     Parameters
#     ----------
#     t : np.array
#         time stamps array
#     minimum : float
#         minimum plausible time stamp
#     maximum : float
#         maximum plausible time stamp
#     exp_min (-15) : int
#         minimum plausible exponent used for the time stamps float values
#     exp_max (15) : int
#         maximum plausible exponent used for the time stamps float values
# 
#     Returns
#     -------
#     all_ok, idx : (bool, np.array)
#         the *all_ok* flag to indicate if all the time stamps are ok; this can be checked
#         before applying the indexing array.
#     """
# 
#     exps = np.log10(t)
#     idx = (
#         (~np.isnan(t))
#         & (~np.isinf(t))
#         & (t >= minimum)
#         & (t <= maximum)
#         & (exps >= exp_min)
#         & (exps <= exp_max)
#     )
#     if not np.all(idx):
#         all_ok = False
#         return all_ok, idx
#     else:
#         all_ok = True
#         return all_ok, idx


# Path: asammdf/gui/plot.py
import logging
from ..blocks.utils import plausible_timestamps
    from PyQt5 import QtWidgets
    from .widgets.plot_standalone import PlotWindow



def plot(signals, title="", validate=True, index_only=False):
    """create a stand-alone plot using the input signal or signals

    Arguments
    ---------
    signals : iterable | Signal

    title (""): str
        window title

    validate (True): bool
        consider the invalidation bits

    """

    if QT:
        app = QtWidgets.QApplication([])
        app.setOrganizationName("py-asammdf")
        app.setOrganizationDomain("py-asammdf")
        app.setApplicationName("py-asammdf")

        if validate:
            if isinstance(signals, (tuple, list)):
                signals = [signal.validate() for signal in signals]
            else:
                signals = [signals.validate()]

        for signal in signals:

            all_ok, idx = plausible_timestamps(signal.timestamps, -1e6, 1e9)
