ctapipe is not stable yet, so expect large and rapid changes to structure and functionality as we explore various design choices before the 1.0 release.

Provenance#

class ctapipe.core.Provenance(*args, **kw)[source]#

Bases: object

Manage the provenance info for a stack of activities

use start_activity(name) to start an activity. Any calls to add_input_file or add_output_file will register files within that activity. Finish the current activity with finish_activity.

Nested activities are allowed, and handled as a stack. The final output is not hierarchical, but a flat list of activities (however hierarchical activities could easily be implemented if necessary)

Attributes Summary

active_activity_names

current_activity

finished_activities

finished_activity_names

instance

provenance

returns provenence for full list of activities

Methods Summary

activity(name)

context manager for activities

add_config(config)

add configuration parameters to the current activity

add_input_file(filename[, role])

register an input to the current activity

add_output_file(filename[, role])

register an output to the current activity

as_json(**kwargs)

return all finished provenance as JSON.

clear()

remove all tracked activities

finish_activity([status, activity_name])

end the current activity

start_activity([activity_name])

push activity onto the stack

Attributes Documentation

active_activity_names#
current_activity#
finished_activities#
finished_activity_names#
instance = <ctapipe.core.provenance.Provenance object>#
provenance#

returns provenence for full list of activities

Methods Documentation

activity(name)[source]#

context manager for activities

add_config(config)[source]#

add configuration parameters to the current activity

Parameters:
config: dict

configuration parameters

add_input_file(filename, role=None)[source]#

register an input to the current activity

Parameters:
filename: str

name or url of file

role: str

role this input file satisfies (optional)

add_output_file(filename, role=None)[source]#

register an output to the current activity

Parameters:
filename: str

name or url of file

role: str

role this output file satisfies (optional)

as_json(**kwargs)[source]#

return all finished provenance as JSON. Kwargs for json.dumps may be included, e.g. indent=4

clear()[source]#

remove all tracked activities

finish_activity(status='completed', activity_name=None)[source]#

end the current activity

start_activity(activity_name='/home/docs/checkouts/readthedocs.org/user_builds/ctapipe/envs/stable/bin/python')[source]#

push activity onto the stack