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

Add fit status fields to output container of MuonIntensityFitter #2381

Merged
merged 11 commits into from
Jul 17, 2023
1 change: 1 addition & 0 deletions ctapipe/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,7 @@ class MuonEfficiencyContainer(Container):
impact_x = Field(nan * u.m, "impact parameter x position")
impact_y = Field(nan * u.m, "impact parameter y position")
optical_efficiency = Field(nan, "optical efficiency muon")
fit_convergence = Field(nan, "convergence of the fit")
maxnoe marked this conversation as resolved.
Show resolved Hide resolved
maxnoe marked this conversation as resolved.
Show resolved Hide resolved


class MuonParametersContainer(Container):
Expand Down
4 changes: 4 additions & 0 deletions ctapipe/image/muon/intensity_fitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,9 @@ def __call__(self, tel_id, center_x, center_y, radius, image, pedestal, mask=Non
# Perform minimisation
minuit.migrad()

# Check for convergence
validation = minuit.valid
maxnoe marked this conversation as resolved.
Show resolved Hide resolved

# Get fitted values
result = minuit.values

Expand All @@ -545,4 +548,5 @@ def __call__(self, tel_id, center_x, center_y, radius, image, pedestal, mask=Non
impact_y=result["impact_parameter"] * np.sin(result["phi"]) * u.m,
width=u.Quantity(np.rad2deg(result["ring_width"]), u.deg),
optical_efficiency=result["optical_efficiency_muon"],
fit_convergence=validation
jstvdk marked this conversation as resolved.
Show resolved Hide resolved
)