-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow YAML and TOML config files and multiple configs (#1856)
* support loading config files from a YAML file * a sample YAML version of the config * add yaml example to quickstart * fixed typo * add TOML support * allow multiple config files, fixes #1732 * add config files to provenance tracker * updated help string for config_file * a better config file with lots of explanation * change Tool.config_file -> config_files since list * fix incorrect f-string (now a log statement) * update to reflect the new ShowerProcessor * move ctapipe.tools.test.resources to ctapipe.resources * require pyyaml and remove HAS_YAML
- Loading branch information
Showing
15 changed files
with
373 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# ========================================================================== | ||
# ctapipe-process configuration file. | ||
# version: VERSION | ||
# | ||
# This configuration contains a subset of options needed for a basic analysis. | ||
# Not all possible options are shown. To get a complete list, run: | ||
# | ||
# `ctapipe-process --help-all` | ||
# | ||
# ========================================================================== | ||
|
||
DataWriter: | ||
Contact: | ||
# please fill in your contact information here. It will be stored in the | ||
# output files as provenance information | ||
name: YOUR-NAME-HERE | ||
email: [email protected] | ||
organization: YOUR-ORGANIZATION | ||
|
||
# options that control what is stored in the output file by default here we | ||
# write nothing (can be overridden on the command-line or in subsequent config | ||
# files) | ||
overwrite: false # do not overwrite existing files | ||
write_images: false # store DL1 images | ||
write_parameters: false # store DL1 parameters | ||
write_stereo_shower: false # store DL2 stereo geometry | ||
write_raw_waveforms: false # write R0 waveforms | ||
write_waveforms: false # write R1 waveforms | ||
|
||
# The CameraCalibrator takes data from R1 or DL0 to DL1a level, applying finer | ||
# calibration and turning waveforms into images. It is run only if DL1a images | ||
# do not already exist in the input file. | ||
CameraCalibrator: | ||
# Choose an extractor type from the following possibilities: | ||
#'FullWaveformSum', 'FixedWindowSum', 'GlobalPeakWindowSum', | ||
#'LocalPeakWindowSum', 'SlidingWindowMaxSum', 'NeighborPeakWindowSum', | ||
#'TwoPassWindowSum', 'BaselineSubtractedNeighborPeakWindowSum' | ||
# | ||
# Note this is a telescope-wise parameter, so can be specified per telescope | ||
# if necessary (see below for an example) | ||
image_extractor_type: NeighborPeakWindowSum | ||
|
||
# The ImageProcessor performs the DL1a-> DL1b (image parameters) transition. It | ||
# is run only if the parameters `DataWriter.write_image_parameters=True` and the | ||
# parameters don't already exist in the input file (or if the user forces them | ||
# to be re-computed using DataWriter.recompute_dl1=True) | ||
ImageProcessor: | ||
# The image cleaner selects pixels which have signal in them and rejects those | ||
# without. Options are: 'TailcutsImageCleaner', 'MARSImageCleaner', | ||
# 'FACTImageCleaner' | ||
image_cleaner_type: TailcutsImageCleaner | ||
|
||
# make sure you include a configuration for the image cleaner you selected | ||
# above here. The section named by the image_cleaner_type will be used to | ||
# configure it. | ||
TailcutsImageCleaner: | ||
# the thresholds for this image cleaner must be optimized for the data set | ||
# you are analyzing. The defaults may not be correct and should be optimized | ||
# for the given use case. | ||
# | ||
# These are telescope-wise parameters, where the options are patterns | ||
# specified in a list in order of precedence, with later options overwriting | ||
# earlier ones. Each pattern is a triplet of [scope, key, value], where the | ||
# scope can be "type" (matching to the telescope type name) or "id" | ||
# (matching a specific telescope ID number). In the case of "type", the key | ||
# should be either a telescope type string, or part of one with "*" used as | ||
# a wildcard match (e.g. "LST*" would match all LST telescopes). You can | ||
# specify a universal default value using "*" as a key. Note that specifying | ||
# a single value is equivalent to specifying a one-item list containing | ||
# [type, '*', value] . | ||
picture_threshold_pe: # top-level threshold in photoelectrons | ||
- [type, "LST*", 6.0] | ||
- [type, "MST*NectarCam", 8.0] | ||
- [type, "MST*FlashCam", 10000] # disabled for now | ||
- [type, "SST_ASTRI_CHEC", 4.0] | ||
boundary_threshold_pe: # second-level threshold in photoelectrons | ||
- [type, "LST*", 3.0] | ||
- [type, "MST*NectarCam", 4.0] | ||
- [type, "MST*FlashCam", 10000] # disabled for now | ||
- [type, "SST_ASTRI_CHEC", 2.0] | ||
keep_isolated_pixels: False # If False, pixels with < min_picture_neighbors are removed. | ||
min_picture_neighbors: 2 # Minimum number of neighbors above threshold to consider | ||
|
||
# Choose which images should be parameterized: | ||
ImageQualityQuery: | ||
# quality critieria should be a list of pairs of [name, | ||
# filter_function_string] The filter function should take a single value | ||
# which is the image itself, a 1D np.array. | ||
quality_criteria: | ||
- ["enough_pixels", "lambda im: np.count_nonzero(im) > 2"] | ||
- ["enough_charge", "lambda im: im.sum() > 50"] | ||
|
||
# The ShowerProcessor performs the DL1 to DL2a (reconstructed shower geometry) | ||
# transition. It is run only if the parameter DataWriter.write_stereo_shower=True. | ||
ShowerProcessor: | ||
# choose between HillasReconstructor and HillasIntersection (two | ||
# implementations of the standard stereo line-intersection method) | ||
reconstructor_type: HillasReconstructor | ||
|
||
HillasReconstructor: | ||
# Choose which telescope events should be included in the reconstruction. | ||
StereoQualityQuery: | ||
# the quality criteria here should again be a list of [name, | ||
# filter_function_string] pairs, with filter functions that take the set of | ||
# image parameters, `p` (a `ctapipe.containers.ImageParametersContainer`), as | ||
# an argument. | ||
quality_criteria: | ||
- [enough intensity, "lambda p: p.hillas.intensity > 50"] | ||
- [Positive width, "lambda p: p.hillas.width.value > 0"] | ||
- [enough pixels, "lambda p: p.morphology.num_pixels > 3"] | ||
- [not clipped, "lambda p: p.leakage.intensity_width_2 < 0.8"] |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
[DataWriter.Contact] | ||
# please fill in your contact information here. It will be stored in the | ||
# output files as provenance information | ||
name = "YOUR-NAME-HERE" | ||
email = "[email protected]" | ||
organization = "YOUR-ORGANIZATION" | ||
|
||
[DataWriter] | ||
# options that control what is stored in the output file | ||
overwrite = false | ||
write_images = true | ||
write_parameters = true | ||
write_stereo_shower = false | ||
write_mono_shower = false | ||
transform_image = true | ||
transform_peak_time = true | ||
|
||
[CameraCalibrator] | ||
image_extractor_type = "NeighborPeakWindowSum" | ||
|
||
[ImageProcessor] | ||
image_cleaner_type = "TailcutsImageCleaner" | ||
|
||
|
||
|
||
[ImageProcessor.TailcutsImageCleaner] | ||
picture_threshold_pe = [ | ||
[ "type", "*", 10.0,], | ||
[ "type", "LST_LST_LSTCam", 5.0,], | ||
[ "type", "MST_MST_NectarCam", 5.0,], | ||
[ "type", "SST_ASTRI_CHEC", 3.0,], | ||
] | ||
boundary_threshold_pe = [ | ||
[ "type", "*", 5.0,], | ||
[ "type", "LST_LST_LSTCam", 2.5,], | ||
[ "type", "MST_MST_NectarCam", 2.5,], | ||
[ "type", "SST_ASTRI_CHEC", 1.5,], | ||
] | ||
min_picture_neighbors = [ [ "type", "*", 2,],] | ||
|
||
[ImageProcessor.ImageQualityQuery] | ||
# These specify which images should be parameterized: | ||
quality_criteria = [ | ||
[ "enough_pixels", "lambda im: np.count_nonzero(im) > 2",], | ||
[ "enough_charge", "lambda im: im.sum() > 50",] | ||
] | ||
|
||
[ShowerProcessor.ShowerQualityQuery] | ||
# These specify criteria for telescopes that should be included in stereo | ||
# reconstruction: | ||
quality_criteria = [ | ||
[ "enough intensity", "lambda p: p.hillas.intensity > 50",], | ||
[ "Positive width", "lambda p: p.hillas.width.value > 0",], | ||
[ "enough pixels", "lambda p: p.morphology.num_pixels > 3",], | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# ====================================================================== | ||
# ctapipe-process configuration file. | ||
# version: VERSION | ||
# | ||
# Perform Stage 1 Processing | ||
# | ||
# This configuration enables options needed for Rx to DL1b (image parameters) | ||
# ====================================================================== | ||
# | ||
# Make sure you first include `--config base_config.yaml` before including this file | ||
|
||
DataWriter: | ||
write_images: true | ||
write_parameters: true | ||
write_stereo_shower: false |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# ====================================================================== | ||
# ctapipe-process configuration file. | ||
# version: VERSION | ||
# | ||
# Perform Stage 2 Processing | ||
# | ||
# This configuration enables options needed for Rx to DL2a (shower | ||
# reconstruction) But not including any image parameters | ||
# ====================================================================== | ||
# | ||
# Make sure you first include `--config base_config.yaml` before including this file | ||
|
||
DataWriter: | ||
write_images: false | ||
write_parameters: false | ||
write_stereo_shower: true |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# ====================================================================== | ||
# ctapipe-process configuration file. | ||
# version: VERSION | ||
# | ||
# Perform Stage 1 and Stage 2a processing to generate features needed for | ||
# training machine learning algorithms. | ||
# | ||
# Note that here write_images is disabled by default (to avoid very large | ||
# files), however for training deep learning algorithms, it should be turned on. | ||
# ====================================================================== | ||
# | ||
# Make sure you first include `--config base_config.yaml` before including this file | ||
|
||
DataWriter: | ||
write_images: false | ||
write_parameters: true | ||
write_stereo_shower: true |
Oops, something went wrong.