Skip to content

set_line_hillas should work in other frames #2129

@StFroese

Description

@StFroese

The ArrayDisplay can take a frame, e.g. EastingNorthing, but set_line_hillas doesn't plot the correct lines if changing the coordinate frame.
Screenshot 2022-11-23 at 10 19 25

Describe the solution you'd like
One solution would be to transform to GroundFrame inside the function and then do the calculation and transform back to the desired frame, e.g. EastingNorthing

Describe alternatives you've considered
Catching the case with a conditional statement inside the function and checking which frame is used...

Additional

from ctapipe.visualization import ArrayDisplay
import matplotlib.pyplot as plt
from ctapipe.io import EventSource
from ctapipe.coordinates import EastingNorthingFrame
from ctapipe.reco import HillasReconstructor

with EventSource("/Users/stefan/Downloads/gamma_20deg_180deg_run3___cta-prod6-paranal-2147m-Paranal-dark.dl2.h5", max_events=10) as source:
    plotting_event = list(source)[3]
    reco = HillasReconstructor(source.subarray)
    reco(plotting_event)

    angle_offset = plotting_event.pointing.array_azimuth

    plotting_hillas = {
        tel_id: dl1.parameters.hillas for tel_id, dl1 in plotting_event.dl1.tel.items()
    }

    plotting_core = {
        tel_id: dl1.parameters.core.psi for tel_id, dl1 in plotting_event.dl1.tel.items()
    }


    fig, axs = plt.subplots(1,2,figsize=(10,10))
    disp = ArrayDisplay(source.subarray, axes=axs[0])
    disp_ea = ArrayDisplay(source.subarray,frame=EastingNorthingFrame(), axes=axs[1])


    disp.set_line_hillas(plotting_hillas, plotting_core, 500)
    disp.add_labels()
    disp_ea.set_line_hillas(plotting_hillas, plotting_core, 500)
    disp_ea.add_labels()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions