Skip to content

Commit

Permalink
write_parameters -> write_dl1_parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
kosack committed Mar 4, 2024
1 parent 2c5a4f4 commit 84be5e6
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion examples/tutorials/tableloader_and_eventsources.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
with DataWriter(
event_source=source,
output_path="events.dl1.h5",
write_parameters=False,
write_dl1_parameters=False,
overwrite=True,
write_dl1_images=True,
) as write_data:
Expand Down
2 changes: 1 addition & 1 deletion src/ctapipe/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def dl1_image_file(dl1_tmp_path, prod5_gamma_simtel_path):
f"--input={prod5_gamma_simtel_path}",
f"--output={output}",
"--write-images",
"--DataWriter.write_parameters=False",
"--DataWriter.write_dl1_parameters=False",
"--max-events=20",
"--DataWriter.Contact.name=αℓℓ the äüöß",
]
Expand Down
14 changes: 7 additions & 7 deletions src/ctapipe/io/datawriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class DataWriter(Component):
help="Store DL1 Images if available", default_value=False
).tag(config=True)

write_parameters = Bool(
write_dl1_parameters = Bool(
help="Store DL1 image parameters if available", default_value=True
).tag(config=True)

Expand Down Expand Up @@ -394,7 +394,7 @@ def datalevels(self):
data_levels = []
if self.write_dl1_images:
data_levels.append(DataLevel.DL1_IMAGES)
if self.write_parameters:
if self.write_dl1_parameters:
data_levels.append(DataLevel.DL1_PARAMETERS)
if self.write_muon_parameters:
data_levels.append(DataLevel.DL1_MUON)
Expand Down Expand Up @@ -435,7 +435,7 @@ def _setup_output_path(self):

# check that options make sense
writable_things = [
self.write_parameters,
self.write_dl1_parameters,
self.write_dl1_images,
self.write_dl2,
self.write_r1_waveforms,
Expand Down Expand Up @@ -475,7 +475,7 @@ def _setup_writer(self):
if not self.write_dl1_images:
writer.exclude("/simulation/event/telescope/images/.*", "true_image")

if not self.write_parameters:
if not self.write_dl1_parameters:
writer.exclude("/dl1/event/telescope/images/.*", "image_mask")

# Set up transforms
Expand Down Expand Up @@ -671,7 +671,7 @@ def _write_dl1_telescope_events(self, event: ArrayEventContainer):

table_name = self.table_name(tel_id)

if self.write_parameters:
if self.write_dl1_parameters:
self._writer.write(
table_name=f"dl1/event/telescope/parameters/{table_name}",
containers=[tel_index, *dl1_camera.parameters.values()],
Expand Down Expand Up @@ -699,7 +699,7 @@ def _write_dl1_telescope_events(self, event: ArrayEventContainer):
tel_id in event.simulation.tel
and event.simulation.tel[tel_id].true_image is not None
)
if self.write_parameters and has_sim_image:
if self.write_dl1_parameters and has_sim_image:
true_parameters = event.simulation.tel[tel_id].true_parameters
# only write the available containers, no peak time related
# features for true image available.
Expand Down Expand Up @@ -791,7 +791,7 @@ def _generate_indices(self):
self._generate_table_indices(
self._writer.h5file, "/simulation/event/telescope/images"
)
if self.write_parameters:
if self.write_dl1_parameters:

Check warning on line 794 in src/ctapipe/io/datawriter.py

View check run for this annotation

Codecov / codecov/patch

src/ctapipe/io/datawriter.py#L794

Added line #L794 was not covered by tests
self._generate_table_indices(
self._writer.h5file, "/dl1/event/telescope/parameters"
)
Expand Down
2 changes: 1 addition & 1 deletion src/ctapipe/io/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def r1_hdf5_file(prod5_proton_simtel_path, r1_path):
writer = DataWriter(
event_source=source,
output_path=path,
write_parameters=False,
write_dl1_parameters=False,
write_dl1_images=False,
write_dl2=False,
write_r0_waveforms=False,
Expand Down
8 changes: 4 additions & 4 deletions src/ctapipe/io/tests/test_datawriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_write(tmpdir: Path):
with DataWriter(
event_source=source,
output_path=output_path,
write_parameters=False,
write_dl1_parameters=False,
write_dl1_images=True,
write_dl2=True,
write_r0_waveforms=True,
Expand Down Expand Up @@ -158,7 +158,7 @@ def test_roundtrip(tmpdir: Path):
with DataWriter(
event_source=source,
output_path=output_path,
write_parameters=False,
write_dl1_parameters=False,
write_dl1_images=True,
transform_image=True,
image_dtype="int32",
Expand Down Expand Up @@ -229,7 +229,7 @@ def test_dl1writer_no_events(tmpdir: Path):
with DataWriter(
event_source=source,
output_path=output_path,
write_parameters=True,
write_dl1_parameters=True,
write_dl1_images=True,
) as writer:
writer.log.level = logging.DEBUG
Expand Down Expand Up @@ -269,7 +269,7 @@ def test_metadata(tmpdir: Path):
with DataWriter(
event_source=source,
output_path=output_path,
write_parameters=True,
write_dl1_parameters=True,
write_dl1_images=True,
config=config,
):
Expand Down
2 changes: 1 addition & 1 deletion src/ctapipe/resources/base_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ DataWriter:
# files)
overwrite: false # do not overwrite existing files
write_dl1_images: false # store DL1 images
write_parameters: false # store DL1 parameters
write_dl1_parameters: false # store DL1 parameters
write_dl2: false # store DL2 stereo geometry
write_r0_waveforms: false # write R0 waveforms
write_r1_waveforms: false # write R1 waveforms
Expand Down
2 changes: 1 addition & 1 deletion src/ctapipe/resources/image_modification_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"overwrite": false,
"write_dl1_images": true,
"write_parameters": true,
"write_dl1_parameters": true,
"write_dl2": false,
"transform_image": true,
"transform_peak_time": true
Expand Down
2 changes: 1 addition & 1 deletion src/ctapipe/resources/ml_preprocessing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"overwrite": false,
"write_dl1_images": false,
"write_parameters": true,
"write_dl1_parameters": true,
"write_dl2": true,
"transform_image": true,
"transform_peak_time": true
Expand Down
2 changes: 1 addition & 1 deletion src/ctapipe/resources/ml_preprocessing_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@

DataWriter:
write_dl1_images: false
write_parameters: true
write_dl1_parameters: true
write_dl2: true
2 changes: 1 addition & 1 deletion src/ctapipe/resources/stage1_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"overwrite": false,
"write_dl1_images": true,
"write_parameters": true,
"write_dl1_parameters": true,
"write_dl2": false,
"transform_image": true,
"transform_peak_time": true
Expand Down
2 changes: 1 addition & 1 deletion src/ctapipe/resources/stage1_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ organization = "YOUR-ORGANIZATION"
# options that control what is stored in the output file
overwrite = false
write_dl1_images = true
write_parameters = true
write_dl1_parameters = true
write_dl2 = false
transform_image = true
transform_peak_time = true
Expand Down
2 changes: 1 addition & 1 deletion src/ctapipe/resources/stage1_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@

DataWriter:
write_dl1_images: true
write_parameters: true
write_dl1_parameters: true
write_dl2: false
2 changes: 1 addition & 1 deletion src/ctapipe/resources/stage2_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"overwrite": false,
"write_dl1_images": false,
"write_parameters": false,
"write_dl1_parameters": false,
"write_dl2": true,
"transform_image": true,
"transform_peak_time": true
Expand Down
2 changes: 1 addition & 1 deletion src/ctapipe/resources/stage2_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@

DataWriter:
write_dl1_images: false
write_parameters: false
write_dl1_parameters: false
write_dl2: true
6 changes: 3 additions & 3 deletions src/ctapipe/tools/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ProcessorTool(Tool):
Note that the muon analysis and shower reconstruction both depend on
parametrized images and therefore compute image parameters even if
DataWriter.write_parameters=False in case these are not already present
DataWriter.write_dl1_parameters=False in case these are not already present
in the input file.
"""

Expand Down Expand Up @@ -116,7 +116,7 @@ class ProcessorTool(Tool):
),
**flag(
"write-parameters",
"DataWriter.write_parameters",
"DataWriter.write_dl1_parameters",
"store DL1/Event/Telescope parameters in output",
"don't store DL1/Event/Telescope parameters in output",
),
Expand Down Expand Up @@ -221,7 +221,7 @@ def should_compute_dl1(self):
return False

return (
self.write.write_parameters
self.write.write_dl1_parameters
or self.should_compute_dl2
or self.should_compute_muon_parameters
)
Expand Down

0 comments on commit 84be5e6

Please sign in to comment.