Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Live graphing in ODECSolver using wrong decoder #755

Merged
merged 4 commits into from
Apr 13, 2022

Conversation

jtcooper10
Copy link
Collaborator

This PR should allow full support for live graphing for the ODECSolver and TauHybridCSolver.

Fixes

  • Replaced incorrect decoder in ODECSolver (IterativeSimDecoder is required for live graphing)
  • Added missing numpy import to TauHybridCSolver

Closes #659

- Added missing import to `TauHybridCSolver`
- Added correct decoder for `ODECSolver`
@jtcooper10 jtcooper10 added the bug Something isn't working label Mar 24, 2022
@jtcooper10 jtcooper10 added this to the 1.6.9 milestone Mar 24, 2022
@jtcooper10 jtcooper10 requested a review from BryanRumsey March 24, 2022 18:48
@jtcooper10 jtcooper10 self-assigned this Mar 24, 2022
Copy link
Contributor

@BryanRumsey BryanRumsey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error occurred when plotting results from ODECSolver

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/var/folders/z4/bqpnd_kx7xg3s3c9jtz0pnfh0000gn/T/ipykernel_9401/4213838279.py in <module>
----> 1 results3.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 (6001,) and (10001,)

It seems that the end_time is not being read in correctly in the IterativeSimDecoder.read. This issue is only present in the ODECsolver

@briandrawert briandrawert modified the milestones: 1.6.9, 1.6.10 Apr 11, 2022
@briandrawert briandrawert modified the milestones: 1.6.10, 1.6.9 Apr 13, 2022
@BryanRumsey BryanRumsey self-requested a review April 13, 2022 21:07
@BryanRumsey BryanRumsey merged commit dcc51a0 into develop Apr 13, 2022
@BryanRumsey BryanRumsey linked an issue Apr 14, 2022 that may be closed by this pull request
@BryanRumsey BryanRumsey mentioned this pull request Apr 14, 2022
@briandrawert briandrawert deleted the fix/odec-live-graphing-decoder branch July 25, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ODECSolver needs support live graphing
3 participants