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

adding tels pointing #123

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion protopipe/pipeline/event_preparer.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,12 +923,27 @@ def prepare_event(self, source, return_stub=True, save_images=False, debug=False
+ bcolors.ENDC
)

# if all telescopes are pointing in parallel to run_array_direction, no need to pass the tels
# pointing to predict
if all(x.alt == event.mcheader.run_array_direction[1]
and x.az == event.mcheader.run_array_direction[0] for x in tels_pointing.values()):
Copy link
Member

Choose a reason for hiding this comment

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

I think you mean point_altitude_dict.values()

Copy link
Member

Choose a reason for hiding this comment

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

and this is what is killing the tests, here an extract

Traceback (most recent call last):
  File "/home/runner/work/protopipe/protopipe/protopipe/scripts/data_training.py", line 573, in <module>
    main()
  File "/home/runner/work/protopipe/protopipe/protopipe/scripts/data_training.py", line 235, in main
    for (
  File "/home/runner/work/protopipe/protopipe/protopipe/pipeline/event_preparer.py", line 929, in prepare_event
    and x.az == event.mcheader.run_array_direction[0] for x in tels_pointing.values()):
UnboundLocalError: local variable 'tels_pointing' referenced before assignment

tels_pointing = None
else:
tels_pointing = {
tel_id: SkyCoord(
alt=point_altitude_dict[tel_id],
az=point_azimuth_dict[tel_id],
frame="altaz",
) # cycle only on tels which still have an image
for tel_id in point_altitude_dict.keys()
}

# Reconstruction results
reco_result = self.shower_reco.predict(
good_hillas_dict,
source.subarray,
SkyCoord(alt=alt, az=az, frame="altaz"),
None, # use the array direction
tels_pointing,
)

# Impact parameter for telescope-wise energy estimation
Expand Down