You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the main advantages of using Python in the CLI is that we can let the user write some Python code to filter the raw event produced by impy. We add a command line argument to the CLI, which points to user-defined a Python file which contains the filter code, which applies transformations on the EventData object.
impy --filter=my_filter.py ...
my_filter.py is a normal Python file. We expect that a function filter(event) is defined. It should accept the original event and return a modified event. Example:
# keep only long-lived particlesfromimpy.constantsimportlong_liveddeffilter(event):
apid=np.abs(event.pid)
ma=Falseforllpidinlong_lived:
ma|=apid==llpidreturnevent[ma] # or return None to discard the event completely
We can ship a couple of standard filters with the library, like we already do (filters like EventData.final_charged() etc. ... already exist), but it would be very useful to expose this generic functionality via the CLI.
The text was updated successfully, but these errors were encountered:
One of the main advantages of using Python in the CLI is that we can let the user write some Python code to filter the raw event produced by impy. We add a command line argument to the CLI, which points to user-defined a Python file which contains the filter code, which applies transformations on the EventData object.
impy --filter=my_filter.py ...
my_filter.py is a normal Python file. We expect that a function
filter(event)
is defined. It should accept the original event and return a modified event. Example:We can ship a couple of standard filters with the library, like we already do (filters like EventData.final_charged() etc. ... already exist), but it would be very useful to expose this generic functionality via the CLI.
The text was updated successfully, but these errors were encountered: