-
Notifications
You must be signed in to change notification settings - Fork 12
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
Update examples #286
base: main
Are you sure you want to change the base?
Update examples #286
Conversation
- add 'examples' extra - pin python to < 3.13 due to numba installation
- fix all examples to use an CLI input file - updates related to ctapipe latest release - access IACTFile info from np.void Add max-events option to example plot_mc_pe.py Remove unnecessary imports improve options
3.13 is not yet supported by numba. But why is numba a topic here? |
Ah, I see, one of the examples i using ctapipe. However, this example is anyways terribly outdated. I'd just remove it |
some examples use ctapipe and I guess this is calling numba? |
there is a CI failure that I did not get locally (I use https://nektosact.com/) I'll try to see what it the problem |
cibuildwheel tries building for python 3.6... that's not been supported for a very long time now. |
It's three actually: examples/plot_events.py should I remove all three then? otherwise we should make a new job only for the examples in which we make a new matrix without 3.13 |
this works if you want |
OK I added a separate job only for examples where I removed python 3.13. I you confirm that you want to remove all 3 examples that use ctapipe I can re-merge the 2 jobs into 1 |
.github/workflows/ci.yml
Outdated
|
||
MPLBACKEND=agg | ||
|
||
# python iter_mc_events.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these commented out? These should work on any simtel test file in the resources
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not make them work unfortunately
some give StopIteration error, some EOF Error, etc
this one specifically for example gives me
➜ python iter_mc_events.py ../tests/resources/gamma_100gev_1216.eventio
/Users/michele/Software/pyeventio/src/eventio/simtel/simtelfile.py:251: UnknownObjectWarning: object type encountered, which is no handled at the moment: RunHeader[1200]
warnings.warn(
/Users/michele/Software/pyeventio/src/eventio/simtel/simtelfile.py:251: UnknownObjectWarning: object type encountered, which is no handled at the moment: TelescopeDefinition[1201]
warnings.warn(
/Users/michele/Software/pyeventio/src/eventio/simtel/simtelfile.py:251: UnknownObjectWarning: object type encountered, which is no handled at the moment: EventHeader[1202](event_id=1)
warnings.warn(
/Users/michele/Software/pyeventio/src/eventio/simtel/simtelfile.py:251: UnknownObjectWarning: object type encountered, which is no handled at the moment: ArrayOffsets[1203]
warnings.warn(
/Users/michele/Software/pyeventio/src/eventio/simtel/simtelfile.py:251: UnknownObjectWarning: object type encountered, which is no handled at the moment: EventEnd[1209](event_id=1)
warnings.warn(
/Users/michele/Software/pyeventio/src/eventio/simtel/simtelfile.py:251: UnknownObjectWarning: object type encountered, which is no handled at the moment: RunEnd[1210]
warnings.warn(
Traceback (most recent call last):
File "/Users/michele/Software/pyeventio/examples/iter_mc_events.py", line 17, in <module>
with SimTelFile(args.inputfile) as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/michele/Software/pyeventio/src/eventio/simtel/simtelfile.py", line 128, in __init__
self.next_low_level()
File "/Users/michele/Software/pyeventio/src/eventio/simtel/simtelfile.py", line 150, in next_low_level
o = next(self)
^^^^^^^^^^
File "/Users/michele/Software/pyeventio/src/eventio/base.py", line 115, in __next__
read_sync_marker(self)
File "/Users/michele/Software/pyeventio/src/eventio/base.py", line 183, in read_sync_marker
check_size_or_raise(sync, constants.SYNC_MARKER_SIZE, zero_ok=True)
File "/Users/michele/Software/pyeventio/src/eventio/base.py", line 166, in check_size_or_raise
raise StopIteration
StopIteration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah with camsettings_v6.simtel.zst seems to work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok sorry yes at least iter_mc_events can be commented out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plot_light_on_ground_by_particle.py
and plot_light_on_ground_by_particle.py
tell me there is no emitter
in files similar to the one I use for plot_light_on_ground.py
➜ python examples/plot_light_on_ground_by_particle.py tests/resources/3_gammas_reuse_5.dat
Traceback (most recent call last):
File "/Users/michele/Software/pyeventio/examples/plot_light_on_ground_by_particle.py", line 113, in <module>
main()
File "/Users/michele/Software/pyeventio/examples/plot_light_on_ground_by_particle.py", line 44, in main
mask = np.isclose(emitter['mass'], mass)
~~~~~~~^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
read_all_objects.py
instead returns this with many different files
Traceback (most recent call last):
File "/Users/michele/Software/pyeventio/examples/read_all_objects.py", line 16, in <module>
o.parse()
File "/Users/michele/Software/pyeventio/src/eventio/base.py", line 346, in parse
raise ValueError('This object only contains subobjects')
ValueError: This object only contains subobjects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tell me there is no emitter in files
We indeed have no file with emitter
information. I'll produce one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the only one missing is read_all_objects.py
which gives me the same error no matter the test file
Examples from the README and in general from the examples folder seem to be outdated since #131.
Here I attempted to fix all of them, but for some (commented out at the moment from the list in the CI job) I could not find a suitable test file (or maybe there are deeper changes to apply to those examples). For a couple of examples I added a max-events option due to resource file truncations.
In order to ease the user experience, and also for the CI to not worry about specific dependencies, I created anew extra called 'examples'.
I noticed that when using python 3.13 something is pulling numba > 0.56 (either astropy or ctapipe) and this makes the installation crash. I tried different numba versions, but in the end limiting python to 3.12 proved to be the more most stable solution.
P.S: there is no documentation for this package, so I do not know if it makes sense, but you couldadd jupytext and make the examples folder a sphinx-gallery