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

docs: LHE file writing examples #256

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

APN-Pucky
Copy link
Collaborator

@APN-Pucky APN-Pucky commented Sep 22, 2024

This adds two notebooks one showing how to write custom LHE files with a simple Monte Carlo event generator example and one filtering out events with a Z boson in the event record.

Further, the previously empty class LHEFile now contains two fields: info and events with a write function to a output stream. Contrary to the previous conversion to a string and then writing the string to the file, this approach allows us to write large filtered files directly per event to disk without consuming much memory.

One minor source for confusion might still remain: write_lhe_file takes a init and events while read_lhe_file returns a LHEFile. I'd change write_lhe_file, introduced in recent 0.9.0, to only require an LHEFile. The same then applies to write_lhe_string.

Closes: #251

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@APN-Pucky APN-Pucky marked this pull request as draft September 22, 2024 16:11
Copy link

codecov bot commented Sep 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.79%. Comparing base (0152e61) to head (bb16193).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #256      +/-   ##
==========================================
+ Coverage   91.17%   91.79%   +0.62%     
==========================================
  Files           2        2              
  Lines         306      317      +11     
  Branches       83       83              
==========================================
+ Hits          279      291      +12     
  Misses         17       17              
+ Partials       10        9       -1     
Flag Coverage Δ
unittests-3.10 91.48% <100.00%> (+0.63%) ⬆️
unittests-3.11 91.48% <100.00%> (+0.63%) ⬆️
unittests-3.12 91.48% <100.00%> (+0.63%) ⬆️
unittests-3.8 91.48% <100.00%> (+0.63%) ⬆️
unittests-3.9 91.48% <100.00%> (+0.63%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@APN-Pucky APN-Pucky changed the title LHE file writing examples docs: LHE file writing examples Sep 22, 2024
@APN-Pucky APN-Pucky marked this pull request as ready for review September 22, 2024 16:54
@eduardo-rodrigues
Copy link
Member

Hello @APN-Pucky. This sounds great. I will try and have a proper look later in the week.

May I suggest that you also update the README with a paragraph or so about writing? One could even explicitly mention the existence of notebooks for how to get started with examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add documentation for event writing
2 participants