https://github.com/cta-observatory/ctapipe_io_magic

ctapipe plugin to access the MAGIC calibrated data

https://github.com/cta-observatory/ctapipe_io_magic

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    5 of 11 committers (45.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.7%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

ctapipe plugin to access the MAGIC calibrated data

Basic Info
  • Host: GitHub
  • Owner: cta-observatory
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: master
  • Size: 670 KB
Statistics
  • Stars: 1
  • Watchers: 7
  • Forks: 5
  • Open Issues: 3
  • Releases: 17
Created about 7 years ago · Last pushed 11 months ago
Metadata Files
Readme License

README.md

ctapipeiomagic Build Status PyPI version Conda version

ctapipe MAGIC event source

EventSource plugin for ctapipe, needed to read the calibrated data of the MAGIC telescope system. It requires ctapipe (v0.19.x) and uproot (>=5) packages to run.

Installation

Since version 0.5.4, ctapipe_io_magic is on conda-forge (here), which is the easiest way to install it.

To install into an exisiting environtment, just do: ```

or conda

$ mamba install -c conda-forge ctapipe-io-magic ```

or, to create a new environment: ```

or conda

mamba create -c conda-forge -n magicio python=3.11 ctapipe-io-magic ```

Alternatively, you can always clone the repository and install like in the following:

bash git clone https://github.com/cta-observatory/ctapipe_io_magic.git cd ctapipe_io_magic conda env create -n ctapipe-io_magic -f environment.yml conda activate ctapipe-io_magic pip install .

ctapipe_io_magic is also in PyPI (see here).

Test Data

To run the tests, a set of non-public files is needed. If you are a member of MAGIC, ask one of the project maintainers for the credentials and then run:

bash ./download_test_data.sh

Usage

```python import ctapipe from ctapipeiomagic import MAGICEventSource

with MAGICEventSource(inputurl=filename) as eventsource: for event in eventsource: ...some processing... ```

With more recent versions of ctapipe, only one file at a time can be read. However, by default if a subrun of calibrated data is given as input, MAGICEventSource will read the events from all the subruns from the run to which the data file belongs. To suppress this behavior, set process_run=False No matching of the events is performed at this level (if stereo data).

Starting from v0.4.7, MAGICEventSource will automatically recognize the type of data contained in the calibrated ROOT files (stereo or mono; std trigger or SumT). For MC data, in the case stereo MC data are to be used for mono analysis, one can set to True the use_mc_mono_events option of the MAGICEventSource to use also mono triggered events.

Pedestal events (trigger pattern = 8) can be generated as well.

The reader is able to handle real data or Monte Carlo files, which are automatically recognized. Note that the names of input files have to follow the convention: - *_M[1-2]_RUNNUMBER.SUBRUNNR_Y_*.root for real data - *_M[1-2]_za??to??_?_RUNNUMBER_Y_*.root for simulated data.

However, the information which can be extracted from the file names is read directly from within the ROOT files.

More usage

Select a single run:

```python run = eventsource.setactiverun(eventsource.runnumbers[0])

run is an object of type MarsCalibratedRun

assuming we are reading data from a file from M1

for n in range(run['data'].nmonoeventsm1): run['data'].getmonoeventdata(n, 'M1')

for n in range(run['data'].npedestaleventsm1): run['data'].getpedestaleventdata(n, 'M1') ```

Select events triggering in stereo and pedestal events from a single telescope (recognized automatically) over event generator:

```python

select (stereo) cosmic events from all subruns of a given run (the one to which file_name belongs)

eventgenerator = MAGICEventSource(inputurl=filename) for cosmicevent in event_generator: ...some processing...

select (stereo) cosmic events from a single subrun

eventgenerator = MAGICEventSource(inputurl=filename, processrun=False) for cosmicevent in eventgenerator: ...some processing...

select pedestal events

pedestaleventgenerator = MAGICEventSource(inputurl=filename, usepedestals=True) for pedestalevent in pedestaleventgenerator: ...some processing... ```

Features

Drive reports interpolation

By default, when all subruns from a given run are processed, the drive reports are collected from all subruns so that the telescope pointing position for each event can be computed. Also in the case that only one subrun is processed (process_run=False), all drive reports from the subruns belonging to the same run will be used. This ensures that interpolation is performed correctly.

Monitoring data

Monitoring data are saved in run['data'].monitoring_data and can also accessed event-wise via the event.mon container. Available information is: - dead pixels: event.mon.tel[tel_id].pixel_status.hardware_failing_pixels[0] - hot pixels: event.mon.tel[tel_id].pixel_status.pedestal_failing_pixels[i_ped_type], where i_ped_type is an index indicating which pedestal type to use (0 is PedestalFundamental, 1 is PedestalFromExtractor and 2 is PedestalFromExtractorRndm)

Dead and hot pixels are used in magic-cta-pipe for the MAGIC cleaning.

Simulation Configuration Data

Some general information about the simulated data, useful for IRF calculation, are read from the root files and stored in data.simulation container.

Changelog

  • v0.1: Initial version
  • v0.2.0: Unification of data and MC reading
  • v0.2.1: Monitoring data (Dead pixel and pedestal information)
  • v0.2.2: Added MC Header info
  • v0.2.3: Solve issue when interpolating information from drive reports, causing crashes when using pointing information in astropy SkyCoord objects. Make the reader faster when searching for ids of mono and stereo events
  • v0.2.4: fixes in monoeventgenerator; fix to allow the use of relative paths as input_url
  • v0.3.0: update uproot to v4, since v3 is deprecated
  • v0.4.0: version compatible with ctapipe v0.12
  • v0.4.1: added CI, refactoring of code, added tests, extract drive information once
  • v0.4.2: added more tests, refactored code, allow the processing of all subruns from the same run at the same time (including drive information), correct de-rotation of quantities from the CORSIKA frame to the geographical frame, computation of bad pixels, modification of focal length to take into account the coma aberration, fix dowload of test data set
  • v0.4.3: difference of arrival times between events read from ROOT files, used for effective observation time calculation
  • v0.4.4: changed units of peak_time from time slices (as stored in MARS) to nanoseconds
  • v0.4.5: fixed automatic tests, add possibility to choose between effective and nominal focal length
  • v0.4.6: add support to read in data taken in mono mode (full for real data, partial for MCs). Fixed bug in recognition of mono/stereo or standard trigger/SumT data (added also for MC)
  • v0.4.7: add full support to read in real and MC data taken in mono mode, and with SumT. Added treatment of unsuitable pixels for MC data. Added readout of true XMax value from MC data (usually not available, filled with 0 otherwise)
  • v0.5.0: release compatible with ctapipe 0.17. Also, the equivalent focal length is set to the correct value used in MAGIC simulations (i.e. 16.97 meters)
  • v0.5.1: release compatible with ctapipe 0.19
  • v0.5.2: introduce capability of reading data taken with the Hardware Stereo Trigger (HaST) between MAGIC and LST-1. Also, fixed bug when getting the time difference between events for mono data
  • v0.5.3: support for python 3.11
  • v0.5.4: change license to BSD-3, add badges in README, do not use default channel in environment
  • v0.5.5: read LIDAR information, add checks for missing trees in the input files, take prescaler and trigger information from previous subruns if they are missing, add release-drafter and PyPI deploy workflows
  • v0.5.6: small maintenance changes
  • v0.5.7: changes for ctapipe v0.25

Owner

  • Name: Cherenkov Telescope Array Consortium
  • Login: cta-observatory
  • Kind: organization

open-source software for the CTA Consortium.

GitHub Events

Total
  • Release event: 2
  • Delete event: 2
  • Member event: 1
  • Issue comment event: 9
  • Push event: 14
  • Pull request review event: 3
  • Pull request review comment event: 3
  • Pull request event: 8
  • Create event: 5
Last Year
  • Release event: 2
  • Delete event: 2
  • Member event: 1
  • Issue comment event: 9
  • Push event: 14
  • Pull request review event: 3
  • Pull request review comment event: 3
  • Pull request event: 8
  • Create event: 5

Committers

Last synced: over 3 years ago

All Time
  • Total Commits: 441
  • Total Committers: 11
  • Avg Commits per committer: 40.091
  • Development Distribution Score (DDS): 0.361
Top Committers
Name Email Commits
Alessio Berti a****0@g****m 282
Moritz Hütten m****n@m****e 49
Ievgen Vovk i****k@m****e 40
YoshikiOhtani o****i@i****p 28
Ievgen Vovk I****k@m****e 18
Federico Di Pierro d****r@H****3 10
Yoshiki Ohtani y****i@c****g 6
Julian Sitarek j****k@u****l 4
Elli Sophie Jobst e****t@g****e 2
Federico Di Pierro f****o@t****t 1
Yusuke Suda y****e@m****e 1

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 26
  • Total pull requests: 76
  • Average time to close issues: about 1 month
  • Average time to close pull requests: about 1 month
  • Total issue authors: 5
  • Total pull request authors: 8
  • Average comments per issue: 2.69
  • Average comments per pull request: 1.89
  • Merged pull requests: 66
  • Bot issues: 0
  • Bot pull requests: 6
Past Year
  • Issues: 0
  • Pull requests: 9
  • Average time to close issues: N/A
  • Average time to close pull requests: 10 days
  • Issue authors: 0
  • Pull request authors: 3
  • Average comments per issue: 0
  • Average comments per pull request: 1.11
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 3
Top Authors
Issue Authors
  • aleberti (11)
  • YoshikiOhtani (9)
  • jsitarek (4)
  • ellijobst (1)
  • aaguasca (1)
Pull Request Authors
  • aleberti (43)
  • YoshikiOhtani (10)
  • dependabot[bot] (10)
  • Elisa-Visentin (5)
  • jsitarek (4)
  • nzywucka (3)
  • nbiederbeck (2)
  • ellijobst (2)
Top Labels
Issue Labels
enhancement (6) question (2)
Pull Request Labels
dependencies (12) enhancement (3) bug (1) github_actions (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 108 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 1
  • Total versions: 16
  • Total maintainers: 1
pypi.org: ctapipe-io-magic

ctapipe plugin for reading calibrated MAGIC files

  • Versions: 16
  • Dependent Packages: 1
  • Dependent Repositories: 1
  • Downloads: 108 Last month
Rankings
Dependent packages count: 4.8%
Forks count: 14.3%
Downloads: 17.0%
Average: 17.9%
Dependent repos count: 21.6%
Stargazers count: 31.9%
Maintainers (1)
Last synced: 11 months ago

Dependencies

setup.py pypi
  • astropy >=4.0.5,<5
  • ctapipe *
  • numpy *
  • scipy *
  • uproot *
.github/workflows/ci.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • codecov/codecov-action v1 composite
.github/workflows/deploy.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • pypa/gh-action-pypi-publish master composite
environment.yml pypi
pyproject.toml pypi