Skip to content

Commit

Permalink
pre-commit rerun
Browse files Browse the repository at this point in the history
  • Loading branch information
StFroese committed Sep 15, 2023
1 parent 462ea6c commit 214213f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 21 deletions.
13 changes: 5 additions & 8 deletions ctapipe/image/concentration.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import numpy as np
import astropy.units as u
import numpy as np

from ..containers import (
ConcentrationContainer,
HillasParametersContainer,
)
from .hillas import camera_to_shower_coordinates
from ..containers import ConcentrationContainer
from ..instrument import CameraGeometry
from ..utils.quantities import all_to_value
from .hillas import camera_to_shower_coordinates

__all__ = ["concentration_parameters"]

Expand Down Expand Up @@ -39,15 +36,15 @@ def concentration_parameters(geom: CameraGeometry, image, hillas_parameters):
delta_y = pix_y - y

# take pixels within one pixel diameter from the cog
mask_cog = (delta_x ** 2 + delta_y ** 2) < pixel_width ** 2
mask_cog = (delta_x**2 + delta_y**2) < pixel_width**2
conc_cog = np.sum(image[mask_cog]) / h.intensity

if hillas_parameters.width.value != 0:
# get all pixels inside the hillas ellipse
longi, trans = camera_to_shower_coordinates(
pix_x, pix_y, x, y, h.psi.to_value(u.rad)
)
mask_core = (longi ** 2 / length ** 2) + (trans ** 2 / width ** 2) <= 1.0
mask_core = (longi**2 / length**2) + (trans**2 / width**2) <= 1.0
conc_core = image[mask_core].sum() / h.intensity
else:
conc_core = 0.0
Expand Down
4 changes: 1 addition & 3 deletions ctapipe/image/image_processor.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""
High level image processing (ImageProcessor Component)
"""
from copy import deepcopy

import numpy as np

from ctapipe.coordinates import TelescopeFrame
Expand All @@ -15,7 +13,7 @@
TimingParametersContainer,
)
from ..core import QualityQuery, TelescopeComponent
from ..core.traits import Bool, BoolTelescopeParameter, ComponentName, List
from ..core.traits import BoolTelescopeParameter, ComponentName, List
from ..instrument import SubarrayDescription
from .cleaning import ImageCleaner
from .concentration import concentration_parameters
Expand Down
14 changes: 5 additions & 9 deletions ctapipe/image/timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@
Image timing-based shower image parametrization.
"""

import numpy as np
import astropy.units as u
from ..containers import (
TimingParametersContainer,
HillasParametersContainer,
)
from .hillas import camera_to_shower_coordinates
from ..utils.quantities import all_to_value
from ..fitting import lts_linear_regression

import numpy as np
from numba import njit

from ..containers import TimingParametersContainer
from ..fitting import lts_linear_regression
from ..utils.quantities import all_to_value
from .hillas import camera_to_shower_coordinates

__all__ = ["timing_parameters"]

Expand Down
4 changes: 3 additions & 1 deletion ctapipe/io/hdf5eventsource.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,9 @@ def _generator(self):
timing_prefix = "timing"

if self._is_hillas_in_camera_frame():
raise KeyError("Found DL1 parameters in camera frame. Please reprocess your files with a newer version of ctapipe.")
raise KeyError(
"Found DL1 parameters in camera frame. Please reprocess your files with a newer version of ctapipe."
)

param_readers = {
table.name: self.reader.read(
Expand Down

0 comments on commit 214213f

Please sign in to comment.