gridlib.plot package

Submodules

gridlib.plot.heatmap module

Module with functions to plot event heatmap and state heatmap.

gridlib.plot.heatmap.event_spectrum_heatmap(fit_result_full: Dict[str, Dict[str, Union[ndarray, float]]], fit_results_resampled: List[Dict[str, Dict[str, Union[ndarray, float]]]], fit_key: str = 'grid', scale: str = 'log', threshold: float = 1e-05, xlim: Optional[Tuple[float, float]] = None, ylim: Optional[Tuple[float, float]] = None, figsize: Tuple[float, float] = (6, 4), cm_max: int = 20, cm_step: int = 2, add_legend: bool = True)[source]

Function plots the event spectrum heatmap for resampled data and plots the full data points as circles.

Parameters
  • fit_result_full (Dict[str, Dict[str, Union[np.ndarray, float]]]) –

    A dictionary mapping keys (fitting procedure) to the corresponding fit results for the full data. For example:

    {
        "grid": {
            "k": array([1.00000000e-03, 1.04737090e-03, ...]),
            "s": array([3.85818587e-17, 6.42847878e-18, ...]),
            "a": 0.010564217803906671,
            "loss": 0.004705659331508584,
        },
    }
    

  • fit_results_resampled (List[Dict[str, Dict[str, Union[np.ndarray, float]]]]) –

    A list consisting of dictionaries mapping keys (fitting procedure) to the corresponding fit results for the resampled data. For example:

    [
        {
            "grid": {
                "k": array([1.00000000e-03, 1.04737090e-03, ...]),
                "s": array([3.85818587e-17, 6.42847878e-18, ...]),
                "a": 0.010564217803906671,
                "loss": 0.004705659331508584,
            },
        },
        ...
    ]
    

  • fit_key (str, optional) – The mapping key (fitting procedure) used to plot the resampling results from, by default “grid”.

  • scale ({"log", "linear"}, optional) – The scale of the x-axis. If scale is set to “log” than the x-axis will be logarithmic. If scale is set to “linear”, the x-axis will be linear, by default “log”.

  • threshold (float, optional) – Minimum weight value that is shown for full data spectrum, by default 10e-6.

  • xlim (Tuple[float, float], optional) – A tuple setting the x-axis limits. If the value is set to None, there are no limits, by default None.

  • ylim (Tuple[float, float], optional) – A tuple setting the y-axis limits. If the value is set to None, there are no limits, by default None.

  • figsize (Tuple[float, float], optional) – Width, height of the figure in inches, default is (6, 4).

  • cm_max (int, optional) – Maximum value of the colormap/colorbar, by default 20.

  • cm_step (int, optional) – Step size of the colormap, by default 2.

  • add_legend (bool, optional) – If True, a legend is added to the figure, by default True.

Returns

gridlib.plot.heatmap.state_spectrum_heatmap(fit_result_full: Dict[str, Union[ndarray, float]], fit_results_resampled: List[Dict[str, Union[ndarray, float]]], fit_key: str = 'grid', scale: str = 'log', threshold: float = 1e-05, xlim: Optional[Tuple[float, float]] = None, ylim: Optional[Tuple[float, float]] = None, figsize: Tuple[float, float] = (6, 4), cm_max: int = 20, cm_step: int = 2, add_legend: bool = True)[source]

Function plots the state spectrum heatmap for resampled data and plots the full data points as circles.

Parameters
  • fit_result_full (Dict[str, Dict[str, Union[np.ndarray, float]]]) –

    A dictionary mapping keys (fitting procedure) to the corresponding fit results for the full data. For example:

    {
        "grid": {
            "k": array([1.00000000e-03, 1.04737090e-03, ...]),
            "s": array([3.85818587e-17, 6.42847878e-18, ...]),
            "a": 0.010564217803906671,
            "loss": 0.004705659331508584,
        },
    }
    

  • fit_results_resampled (List[Dict[str, Dict[str, Union[np.ndarray, float]]]]) –

    A list consisting of dictionaries mapping keys (fitting procedure) to the corresponding fit results for the resampled data. For example:

    [
        {
            "grid": {
                "k": array([1.00000000e-03, 1.04737090e-03, ...]),
                "s": array([3.85818587e-17, 6.42847878e-18, ...]),
                "a": 0.010564217803906671,
                "loss": 0.004705659331508584,
            },
        },
        ...
    ]
    

  • fit_key (str, optional) – The mapping key (fitting procedure) used to plot the resampling results from, by default “grid”.

  • scale ({"log", "linear"}, optional) – The scale of the x-axis. If scale is set to “log” than the x-axis will be logarithmic. If scale is set to “linear”, the x-axis will be linear, by default “log”.

  • threshold (float, optional) – Minimum weight value that is shown for full data spectrum, by default 10e-6.

  • xlim (Tuple[float, float], optional) – A tuple setting the x-axis limits. If the value is set to None, there are no limits, by default None.

  • ylim (Tuple[float, float], optional) – A tuple setting the y-axis limits. If the value is set to None, there are no limits, by default None.

  • figsize (Tuple[float, float], optional) – Width, height of the figure in inches, default is (6, 4).

  • cm_max (int, optional) – Maximum value of the colormap/colorbar, by default 20.

  • cm_step (int, optional) – Step size of the colormap, by default 2.

  • add_legend (bool, optional) – If True, a legend is added to the figure, by default True.

Returns

gridlib.plot.spectrum module

Module with functions to plot event spectrum and state spectrum.

gridlib.plot.spectrum.event_spectrum(fit_values, scale: str = 'log', threshold: float = 0.0, xlim: Optional[Tuple[float, float]] = None, ylim: Optional[Tuple[float, float]] = None, figsize: Tuple[float, float] = (6, 4), color=None, add_legend: bool = True)[source]

Function plots the event spectrum of different fit values in one figure.

Parameters
  • key_to_k_and_weight (Dict[str, Dict[str, np.ndarray]]) –

    The decay rates and weights wrapped in the following structure:
    {
    “label”: {

    “k”: np.ndarray with the decay rates, “weight”: np.ndarray with the respective weights

    }

    }

  • scale ({"log", "linear"}, optional) – The scale on the x-axis. The default value is “log”.

  • threshold (float, optional) – The weight threshold for plotting lines, by default 0.0.

  • xlim (Tuple[float, float], optional) – A tuple of the x-axis limits, by default None.

  • ylim (Tuple[float, float], optional) – A tuple of the y-axis limits, by default None.

  • figsize (Tuple[float, float], optional) – A tuple of the figure size, by default (6, 4).

  • color (color or sequence of colors, optional) – The color or colors to use for the plotting. The standard gridlib colors are used if the value is set to None. The value is by default None.

  • add_legend (bool, optional) – Indicates whether the legend needs to be plotted, by default True.

Returns

gridlib.plot.spectrum.state_spectrum(fit_values, scale: str = 'log', threshold: float = 0.0, xlim: Optional[Tuple[float, float]] = None, ylim: Optional[Tuple[float, float]] = None, figsize: Tuple[float, float] = (6, 4), color=None, add_legend: bool = True)[source]

Function plots the state spectrum of different fit values in one figure.

Parameters
  • key_to_k_and_weight (Dict[str, Dict[str, np.ndarray]]) –

    The decay rates and weights wrapped in the following structure:
    {
    “label”: {

    “k”: np.ndarray with the decay rates, “weight”: np.ndarray with the respective weights

    }

    }

  • scale ({"log", "linear"}, optional) – The scale on the x-axis. The default value is “log”.

  • threshold (float, optional) – The weight threshold for plotting lines, by default 0.0.

  • xlim (Tuple[float, float], optional) – A tuple of the x-axis limits, by default None.

  • ylim (Tuple[float, float], optional) – A tuple of the y-axis limits, by default None.

  • figsize (Tuple[float, float], optional) – A tuple of the figure size, by default (6, 4).

  • color (color or sequence of colors, optional) – The color or colors to use for the plotting. The standard gridlib colors are used if the value is set to None. The value is by default None.

  • add_legend (bool, optional) – Indicates whether the legend needs to be plotted, by default True.

Returns

gridlib.plot.survival_function module

Module with functions to plot survival functions.

gridlib.plot.survival_function.data_sf(data: Dict[str, Dict[str, ndarray]], process_data_flag: bool = True, xlim: Optional[Tuple[float, float]] = None, ylim: Optional[Tuple[float, float]] = None, figsize: Tuple[float, float] = (6, 4), kwargs_plot: Optional[Dict] = None, kwargs_text: Optional[Dict] = None)[source]

Function plots a single data dictionary

gridlib.plot.survival_function.data_sf_multiple(data: Dict[str, Dict[str, ndarray]], process_data_flag: bool = True, xlim: Optional[Tuple[float, float]] = None, ylim: Optional[Tuple[float, float]] = None, figsize: Tuple[float, float] = (6, 4), kwargs_plot: Optional[Dict] = None, kwargs_text: Optional[Dict] = None)[source]

Function plots a single or multiple data dictionaries

gridlib.plot.survival_function.data_sf_vs_grid(data: Dict[str, Dict[str, ndarray]], fit_values_grid: Dict[str, Dict[str, ndarray]], process_data_flag: bool = True, xlim: Optional[Tuple[float, float]] = None, ylim: Optional[Tuple[float, float]] = None, figsize: Tuple[float, float] = (6, 4), kwargs_plot: Optional[Dict] = None, kwargs_text: Optional[Dict] = None)[source]

Function plots the survival function of the true data and the GRID curves.

Parameters
  • data (Dict[str, Dict[str, np.ndarray]]) –

    Survival function data for every time-lapse condition with the following data structure:

    {
    f”{t_tl}”: {

    “time”: np.ndarray with the time points, “value”: np.ndarray with the survival function values,

    }

    }

  • xlim (Tuple[float, float] = None, ylim: Tuple[float, float] = None, path_save: str or pathlib.Path) – Path designates the place where the figure should be saved if a value is set. The figure is not saved if the values is set to None. (default None)

Return type

None

gridlib.plot.survival_function.data_sf_vs_multi_exp(data: Dict[str, Dict[str, ndarray]], fit_values_multi_exp: Dict[str, Dict[str, ndarray]], process_data_flag: bool = True, xlim: Optional[Tuple[float, float]] = None, ylim: Optional[Tuple[float, float]] = None, figsize: Tuple[float, float] = (6, 4), kwargs_plot: Optional[Dict] = None, kwargs_text: Optional[Dict] = None) Tuple[source]

Function plots the survival function of the true data and the multi-exponential curves.

Parameters
  • data (Dict[str, Dict[str, np.ndarray]]) –

    Data of the survival function from real data with the following data structure: {

    f”{t_tl}”: {

    “time”: np.ndarray with all the time values, “value”: np.ndarray with all the survival function values corresponding to the

    respective time value

    }

    }

  • data_multi_exp (Dict[str, Dict[str, np.ndarray]]) –

    Survival function data for time-lapse conditions with the following data structure:

    {
    f”{t_tl}”: {

    “time”: np.ndarray with the time points, “value”: np.ndarray with the survival function values,

    }

Module contents