ApplyModels#
- class ctapipe.tools.apply_models.ApplyModels(**kwargs: Any)[source]#
Bases:
Tool
Apply machine learning models to data.
This tool predicts all events at once. To apply models in the regular event loop, set the appropriate options to
ctapipe-process
.Models need to be trained with
TrainEnergyRegressor
andTrainParticleClassifier
.Attributes Summary
How many subarray events to load at once for making predictions.
Input dl1b/dl2 file
Number of threads to use for the reconstruction.
Output file
show progress bar during processing
Paths to trained reconstructors to be applied to the input data
Methods Summary
Attributes Documentation
- aliases: StrDict = {'chunk-size': 'ApplyModels.chunk_size', 'n-jobs': 'ApplyModels.n_jobs', ('i', 'input'): 'ApplyModels.input_url', ('o', 'output'): 'ApplyModels.output_path', ('r', 'reconstructor'): 'ApplyModels.reconstructor_paths'}#
- chunk_size#
How many subarray events to load at once for making predictions.
- classes: ClassesType = [<class 'ctapipe.io.tableloader.TableLoader'>, <class 'ctapipe.reco.reconstructor.Reconstructor'>, <class 'ctapipe.reco.sklearn.DispReconstructor'>, <class 'ctapipe.reco.hillas_intersection.HillasIntersection'>, <class 'ctapipe.reco.hillas_reconstructor.HillasReconstructor'>, <class 'ctapipe.reco.impact.ImPACTReconstructor'>, <class 'ctapipe.reco.sklearn.EnergyRegressor'>, <class 'ctapipe.reco.sklearn.ParticleClassifier'>]#
- description: str | Unicode[str, str | bytes] = 'Apply machine learning models to data.\n\n This tool predicts all events at once. To apply models in the\n regular event loop, set the appropriate options to ``ctapipe-process``.\n\n Models need to be trained with\n `~ctapipe.tools.train_energy_regressor.TrainEnergyRegressor`\n and\n `~ctapipe.tools.train_particle_classifier.TrainParticleClassifier`.\n '#
- examples: str | Unicode[str, str | bytes] = '\n ctapipe-apply-models \\\n --input gamma.dl2.h5 \\\n --reconstructor energy_regressor.pkl \\\n --reconstructor particle-classifier.pkl \\\n --output gamma_applied.dl2.h5\n '#
- flags: StrDict = {'dl1-images': ({'HDF5Merger': {'dl1_images': True}}, 'Include dl1 images'), 'dl1-parameters': ({'HDF5Merger': {'dl1_parameters': True}}, 'Include dl1 parameters'), 'no-dl1-images': ({'HDF5Merger': {'dl1_images': False}}, 'Exclude dl1 images'), 'no-dl1-parameters': ({'HDF5Merger': {'dl1_parameters': False}}, 'Exclude dl1 parameters'), 'no-progress': ({'ProcessorTool': {'progress_bar': False}}, "don't show a progress bar during event processing"), 'no-true-images': ({'HDF5Merger': {'true_images': False}}, 'Exclude true images'), 'no-true-parameters': ({'HDF5Merger': {'true_parameters': False}}, 'Exclude true parameters'), 'overwrite': ({'ApplyModels': {'overwrite': True}, 'HDF5Merger': {'overwrite': True}}, 'Overwrite output file if it exists'), 'progress': ({'ProcessorTool': {'progress_bar': True}}, 'show a progress bar during event processing'), 'true-images': ({'HDF5Merger': {'true_images': True}}, 'Include true images'), 'true-parameters': ({'HDF5Merger': {'true_parameters': True}}, 'Include true parameters')}#
- input_url#
Input dl1b/dl2 file
- n_jobs#
Number of threads to use for the reconstruction. This overwrites the values in the config
- output_path#
Output file
- progress_bar#
show progress bar during processing
- reconstructor_paths#
Paths to trained reconstructors to be applied to the input data
Methods Documentation