Skip to content

Conversation

@redeboer
Copy link
Member

Allow converting an iterable (not just a sequence) to DOT. This enables rendering for instance the output of a filter as DOT:

import graphviz
import qrules

reaction = qrules.generate_transitions(
    initial_state="J/psi(1S)",
    final_state=["K0", "Sigma+", "p~"],
    allowed_interaction_types="strong",
)
transitions = filter(
    lambda t: t.states[3].particle.mass > 1.75,
    reaction.transitions,
)
dot = qrules.io.asdot(transitions, collapse_graphs=True, render_final_state_id=False)
graphviz.Source(dot)

image

@redeboer redeboer added the 🐛 Bug Something isn't working label Jun 23, 2021
@redeboer redeboer added this to the 0.9.1 milestone Jun 23, 2021
@redeboer redeboer self-assigned this Jun 23, 2021
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@redeboer redeboer changed the title fix: fix: allow rendering iterables with graphviz Jun 23, 2021
@redeboer redeboer enabled auto-merge (squash) June 23, 2021 09:04
@codecov
Copy link

codecov bot commented Jun 23, 2021

Codecov Report

Merging #78 (2b55801) into main (b09cf7b) will decrease coverage by 0.02%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #78      +/-   ##
==========================================
- Coverage   93.57%   93.54%   -0.03%     
==========================================
  Files          14       14              
  Lines        3081     3084       +3     
==========================================
+ Hits         2883     2885       +2     
- Misses        198      199       +1     
Flag Coverage Δ
unittests 93.54% <80.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/qrules/io/_dot.py 79.25% <75.00%> (-0.21%) ⬇️
src/qrules/io/__init__.py 91.30% <100.00%> (ø)

@redeboer redeboer merged commit a2acefb into main Jun 23, 2021
@redeboer redeboer deleted the fix-dot branch June 23, 2021 09:07
redeboer added a commit to redeboer/ComPWA-qrules that referenced this pull request Apr 30, 2022
* ci: autoupdate pre-commit
* ci: update vscode setting python.languageServer
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.

2 participants