StochSS / GillesPy2

Modeling toolkit for biochemical simulation
http://gillespy2.readthedocs.io/
GNU General Public License v3.0
72 stars 32 forks source link

Keyboard interrupt doesn’t work correctly for pause resume in C solvers #662

Closed BryanRumsey closed 1 month ago

BryanRumsey commented 2 years ago

The simulation was stopped at t=4875 and this error was raised

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/ipykernel_9812/979225289.py in <module>
----> 1 results2.plot()

~/Documents/GillesPy2/gillespy2/core/results.py in plot(self, index, xaxis_label, xscale, yscale, yaxis_label, style, title, show_title, show_legend, multiple_graphs, included_species_list, save_png, figsize)
    406                     _plot_iterate(trajectory, included_species_list=included_species_list, show_labels=False)
    407                 else:
--> 408                     _plot_iterate(trajectory, included_species_list=included_species_list)
    409 
    410             if show_legend:

~/Documents/GillesPy2/gillespy2/core/results.py in _plot_iterate(self, show_labels, included_species_list)
     48                 label = ""
     49 
---> 50             plt.plot(self.data['time'], self.data[species], label=label, color=line_color)
     51 
     52 

/opt/homebrew/lib/python3.9/site-packages/matplotlib/pyplot.py in plot(scalex, scaley, data, *args, **kwargs)
   3017 @_copy_docstring_and_deprecators(Axes.plot)
   3018 def plot(*args, scalex=True, scaley=True, data=None, **kwargs):
-> 3019     return gca().plot(
   3020         *args, scalex=scalex, scaley=scaley,
   3021         **({"data": data} if data is not None else {}), **kwargs)

/opt/homebrew/lib/python3.9/site-packages/matplotlib/axes/_axes.py in plot(self, scalex, scaley, data, *args, **kwargs)
   1603         """
   1604         kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
-> 1605         lines = [*self._get_lines(*args, data=data, **kwargs)]
   1606         for line in lines:
   1607             self.add_line(line)

/opt/homebrew/lib/python3.9/site-packages/matplotlib/axes/_base.py in __call__(self, data, *args, **kwargs)
    313                 this += args[0],
    314                 args = args[1:]
--> 315             yield from self._plot_args(this, kwargs)
    316 
    317     def get_next_color(self):

/opt/homebrew/lib/python3.9/site-packages/matplotlib/axes/_base.py in _plot_args(self, tup, kwargs, return_kwargs)
    499 
    500         if x.shape[0] != y.shape[0]:
--> 501             raise ValueError(f"x and y must have same first dimension, but "
    502                              f"have shapes {x.shape} and {y.shape}")
    503         if x.ndim > 2 or y.ndim > 2:

ValueError: x and y must have same first dimension, but have shapes (4876,) and (6001,)
BryanRumsey commented 2 years ago

May have been fixed in release 1.6.8. Test to confirm

briandrawert commented 1 year ago

Related to #612