Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • C ctapipe_io_magic
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4
    • Issues 4
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Ievgen Vovk
  • ctapipe_io_magic
  • Issues
  • #11

Closed
Open
Created Dec 30, 2020 by Alessio Berti@g-alessiobertiDeveloper

No interpolation of events az/zd/ra/dec gives error in astropy

When running hillas_preprocessing_MAGICCleaning_stereo.py from https://gitlab.mpcdf.mpg.de/ievo/magic-cta-pipe (as of commit 8005e0914eb0910d2014cdc212ffe925b0e79861) repository on a run of OFF data (run 05085314 from 20190925, source AT2019pqh), I get the error:

Traceback (most recent call last):
  File "hillas_preprocessing_MAGICCleaning_stereo.py", line 493, in <module>
    output_name=config['data_files'][data_type][sample][telescope_type]['hillas_output'])
  File "hillas_preprocessing_MAGICCleaning_stereo.py", line 321, in process_dataset_data
    frame=horizon_frame,
  File "/storage/gpfs_data/ctalocal/aberti/miniconda3/envs/magic-lst/lib/python3.7/site-packages/astropy/coordinates/sky_coordinate.py", line 315, in __init__
    frame_cls(**frame_kwargs), args, kwargs)
  File "/storage/gpfs_data/ctalocal/aberti/miniconda3/envs/magic-lst/lib/python3.7/site-packages/astropy/coordinates/sky_coordinate_parsers.py", line 245, in _parse_coordinate_data
    valid_components.update(_get_representation_attrs(frame, units, kwargs))
  File "/storage/gpfs_data/ctalocal/aberti/miniconda3/envs/magic-lst/lib/python3.7/site-packages/astropy/coordinates/sky_coordinate_parsers.py", line 592, in _get_representation_attrs
    valid_kwargs[frame_attr_name] = repr_attr_class(value, unit=unit)
  File "/storage/gpfs_data/ctalocal/aberti/miniconda3/envs/magic-lst/lib/python3.7/site-packages/astropy/coordinates/angles.py", line 536, in __new__
    self._validate_angles()
  File "/storage/gpfs_data/ctalocal/aberti/miniconda3/envs/magic-lst/lib/python3.7/site-packages/astropy/coordinates/angles.py", line 558, in _validate_angles
    'got {}'.format(angles.to(u.degree)))
ValueError: Latitude angle(s) must be within -90 deg <= angle <= 90 deg, got 91.0 deg

The error is thrown for an event for which event.pointing.array_altitude is set to 91 deg. Checking the zenith values of the events in that run, they are all around 40-45deg, so the value must come from somewhere else. Indeed, I could trace the strange value of altitude to ctapipe_io_magic, in particular to the portion of code where interpolation of zd/az/ra/dec is performed. Examining the code, the interpolation of the events zd/az/ra/dec is performed subrun-wise starting from the drive reports. In the case there are 2 or less drive reports in a subrun, zd/az/ra/dec are set to -1 for all events in that subrun (and there is no warning about that). The altitude is then calculated as 90-zd, which results in a value of 91deg for zd=-1, that is the value retrieved in the magic-cta-pipe script.

Indeed, in one of the subruns for M1, there is only 1 drive report, therefore interpolation is not performed.

Edited Dec 30, 2020 by Alessio Berti
Assignee
Assign to
Time tracking