How to use the ctapipe.core.traits.Int function in ctapipe

To help you get started, we’ve selected a few ctapipe examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cta-observatory / ctapipe / ctapipe / tools / stage1.py View on Github external
example, see ctapipe/examples/stage1_config.json in the main code repo.
    """

    output_path = Path(
        help="DL1 output filename", default_value=pathlib.Path("events.dl1.h5")
    ).tag(config=True)

    write_images = Bool(
        help="Store DL1/Event/Image data in output", default_value=False
    ).tag(config=True)

    write_parameters = Bool(
        help="Compute and store image parameters", default_value=True
    ).tag(config=True)

    compression_level = Int(
        help="compression level, 0=None, 9=maximum", default_value=5, min=0, max=9
    ).tag(config=True)

    split_datasets_by = CaselessStrEnum(
        values=["tel_id", "tel_type"],
        default_value="tel_id",
        help="Splitting level for the parameters and images datasets",
    ).tag(config=True)

    compression_type = CaselessStrEnum(
        values=["blosc:zstd", "zlib"],
        help="compressor algorithm to use. ",
        default_value="blosc:zstd",
    ).tag(config=True)

    image_extractor_type = create_class_enum_trait(
github cta-observatory / ctapipe / ctapipe / calib / camera / flatfield.py View on Github external
sample_size : int
         number of pedestal events requested for the statistics
    n_channels : int
         number of waveform channel to be considered
    charge_product : str
        Name of the charge extractor to be used
    config : traitlets.loader.Config
        Configuration specified by config file or cmdline arguments.
        Used to set traitlet values.
        Set to None if no configuration to pass.

    kwargs

    """

    tel_id = Int(
        0, help="id of the telescope to calculate the flat-field coefficients"
    ).tag(config=True)
    sample_duration = Int(60, help="sample duration in seconds").tag(config=True)
    sample_size = Int(10000, help="sample size").tag(config=True)
    n_channels = Int(2, help="number of channels to be treated").tag(config=True)
    charge_product = Unicode(
        "LocalPeakWindowSum", help="Name of the charge extractor to be used"
    ).tag(config=True)

    def __init__(self, subarray, **kwargs):

        """
        Parent class for the flat-field calculators.
        Fills the MonitoringCameraContainer.FlatfieldContainer on the base of a given
        flat-field event sample.
        The sample is defined by a maximal interval of time (sample_duration) or a
github cta-observatory / ctapipe / ctapipe / calib / camera / flatfield.py View on Github external
charge_product : str
        Name of the charge extractor to be used
    config : traitlets.loader.Config
        Configuration specified by config file or cmdline arguments.
        Used to set traitlet values.
        Set to None if no configuration to pass.

    kwargs

    """

    tel_id = Int(
        0, help="id of the telescope to calculate the flat-field coefficients"
    ).tag(config=True)
    sample_duration = Int(60, help="sample duration in seconds").tag(config=True)
    sample_size = Int(10000, help="sample size").tag(config=True)
    n_channels = Int(2, help="number of channels to be treated").tag(config=True)
    charge_product = Unicode(
        "LocalPeakWindowSum", help="Name of the charge extractor to be used"
    ).tag(config=True)

    def __init__(self, subarray, **kwargs):

        """
        Parent class for the flat-field calculators.
        Fills the MonitoringCameraContainer.FlatfieldContainer on the base of a given
        flat-field event sample.
        The sample is defined by a maximal interval of time (sample_duration) or a
        minimal number of events (sample_duration).
        The calculator is supposed to be called in an event loop, extract and collect the
        event charge and fill the PedestalContainer
github cta-observatory / ctapipe / ctapipe / calib / camera / pedestals.py View on Github external
charge_product : str
        Name of the charge extractor to be used
    config : traitlets.loader.Config
        Configuration specified by config file or cmdline arguments.
        Used to set traitlet values.
        Set to None if no configuration to pass.

    kwargs

"""

    tel_id = Int(0, help="id of the telescope to calculate the pedestal values").tag(
        config=True
    )
    sample_duration = Int(60, help="sample duration in seconds").tag(config=True)
    sample_size = Int(10000, help="sample size").tag(config=True)
    n_channels = Int(2, help="number of channels to be treated").tag(config=True)
    charge_product = Unicode(
        "FixedWindowSum", help="Name of the charge extractor to be used"
    ).tag(config=True)

    def __init__(self, subarray, **kwargs):
        """
        Parent class for the pedestal calculators.
        Fills the MonitoringCameraContainer.PedestalContainer on the base of a given pedestal sample.
        The sample is defined by a maximal interval of time (sample_duration) or a
        minimal number of events (sample_duration).
        The calculator is supposed to act in an event loop, extract and collect the
        event charge and fill the PedestalContainer

        Parameters
        ----------
github cta-observatory / ctapipe / ctapipe / tools / camdemo.py View on Github external
HillasParameterizationError,
)
from ctapipe.instrument import (
    TelescopeDescription,
    OpticsDescription,
    CameraDescription,
)
from ctapipe.visualization import CameraDisplay


class CameraDemo(Tool):
    name = "ctapipe-camdemo"
    description = "Display fake events in a demo camera"

    delay = traits.Int(50, help="Frame delay in ms", min=20).tag(config=True)
    cleanframes = traits.Int(
        20, help="Number of frames between turning on " "cleaning", min=0
    ).tag(config=True)
    autoscale = traits.Bool(False, help="scale each frame to max if " "True").tag(
        config=True
    )
    blit = traits.Bool(
        False,
        help="use blit operation to draw on screen ("
        "much faster but may cause some draw "
        "artifacts)",
    ).tag(config=True)
    camera = traits.CaselessStrEnum(
        CameraDescription.get_known_camera_names(),
        default_value="NectarCam",
        help="Name of camera to display",
    ).tag(config=True)
github cta-observatory / ctapipe / ctapipe / calib / camera / flatfield.py View on Github external
Name of the charge extractor to be used
    config : traitlets.loader.Config
        Configuration specified by config file or cmdline arguments.
        Used to set traitlet values.
        Set to None if no configuration to pass.

    kwargs

    """

    tel_id = Int(
        0, help="id of the telescope to calculate the flat-field coefficients"
    ).tag(config=True)
    sample_duration = Int(60, help="sample duration in seconds").tag(config=True)
    sample_size = Int(10000, help="sample size").tag(config=True)
    n_channels = Int(2, help="number of channels to be treated").tag(config=True)
    charge_product = Unicode(
        "LocalPeakWindowSum", help="Name of the charge extractor to be used"
    ).tag(config=True)

    def __init__(self, subarray, **kwargs):

        """
        Parent class for the flat-field calculators.
        Fills the MonitoringCameraContainer.FlatfieldContainer on the base of a given
        flat-field event sample.
        The sample is defined by a maximal interval of time (sample_duration) or a
        minimal number of events (sample_duration).
        The calculator is supposed to be called in an event loop, extract and collect the
        event charge and fill the PedestalContainer

        Parameters
github cta-observatory / ctapipe / ctapipe / analysis / camera / chargeresolution.py View on Github external
Maximum pe to calculate the charge resolution up to.
    sum_dict : dict
        Dictionary to store the running sum for each true charge.
    n_dict : dict
        Dictionary to store the running number for each true charge.
    variation_hist_nbins : float
        Number of bins for the variation histogram.
    variation_hist_range : list
        X and Y range for the variation histogram.
    variation_hist : `np.histogram2d`
    variation_xedges : ndarray
        Edges of the X bins for the variation histogram.
    variation_yedges : ndarray
        Edges of the Y bins for the variation histogram.
    """
    max_pe = Int(2000, help='Maximum pe to calculate the charge resolution '
                            'up to').tag(config=True)
    binning = Int(60, allow_none=True,
                  help='Number of bins for the Charge Resolution. If None, '
                       'no binning is performed.').tag(config=True)
    log_bins = Bool(True, help='Bin the x axis linearly instead of '
                               'logarithmic.').tag(config=True)

    def __init__(self, config=None, tool=None, **kwargs):
        """
        Calculator of charge resolution.

        Parameters
        ----------
        config : traitlets.loader.Config
            Configuration specified by config file or cmdline arguments.
            Used to set traitlet values.
github cta-observatory / ctapipe / ctapipe / tools / display_events_single_tel.py View on Github external
from ctapipe.core import Tool
from ctapipe.core.traits import Float, Dict, List, Path
from ctapipe.core.traits import Unicode, Int, Bool
from ctapipe.image import tailcuts_clean, hillas_parameters, HillasParameterizationError
from ctapipe.io import EventSource
from ctapipe.visualization import CameraDisplay


class SingleTelEventDisplay(Tool):
    name = "ctapipe-display-televents"
    description = Unicode(__doc__)

    infile = Path(help="input file to read", exists=True, directory_ok=False).tag(
        config=True
    )
    tel = Int(help="Telescope ID to display", default=0).tag(config=True)
    write = Bool(help="Write out images to PNG files", default=False).tag(config=True)
    clean = Bool(help="Apply image cleaning", default=False).tag(config=True)
    hillas = Bool(help="Apply and display Hillas parametrization", default=False).tag(
        config=True
    )
    samples = Bool(help="Show each sample", default=False).tag(config=True)
    display = Bool(
        help="Display results in interactive window", default_value=True
    ).tag(config=True)
    delay = Float(help="delay between events in s", default_value=0.01, min=0.001).tag(
        config=True
    )
    progress = Bool(help="display progress bar", default_value=True).tag(config=True)

    aliases = Dict(
        {
github cta-observatory / ctapipe / ctapipe / tools / camdemo.py View on Github external
"much faster but may cause some draw "
        "artifacts)",
    ).tag(config=True)
    camera = traits.CaselessStrEnum(
        CameraDescription.get_known_camera_names(),
        default_value="NectarCam",
        help="Name of camera to display",
    ).tag(config=True)

    optics = traits.CaselessStrEnum(
        OpticsDescription.get_known_optics_names(),
        default_value="MST",
        help="Telescope optics description name",
    ).tag(config=True)

    num_events = traits.Int(
        0, help="events to show before exiting (0 for " "unlimited)"
    ).tag(config=True)

    display = traits.Bool(True, "enable or disable display (for " "testing)").tag(
        config=True
    )

    aliases = traits.Dict(
        {
            "delay": "CameraDemo.delay",
            "cleanframes": "CameraDemo.cleanframes",
            "autoscale": "CameraDemo.autoscale",
            "blit": "CameraDemo.blit",
            "camera": "CameraDemo.camera",
            "optics": "CameraDemo.optics",
            "num-events": "CameraDemo.num_events",