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

write array info a la ctapipe v0.8 #466

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions lstchain/io/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from eventio.search_utils import yield_toplevel_of_type
from .lstcontainers import ThrownEventsHistogram, ExtraMCInfo, MetaData
from tqdm import tqdm
from ctapipe.tools.stage1 import Stage1ProcessorTool
from astropy.utils import deprecated


__all__ = ['read_simu_info_hdf5',
Expand Down Expand Up @@ -349,6 +351,22 @@ def write_mcheader(mcheader, output_filename, obs_id=None, filters=None, metadat
writer.write("run_config", [extramc, mcheader])


@deprecated('09/07/2020', message='this function will disappear in lstchain v0.7')
def write_array_info_08(subarray, output_filename):
"""
Write the array info to a ctapipe v0.8 compatible DL1 HDF5 file

Parameters
----------
subarray: `ctapipe.instrument.subarray.SubarrayDescription`
output_filename: str
"""
stage1 = Stage1ProcessorTool()
stage1.output_path = output_filename
stage1._write_instrument_configuration(subarray)


@deprecated('09/07/2020', message='this function will disappear in lstchain v0.7')
def write_array_info(subarray, output_filename):
"""
Write the array info to a HDF5 file
Expand Down
3 changes: 2 additions & 1 deletion lstchain/reco/r0_to_dl1.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from ..image.muon import analyze_muon_event, tag_pix_thr
from ..image.muon import create_muon_table, fill_muon_event
from ..paths import parse_r0_filename, run_to_dl1_filename, r0_to_dl1_filename

from ..io.io import write_array_info_08
from ..io import (
write_simtel_energy_histogram,
write_mcheader,
Expand Down Expand Up @@ -297,6 +297,7 @@ def r0_to_dl1(

# Write extra information to the DL1 file
write_array_info(subarray, output_filename)
write_array_info_08(subarray, output_filename)

if is_simu:
write_mcheader(
Expand Down