Skip to content
Snippets Groups Projects

Draft: Added support for plotting result from many simulations. Solves #209

Open Petter Källström requested to merge MultiSimPlot into master
4 unresolved threads

Merge request reports

Requires 1 approval from eligible users and Protect master.
Merge blocked: 4 checks failed
All required approvals must be given.
Merge request must not be draft.
Merge conflicts must be resolved.
Merge request must be rebased, because a fast-forward merge is not possible.

Merge details

  • The source branch is 205 commits behind the target branch.
  • 1 commit will be added to master.
  • Source branch will be deleted.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
62 64 self.setWindowTitle(title)
63 65 self._auto_redraw = False
64 66
67 ########### Flattening sim_result, if it is a list of results #######
68 # take: sim_result (possibly on form ['name1', simres1, 'name2', simres2, ...]
69 # generate: sim_result (dict)
70 if type(sim_result) == Simulation:
  • 62 64 self.setWindowTitle(title)
    63 65 self._auto_redraw = False
    64 66
    67 ########### Flattening sim_result, if it is a list of results #######
    68 # take: sim_result (possibly on form ['name1', simres1, 'name2', simres2, ...]
    69 # generate: sim_result (dict)
    70 if type(sim_result) == Simulation:
    71 sim_result = sim_result._results
    72 assert type(sim_result) == dict, TypeError(
    73 "Parsing sim_result as a Simulation, but the _result seems broken."
    74 )
    75 elif type(sim_result) == list:
  • Oscar Gustafsson marked this merge request as draft

    marked this merge request as draft

  • added 1 commit

    • 53e8fd7a - plot_window: changed type(obj)==xxx to isinstance(obj, xxx)

    Compare with previous version

  • added 1 commit

    • 9475ae93 - PlotWindow: Added `add_result(...)`. Refactored slightly

    Compare with previous version

  • added 1 commit

    • eba4e307 - PlotWindow: Added `add_result(...)`. Refactored slightly

    Compare with previous version

  • 276 ix = 0
    277 self._auto_redraw = False
    278 for key, res in result.items():
    279 key2 = name + "." + key
    280 ischecked = Qt.CheckState.Unchecked
    281 if re.fullmatch(r"[0-9]+", key):
    282 key2 = name + '.out' + key
    283 ischecked = Qt.CheckState.Checked
    284
    285 if len(res) <= 100:
    286 fmt = markers[ix] + '-'
    287 ix = (ix + 1) % len(markers)
    288 else:
    289 fmt = '-'
    290
    291 def addline(key, vector, checked):
  • 246 367
    247 368 def start_simulation_dialog(
    248 369 sim_results: Dict[str, List[complex]], sfg_name: Optional[str] = None
    370 ):
    371 """Deprecated. Use `show_simulation_result` instead."""
    • Suggested change
      371 """Deprecated. Use `show_simulation_result` instead."""
      371 """
      372 .. deprecated::
      373 Use :func:`show_simulation_result` instead.
      374 """

      This will add a deprecation notice in the docs and link to the correct function. (Although we may just drop it as well, considering the status of the project, not having official releases etc. But maybe wait with that until after the lab series though...)

    • Author Maintainer

      When implemented, spyder warns about it. D205 "One blank line require between summary..." and D400 "First line should end with a period (not ':')". No big deal, but the warning marks are annoying, and disturbs my focus on the code.

    • Petter Källström changed this line in version 5 of the diff

      changed this line in version 5 of the diff

    • I think the reason is that one should still have a one-line summary first in the doc-string. Even for deprecated functions.

    • Please register or sign in to reply
  • I'm wondering if one should be able to do something like:

    >>> sim_dialog = sim.show()
    >>> # Simulate more things
    >>> sim_dialog.add_result(new_results)

    ?

    Or is that possible now? (Doesn't have to be part of this MR though.)

  • added 1 commit

    • a2b3fa86 - plot_window: Updated Oscars suggestions, and some more.

    Compare with previous version

  • Please register or sign in to reply
    Loading