Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use ctapipe.core.provenance to track open files #25

Open
kosack opened this issue Jan 22, 2020 · 0 comments
Open

use ctapipe.core.provenance to track open files #25

kosack opened this issue Jan 22, 2020 · 0 comments

Comments

@kosack
Copy link
Contributor

kosack commented Jan 22, 2020

I notice that there are multiple files opened at various times in this code. Any time you open a file, you must register it with ctapipe's provenance system, so that we can track what depends on what (a requirement of CTA).

So if you don't use ctapipe.utils.get_dataset_* (which do it automatically), you must do it manually as follows:

from ctapipe.core import Provenance


...
# for inputs:
Provenance().add_input_file("LSTCam.camgeom.fits", role="CameraGeometry") 

# for outputs:
Provenance().add_output_file("events.h5", role="DL1/Event") 

Where role shuold be something that describes why you opened the file (e.g. "DL0/Event" or "CameraGeometry", etc.)

Then it will end up automatically in the Tool output (in provenance.log and in stdout if you set the --log-level=DEBUG

The recorded provenance from ctapipe-camdemo --camera MAGICCamMARS --log-level=DEBUG looks like this:

...
      "input": [
         {
            "url": "/Users/kkosack/Library/Caches/Python-Eggs/ctapipe_extra-0.2.18-py3.7.egg-tmp/ctapipe_resources/MAGICCamMars.camgeom.fits.gz",
            "role": "dl0.tel.svc.camera"
         },
         {
            "url": "/Users/kkosack/Library/Caches/Python-Eggs/ctapipe_extra-0.2.18-py3.7.egg-tmp/ctapipe_resources/optics.ecsv.txt",
            "role": "dl0.tel.svc.optics"
         }
      ],
      "output": [],
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant