Skip to content

Commit

Permalink
Use ctapipe.compat.COPY_IF_NEEDED
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasBeiske committed Sep 30, 2024
1 parent 913f66f commit 9ea15e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/ctapipe/irf/binning.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import astropy.units as u
import numpy as np

from ..compat import COPY_IF_NEEDED
from ..core import Component
from ..core.traits import AstroQuantity, Integer

Expand Down Expand Up @@ -76,7 +77,9 @@ def make_bins_per_decade(e_min, e_max, n_bins_per_decade=5):

n_bins = int(np.ceil((log_upper - log_lower) * n_bins_per_decade))

return u.Quantity(np.logspace(log_lower, log_upper, n_bins + 1), unit, copy=False)
return u.Quantity(
np.logspace(log_lower, log_upper, n_bins + 1), unit, copy=COPY_IF_NEEDED
)


@dataclass
Expand Down
3 changes: 2 additions & 1 deletion src/ctapipe/irf/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
from pyirf.utils import calculate_source_fov_offset, calculate_theta

from ..compat import COPY_IF_NEEDED
from ..containers import CoordinateFrameType
from ..coordinates import NominalFrame
from ..core import Component, QualityQuery
Expand Down Expand Up @@ -105,7 +106,7 @@ def normalise_column_names(self, events: Table) -> QTable:
)

keep_columns.extend(rename_from)
events = QTable(events[keep_columns], copy=False)
events = QTable(events[keep_columns], copy=COPY_IF_NEEDED)
events.rename_columns(rename_from, rename_to)
return events

Expand Down

0 comments on commit 9ea15e3

Please sign in to comment.