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

Merged
merged 17 commits into from
Oct 18, 2024
Merged

Conversation

APN-Pucky
Copy link
Member

@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.87%. Comparing base (6f85efd) to head (5432f66).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #256      +/-   ##
==========================================
+ Coverage   91.77%   91.87%   +0.09%     
==========================================
  Files           2        2              
  Lines         304      320      +16     
  Branches       81       64      -17     
==========================================
+ Hits          279      294      +15     
  Misses         17       17              
- Partials        8        9       +1     
Flag Coverage Δ
unittests-3.10 91.87% <100.00%> (+0.42%) ⬆️
unittests-3.11 91.87% <100.00%> (+0.42%) ⬆️
unittests-3.12 91.87% <100.00%> (+0.42%) ⬆️
unittests-3.13 91.87% <100.00%> (+0.42%) ⬆️
unittests-3.8 91.87% <100.00%> (+0.42%) ⬆️
unittests-3.9 91.87% <100.00%> (+0.42%) ⬆️

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.

README.md Outdated Show resolved Hide resolved
@eduardo-rodrigues
Copy link
Member

I did not check the notebooks as I cannot use ReviewNB. But the rest looks great. On to @matthewfeickert.

@APN-Pucky
Copy link
Member Author

In the last commit, I deprecated two functions that I introduced within v0.9.0 that used lheinit and lheevents in favour of just lheevent, that contains both.

@APN-Pucky APN-Pucky added the docs Documentation related label Oct 8, 2024
Copy link
Member

@eduardo-rodrigues eduardo-rodrigues left a comment

Choose a reason for hiding this comment

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

I'm re-approving.

I suggest you wait until, say, Wednesday, in case @matthewfeickert finds a bit of time to look as well, else you go ahead and merge.

Nice work!

@eduardo-rodrigues
Copy link
Member

Hi @APN-Pucky, I reckon you can go ahead and then release a new version so that we have support for 3.13 out there :-). Advance thanks.

@APN-Pucky APN-Pucky merged commit d4231f5 into scikit-hep:main Oct 18, 2024
14 checks passed
@APN-Pucky
Copy link
Member Author

Good I'll try to follow https://www.youtube.com/watch?v=tsAWDumpcW8 and write a developer.md for #177 afterwards.

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

Successfully merging this pull request may close these issues.

Add documentation for event writing
2 participants