PEtab-dev / libpetab-python

Python package for working with PEtab files
https://libpetab-python.readthedocs.io
MIT License
14 stars 5 forks source link

test_visualization_with__t_inf fails #206

Closed dweindl closed 1 year ago

dweindl commented 1 year ago

see https://github.com/PEtab-dev/libpetab-python/actions/runs/5184704600/jobs/9343859604

Possibly related to changes in numpy

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <petab.visualize.plotter.MPLPlotter object at 0x0000024F18D70D90>
ax = <Axes: >
dataplot = DataPlot({'datasetId': 'model1_data1_pS6_tot', 'yValues': 'pS6_tot', 'xValues': 'time', 'yOffset': 0, 'legendEntry': 'EGF 0.1 ng/ml - pS6_tot', 'xOffset': 0})
plotTypeData = 'replicate'
splitaxes_params = {'ax_finite_right_limit': 1800.0, 'ax_inf': <Axes: >, 'ax_left_limit': 0.0, 't_inf': 1980.0}

    def generate_lineplot(
            self,
            ax: matplotlib.axes.Axes,
            dataplot: DataPlot,
            plotTypeData: str,
            splitaxes_params: dict
    ) -> Tuple[matplotlib.axes.Axes, matplotlib.axes.Axes]:
        """
        Generate lineplot.

        It is possible to plot only data or only simulation or both.

        Parameters
        ----------
        ax:
            Axis object.
        dataplot:
            Visualization settings for the plot.
        plotTypeData:
            Specifies how replicates should be handled.
        splitaxes_params:

        """
        simu_color = None
        measurements_to_plot, simulations_to_plot = \
            self.data_provider.get_data_to_plot(dataplot,
                                                plotTypeData == PROVIDED)
        noise_col = self._error_column_for_plot_type_data(plotTypeData)

        label_base = dataplot.legendEntry

        # check if t_inf is there
        # todo: if only t_inf, adjust appearance for that case
        plot_at_t_inf = (measurements_to_plot is not None and
                         measurements_to_plot.inf_point) or (
                simulations_to_plot is not None and
                simulations_to_plot.inf_point)

        if measurements_to_plot is not None \
                and not measurements_to_plot.data_to_plot.empty:
            # plotting all measurement data

            p = None
            if plotTypeData == REPLICATE:
                replicates = np.stack(
                    measurements_to_plot.data_to_plot.repl.values)

                # plot first replicate
                p = ax.plot(
                    measurements_to_plot.conditions,
>                   replicates[:, 0],
                    linestyle='-.',
                    marker='x', markersize=10, label=label_base
                )
E               IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

petab\visualize\plotter.py:123: IndexError