Skip to content

Commit

Permalink
Merge pull request gammapy#5495 from cgalelli/format
Browse files Browse the repository at this point in the history
Add `table_format` argument in `FluxPoints.read` to disentangle from arbitrary kwarg
  • Loading branch information
registerrier authored Oct 15, 2024
2 parents d644ef6 + 2eda16c commit 2a4d540
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions gammapy/estimators/points/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ def read(
format=None,
reference_model=None,
checksum=False,
table_format="ascii.ecsv",
**kwargs,
):
"""Read precomputed flux points.
Expand All @@ -198,6 +199,8 @@ def read(
Reference spectral model.
checksum : bool
If True checks both DATASUM and CHECKSUM cards in the file headers. Default is False.
table_format : str
Format string for the ~astropy.Table object. Default is "ascii.ecsv"
**kwargs : dict, optional
Keyword arguments passed to `astropy.table.Table.read`.
Expand All @@ -208,9 +211,8 @@ def read(
"""
filename = make_path(filename)
gti = None
kwargs.setdefault("format", "ascii.ecsv")
try:
table = Table.read(filename, **kwargs)
table = Table.read(filename, format=table_format, **kwargs)
except (IORegistryError, UnicodeDecodeError):
with fits.open(filename, checksum=checksum) as hdulist:
if "FLUXPOINTS" in hdulist:
Expand Down

0 comments on commit 2a4d540

Please sign in to comment.