.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/tutorials/calibrated_data_exploration.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_tutorials_calibrated_data_exploration.py: Explore Calibrated Data ======================= .. GENERATED FROM PYTHON SOURCE LINES 6-25 .. code-block:: Python :lineno-start: 7 import numpy as np from astropy import units as u from matplotlib import pyplot as plt import ctapipe from ctapipe.calib import CameraCalibrator from ctapipe.image import hillas_parameters, tailcuts_clean from ctapipe.io import EventSource from ctapipe.utils.datasets import get_dataset_path from ctapipe.visualization import ArrayDisplay, CameraDisplay # %matplotlib inline plt.style.use("ggplot") print(ctapipe.__version__) print(ctapipe.__file__) .. rst-class:: sphx-glr-script-out .. code-block:: none 0.27.1.dev15+g1af6977ab /home/docs/checkouts/readthedocs.org/user_builds/ctapipe/envs/2868/lib/python3.10/site-packages/ctapipe/__init__.py .. GENERATED FROM PYTHON SOURCE LINES 26-28 Let’s first open a raw event file and get an event out of it: .. GENERATED FROM PYTHON SOURCE LINES 28-35 .. code-block:: Python :lineno-start: 29 filename = get_dataset_path("gamma_prod5.simtel.zst") source = EventSource(filename, max_events=2) for event in source: print(event.index.event_id) .. rst-class:: sphx-glr-script-out .. code-block:: none Downloading gamma_prod5.simtel.zst: 0%| | 0.00/17.5M [00:00
SimTelEventSource

Read events from a SimTelArray data file (in EventIO format).

ctapipe makes use of the sim_telarray metadata system to fill some information not directly accessible from the data inside the files itself. Make sure you set this parameters in the simulation configuration to fully make use of ctapipe. In future, ctapipe might require these metadata parameters.

This includes:

  • Reference Point of the telescope coordinates. Make sure to include the
    user-defined parameters LONGITUDE and LATITUDE with the geodetic coordinates of the array reference point. Also make sure the ALTITUDE config parameter is included in the global metadata.
  • Names of the optical structures and the cameras are read from
    OPTICS_CONFIG_NAME and CAMERA_CONFIG_NAME, make sure to include these in the telescope meta.
  • The MIRROR_CLASS should also be included in the telescope meta
    to correctly setup coordinate transforms.

If these parameters are not included in the input data, ctapipe will fallback guesses these based on available data and the list of known telescopes for ctapipe.instrument.guess_telescope.

allowed_tels None list of allowed tel_ids, others will be ignored. If None, all telescopes in the input stream will be included (default: None)
atmosphere_profile_choice AtmosphereProfileKind.AUTO Which type of atmosphere density profile to load from the file, in case more than one exists. If set to AUTO, TABLE will be attempted first and if missing, FIVELAYER will be loaded. (default: AtmosphereProfileKind.AUTO)
back_seekable False Require the event source to be backwards seekable. This will reduce in slower read speed for gzipped files and is not possible for zstd compressed files (default: False)
calib_scale 1.0 Factor to transform ADC counts into number of photoelectrons. Corrects the DC_to_PHE factor. (default: 1.0)
calib_shift 0.0 Factor to shift the R1 photoelectron samples. Can be used to simulate mis-calibration. (default: 0.0)
focal_length_choice FocalLengthKind.EFFECTIVE If both nominal and effective focal lengths are available in the SimTelArray file, which one to use for the `~ctapipe.coordinates.CameraFrame` attached to the `~ctapipe.instrument.CameraGeometry` instances in the `~ctapipe.instrument.SubarrayDescription`, which will be used in CameraFrame to TelescopeFrame coordinate transforms. The 'nominal' focal length is the one used during the simulation, the 'effective' focal length is computed using specialized ray-tracing from a point light source (default: FocalLengthKind.EFFECTIVE)
gain_selector_type ThresholdGainSelector The name of a GainSelector subclass. Possible values: ['ManualGainSelector', 'ThresholdGainSelector'] (default: ThresholdGainSelector)
input_url /home/docs/.cache/ctapipe/minio-cta.zeuthen.desy.de/dpps-testdata-public/data/ctapipe-test-data/v1.1.0/gamma_prod5.simtel.zst Path to the input file containing events. (default: None)
max_events 2 Maximum number of events that will be read from the file (default: None)
override_obs_id None Use the given obs_id instead of the run number from sim_telarray (default: None)
select_gain None Whether to perform gain selection. The default (None) means only select gain of physics events, not of calibration events. (default: None)
skip_calibration_events True Skip calibration events (default: True)
skip_r1_calibration False Skip the simtel category-A calibration. The R1 waveforms (in ADC counts) will be the same as the R0 waveforms. (default: False)


.. GENERATED FROM PYTHON SOURCE LINES 42-44 .. code-block:: Python :lineno-start: 42 event .. rst-class:: sphx-glr-script-out .. code-block:: none ctapipe.containers.ArrayEventContainer: index.*: event indexing information with default None r0.*: Raw Data with default None r1.*: R1 Calibrated Data with default None dl0.*: DL0 Data Volume Reduced Data with default None dl1.*: DL1 Calibrated image with default None dl2.*: DL2 reconstruction info with default None simulation.*: Simulated Event Information with default None with type trigger.*: central trigger information with default None count: number of events processed with default 0 monitoring.*: container for event-wise monitoring data (MON) with default None muon.*: Container for muon analysis results with default None .. GENERATED FROM PYTHON SOURCE LINES 45-48 .. code-block:: Python :lineno-start: 45 print(event.r1) .. rst-class:: sphx-glr-script-out .. code-block:: none {'tel': {26: {'calibration_monitoring_id': None, 'event_time':