nectarchain.makers.core.EventsLoopNectarCAMCalibrationTool#
- class EventsLoopNectarCAMCalibrationTool(*args, **kwargs)[source]#
Bases:
BaseNectarCAMCalibrationToolA class for data processing and computation on events from a specific run.
- Args:
run_number (int): The ID of the run to be processed. max_events (int, optional): The maximum number of events to be loaded. Defaults to None. run_file (optional): The specific run file to be loaded.
- Example Usage:
maker = EventsLoopMaker(run_number=1234, max_events=1000) maker.make(n_events=500)
This method is used to pass to the current instance of Tool the traits defined in the components provided in the componentsList trait. WARNING : This method is maybe not the best way to do it, need to discuss with ctapipe developers.
Methods
add_componentconstructs and adds a component to the list of registered components, so that later we can ask for the current configuration of all instances, e.g. in`get_full_config()`.
add_traitsDynamically add trait attributes to the HasTraits instance.
check_outputTest if output files exist and if they do, throw an error unless
self.overwriteis set to True.class_config_rst_docGenerate rST documentation for this class' config options.
class_config_sectionGet the config section for this class.
class_get_helpGet the help string for this class in ReST format.
class_get_trait_helpGet the helptext string for a single trait.
class_own_trait_eventsGet a dict of all event handlers defined on this class, not a parent.
class_own_traitsGet a dict of all the traitlets defined on this class, not a parent.
class_print_helpGet the help string for a single trait and print it.
class_trait_namesGet a list of all the names of this class' traits.
class_traitsGet a
dictof all the traits of this class.clear_instanceunset _instance for this class and singleton parents.
close_handlersdocument_config_optionsGenerate rST format documentation for the config options this application
emit_alias_helpYield the lines for alias part of the help.
emit_descriptionYield lines with the application description.
emit_examplesYield lines with the usage and examples.
emit_flag_helpYield the lines for the flag part of the help.
emit_helpYield the help-lines for each Configurable class in self.classes.
emit_help_epilogueYield the very bottom lines of the help message.
emit_options_helpYield the lines for the options part of the help.
emit_subcommands_helpYield the lines for the subcommand part of the help.
enter_contextAdd a new context manager to the
ExitStackof this Toolexitfinishflatten_flagsFlatten flags and aliases for loaders, so cl-args override as expected.
generate_config_filegenerate default config file from Configurables
get_current_configreturn the current configuration as a dict (e.g. the values of all traits, even if they were not set during configuration).
get_default_logging_configReturn the base logging configuration.
has_traitReturns True if the object has a trait with the specified name.
hold_trait_notificationsContext manager for bundling trait change notifications and cross validation.
initializeHandle config and any other low-level setup.
initialize_subcommandInitialize a subcommand with argv.
initializedHas an instance been created?
instanceReturns a global instance of this class.
launch_instanceLaunch a global instance of this Application
load_config_environLoad config files by environment.
load_config_fileLoad a configuration file in one of the supported formats, and merge it with the current config if it exists.
load_runStatic method to load from $NECTARCAMDATA directory data for specified run with max_events.
notify_changeNotify observers of a change event
observeSetup a handler to be called when a trait changes.
on_trait_changeDEPRECATED: Setup a handler to be called when a trait changes.
parse_command_lineParse the command line arguments.
print_alias_helpPrint the alias parts of the help.
print_descriptionPrint the application description.
print_examplesPrint usage and examples (see
emit_examples()).print_flag_helpPrint the flag part of the help.
print_helpPrint the help for each Configurable class in self.classes.
print_optionsPrint the options part of the help.
print_subcommandsPrint the subcommand part of the help.
print_versionPrint the version string.
runRun the tool.
section_namesreturn section names as a list
set_traitForcibly sets trait attribute, including read-only attributes.
setupsetup_instanceMethod to decide if criteria to end a run slice are met
Method to extract data from the EventSource.
start_show_configstart function used when show_config is True
trait_defaultsReturn a trait's default value or a dictionary of them
trait_eventsGet a
dictof all the event handlers of this class.trait_has_valueReturns True if the specified trait has a value.
trait_metadataGet metadata values for trait by key.
trait_namesGet a list of all the names of this class' traits.
trait_valuesA
dictof trait names and their values.traitsGet a
dictof all the traits of this class.unobserveRemove a trait change handler.
unobserve_allRemove trait change handlers of any type for the specified name.
update_configUpdate config and load the new values
update_logging_configUpdate the configuration of loggers.
write_provenanceAttributes
aliasesargvAn instance of a Python list.
classescli_configThe subset of our configuration that came from the command-line
List of Component names to be apply, the order will be respected.
configA trait whose value must be an instance of a specified class.
config_filesList of configuration files with parameters to load in addition to command-line parameters.
cross_validation_lockA contextmanager for running a block with our cross validation lock set to True.
descriptionGetter method for the _event_source attribute.
number of events that will be treat before to pull the buffer and writeto disk, if None, all the events will be loaded
examplesextra_argsAn instance of a Python list.
flagskeyvalue_descriptionA trait for unicode strings.
loaded_config_filesCurrently loaded configuration files
logLogger or LoggerAdapter instance
log_configAn instance of a Python dict.
log_datefmtThe date format used by logging formatters for %(asctime)s
log_fileFilename for the log
log_file_levelLogging Level for File Logging
log_formatThe Logging format template
log_levelSet the log level by value or name.
logging_configConfigure additional log handlers.
maximum number of events to be loaded
nameGetter method for the npixels attribute.
option_descriptionA trait for unicode strings.
output filename
overwriteA boolean (True, False) trait.
parentA trait whose value must be an instance of a specified class.
Getter method for the pixels_id attribute.
progress_barshow progress bar during processing
provenance_logA path Trait for input/output files.
quietA boolean (True, False) trait.
raise_config_file_errorsA boolean (True, False) trait.
file name to be loaded
run number to be treated
show_configInstead of starting the Application, dump configuration to stdout
show_config_jsonInstead of starting the Application, dump configuration to stdout (as JSON)
subappA trait whose value must be an instance of a specified class.
subcommand_descriptionA trait for unicode strings.
subcommandsAn instance of a Python dict.
versionA trait for unicode strings.
version_stringa formatted version string with version, release, and git hash
- componentsList#
List of Component names to be apply, the order will be respected. Possible values: []
- property event_source#
Getter method for the _event_source attribute.
- events_per_slice#
number of events that will be treat before to pull the buffer and writeto disk, if None, all the events will be loaded
- max_events#
maximum number of events to be loaded
- property npixels#
Getter method for the npixels attribute.
- output_path#
output filename
- property pixels_id#
Getter method for the pixels_id attribute.
- run_file#
file name to be loaded
- run_number#
run number to be treated
- split_run(n_events_in_slice=None, event=None)[source]#
Method to decide if criteria to end a run slice are met
- start(n_events=inf, restart_from_begining=False, *args, **kwargs)[source]#
Method to extract data from the EventSource.
- Parameters:
- n_events: int, optional
The maximum number of events to process. Default is np.inf.
- restart_from_begining: bool, optional
Whether to restart the event source reader. Default is False.
- args
Additional arguments that can be passed to the method.
- kwargs
Additional keyword arguments that can be passed to the method.
- Returns:
- The output container created by the _make_output_container method.