order.config
Contents
order.config#
Definition of a data-taking campaign and the connection of its information to an analysis within a config.
Contents
Class Campaign#
- class Campaign(*args, **kwargs)[source]#
Bases:
order.unique.UniqueObject
,order.mixins.CopyMixin
,order.mixins.AuxDataMixin
,order.mixins.TagMixin
Class that provides data that is subject to a campaign, i.e., a well-defined range of data-taking, detector alignment, MC production settings, datasets, etc. Common, generic information is available via dedicated attributes, specialized data can be stored as auxiliary data.
Arguments
ecm is the center-of-mass energy, bx the bunch-crossing. tags are forwarded to the
TagMixin
, aux to theAuxDataMixin
, name and id to theUniqueObject
constructor.Copy behavior
copy()
All attributes are copied.
copy_shallow()
All attributs are copied except for contained
datasets
which are set to a default value instead.Example
import order as od c = od.Campaign( name="2017B", id=1, ecm=13, bx=25, ) d = c.add_dataset("ttH", 1) d in c.datasets # -> True d.campaign == c # -> True
Members
- ecm#
type: float
The center-of-mass energy in arbitrary units.
- bx#
type: float
The bunch crossing in arbitrary units.
- datasets#
type:
UniqueObjectIndex
(read-only)The
UniqueObjectIndex
of child datasets.
Methods:
add_dataset
(*args, **kwargs)Adds a child dataset to the
datasets
index and returns it.remove_dataset
(*args, **kwargs)Removes a child dataset from the
datasets
index and returns the removed object.Removes all child datasets from the
datasets
index.extend_datasets
(objs)Adds multiple child datasets to the
datasets
index and returns the added objects in a list.get_dataset
(obj[, default])Returns a child dataset given by obj, which might be a name, id, or an instance from the
datasets
index.has_dataset
(obj)Checks if the
datasets
index contains an obj which might be a name, id, or an instance.Attributes:
Returns True when this dataset has child datasets, False otherwise.
Returns True when this dataset has no child datasets, False otherwise.
- add_dataset(*args, **kwargs)[source]#
Adds a child dataset to the
datasets
index and returns it. SeeUniqueObjectIndex.add()
for more info. Also sets the campaign of the added dataset to this instance.
- remove_dataset(*args, **kwargs)[source]#
Removes a child dataset from the
datasets
index and returns the removed object. SeeUniqueObjectIndex.remove()
for more info. Also resets the campaign of the added dataset.
- extend_datasets(objs)#
Adds multiple child datasets to the
datasets
index and returns the added objects in a list.
- get_dataset(obj, default=no_default)#
Returns a child dataset given by obj, which might be a name, id, or an instance from the
datasets
index. When no dataset is found, default is returned when set. Otherwise, an error is raised.
- has_dataset(obj)#
Checks if the
datasets
index contains an obj which might be a name, id, or an instance.
- property has_datasets#
Returns True when this dataset has child datasets, False otherwise.
- property is_leaf_dataset#
Returns True when this dataset has no child datasets, False otherwise.
Class Config#
- class Config(*args, **kwargs)[source]#
Bases:
order.unique.UniqueObject
,order.mixins.CopyMixin
,order.mixins.AuxDataMixin
,order.mixins.TagMixin
Class holding analysis information that is related to a
Campaign
instance. Most of the analysis configuration happens here.Besides references to the
Analysis
andCampaign
instances it belongs to, it stores analysis datasets, processes, channels, categories, variables, and shifts inUniqueObjectIndex
instances.Arguments
datasets, processes, channels, categories, variables, and shifts are initialized from constructor arguments. name and id are forwarded to the
UniqueObject
constructor. name and id default to the values of the campaign instance. Specialized data such as integrated luminosities, triggers, etc, can be stored as auxiliary data aux, which are forwarded to theAuxDataMixin
. tags are forwarded to theTagMixin
.Copy behavior
copy()
The
campaign
andanalysis
attributes are carried over as references, all remaining attributes are copied. Note that the copied config is also registered in the analysis.copy_shallow()
All attributs are copied except for the
analysis
andcampaign
, as well as containeddatasets
,processes
,channels
,variables
andshifts
which are set to default values instead.Example
import order as od analysis = od.Analysis("ttH", 1) campaign = od.Campaign("data_taking_2018", 1) # add the campaign to the analysis, which returns a new config cfg = analysis.add_config(campaign) cfg.name, cfg.id # -> "data_taking_2019", 1 # start configuration cfg.add_dataset(campaign.get_dataset("ttH_bb")) cfg.add_process("ttH_bb", 1, xsecs={13: 0.5071}) bb = cfg.add_channel("bb", 1) bb.add_category("eq6j_eq4b") cfg.add_variable("jet1_px", expression="jet1_pt * cos(jet1_phi)") cfg.add_shift("pdf_up", type=Shift.SHAPE) ... # at some point you might want to create a second config # with other values for that campaign, e.g. for sub-measurements cfg2 = analysis.add_config(campaign, name="sf_meausurement", id=2) ...
Members
- analysis#
type:
Analysis
(read-only)The
Analysis
instance this config belongs to. When set, this config is added to the index of configs of the analysis object.
- shifts#
type:
UniqueObjectIndex
(read-only)The
UniqueObjectIndex
of child shifts.
- variables#
type:
UniqueObjectIndex
(read-only)The
UniqueObjectIndex
of child variables.
- categories#
type:
UniqueObjectIndex
(read-only)The
UniqueObjectIndex
of child categories.
- channels#
type:
UniqueObjectIndex
(read-only)The
UniqueObjectIndex
of child channels.
- processes#
type:
UniqueObjectIndex
(read-only)The
UniqueObjectIndex
of child processes.
- datasets#
type:
UniqueObjectIndex
(read-only)The
UniqueObjectIndex
of child datasets.
Methods:
add_category
(*args, **kwargs)Adds a child category to the
categories
index and returns it.add_channel
(*args, **kwargs)Adds a child channel to the
channels
index and returns it.add_dataset
(*args, **kwargs)Adds a child dataset to the
datasets
index and returns it.add_process
(*args, **kwargs)Adds a child process to the
processes
index and returns it.add_shift
(*args, **kwargs)Adds a child shift to the
shifts
index and returns it.add_variable
(*args, **kwargs)Adds a child variable to the
variables
index and returns it.Removes all child categories from the
categories
index.Removes all child channels from the
channels
index.Removes all child datasets from the
datasets
index.Removes all child processes from the
processes
index.Removes all child shifts from the
shifts
index.Removes all child variables from the
variables
index.copy
(*args, **kwargs[, _specs, _skip])Creates a copy of this instance and returns it.
extend_categories
(objs)Adds multiple child categories to the
categories
index and returns the added objects in a list.extend_channels
(objs)Adds multiple child channels to the
channels
index and returns the added objects in a list.extend_datasets
(objs)Adds multiple child datasets to the
datasets
index and returns the added objects in a list.extend_processes
(objs)Adds multiple child processes to the
processes
index and returns the added objects in a list.extend_shifts
(objs)Adds multiple child shifts to the
shifts
index and returns the added objects in a list.extend_variables
(objs)Adds multiple child variables to the
variables
index and returns the added objects in a list.get_category
(obj[, deep, default])Returns a child category given by obj, which might be a name, id, or an instance from the
categories
index.get_channel
(obj[, deep, default])Returns a child channel given by obj, which might be a name, id, or an instance from the
channels
index.get_dataset
(obj[, default])Returns a child dataset given by obj, which might be a name, id, or an instance from the
datasets
index.Returns all child categories from the
categories
index that have no child categories themselves in a recursive fashion.Returns all child channels from the
channels
index that have no child channels themselves in a recursive fashion.Returns all child processes from the
processes
index that have no child processes themselves in a recursive fashion.get_process
(obj[, deep, default])Returns a child process given by obj, which might be a name, id, or an instance from the
processes
index.get_shift
(obj[, default])Returns a child shift given by obj, which might be a name, id, or an instance from the
shifts
index.get_variable
(obj[, default])Returns a child variable given by obj, which might be a name, id, or an instance from the
variables
index.has_category
(obj[, deep])Checks if the
categories
index contains an obj which might be a name, id, or an instance.has_channel
(obj[, deep])Checks if the
channels
index contains an obj which might be a name, id, or an instance.has_dataset
(obj)Checks if the
datasets
index contains an obj which might be a name, id, or an instance.has_process
(obj[, deep])Checks if the
processes
index contains an obj which might be a name, id, or an instance.has_shift
(obj)Checks if the
shifts
index contains an obj which might be a name, id, or an instance.has_variable
(obj)Checks if the
variables
index contains an obj which might be a name, id, or an instance.remove_category
(obj[, silent])Removes a child category given by obj, which might be a name, id, or an instance from the
categories
index and returns the removed object.remove_channel
(obj[, silent])Removes a child channel given by obj, which might be a name, id, or an instance from the
channels
index and returns the removed object.remove_dataset
(obj[, silent])Removes a child dataset given by obj, which might be a name, id, or an instance from the
datasets
index and returns the removed object.remove_process
(obj[, silent])Removes a child process given by obj, which might be a name, id, or an instance from the
processes
index and returns the removed object.remove_shift
(obj[, silent])Removes a child shift given by obj, which might be a name, id, or an instance from the
shifts
index and returns the removed object.remove_variable
(obj[, silent])Removes a child variable given by obj, which might be a name, id, or an instance from the
variables
index and returns the removed object.walk_categories
([algo, depth_first, ...])Walks through the
categories
index and per iteration, yields a child category, its depth relative to this category, and its child categories in a list that can be modified to alter the walking.walk_channels
([algo, depth_first, include_self])Walks through the
channels
index and per iteration, yields a child channel, its depth relative to this channel, and its child channels in a list that can be modified to alter the walking.walk_processes
([algo, depth_first, include_self])Walks through the
processes
index and per iteration, yields a child process, its depth relative to this process, and its child processes in a list that can be modified to alter the walking.Attributes:
Returns True when this category has child categories, False otherwise.
Returns True when this channel has child channels, False otherwise.
Returns True when this dataset has child datasets, False otherwise.
Returns True when this process has child processes, False otherwise.
Returns True when this shift has child shifts, False otherwise.
Returns True when this variable has child variables, False otherwise.
Returns True when this category has no child categories, False otherwise.
Returns True when this channel has no child channels, False otherwise.
Returns True when this dataset has no child datasets, False otherwise.
Returns True when this process has no child processes, False otherwise.
Returns True when this shift has no child shifts, False otherwise.
Returns True when this variable has no child variables, False otherwise.
- add_category(*args, **kwargs)#
Adds a child category to the
categories
index and returns it. SeeUniqueObjectIndex.add()
for more info.
- add_channel(*args, **kwargs)#
Adds a child channel to the
channels
index and returns it. SeeUniqueObjectIndex.add()
for more info.
- add_dataset(*args, **kwargs)#
Adds a child dataset to the
datasets
index and returns it. SeeUniqueObjectIndex.add()
for more info.
- add_process(*args, **kwargs)#
Adds a child process to the
processes
index and returns it. SeeUniqueObjectIndex.add()
for more info.
- add_shift(*args, **kwargs)#
Adds a child shift to the
shifts
index and returns it. SeeUniqueObjectIndex.add()
for more info.
- add_variable(*args, **kwargs)#
Adds a child variable to the
variables
index and returns it. SeeUniqueObjectIndex.add()
for more info.
- clear_categories()#
Removes all child categories from the
categories
index.
- copy(*args, **kwargs, _specs=None, _skip=None)[source]#
Creates a copy of this instance and returns it. All args and kwargs are converted to named arguments (based on the init signature) and set as attributes of the created copy. Additional specifications per attribute are taken from
copy_specs
or _specs if set. _skip can be a sequence of source attribute names that should be skipped.
- extend_categories(objs)#
Adds multiple child categories to the
categories
index and returns the added objects in a list.
- extend_channels(objs)#
Adds multiple child channels to the
channels
index and returns the added objects in a list.
- extend_datasets(objs)#
Adds multiple child datasets to the
datasets
index and returns the added objects in a list.
- extend_processes(objs)#
Adds multiple child processes to the
processes
index and returns the added objects in a list.
- extend_shifts(objs)#
Adds multiple child shifts to the
shifts
index and returns the added objects in a list.
- extend_variables(objs)#
Adds multiple child variables to the
variables
index and returns the added objects in a list.
- get_category(obj, deep=True, default=no_default)#
Returns a child category given by obj, which might be a name, id, or an instance from the
categories
index. If deep is True, the lookup is recursive through potentially nested child categories. When no category is found, default is returned when set. Otherwise, an error is raised.
- get_channel(obj, deep=True, default=no_default)#
Returns a child channel given by obj, which might be a name, id, or an instance from the
channels
index. If deep is True, the lookup is recursive through potentially nested child channels. When no channel is found, default is returned when set. Otherwise, an error is raised.
- get_dataset(obj, default=no_default)#
Returns a child dataset given by obj, which might be a name, id, or an instance from the
datasets
index. When no dataset is found, default is returned when set. Otherwise, an error is raised.
- get_leaf_categories()#
Returns all child categories from the
categories
index that have no child categories themselves in a recursive fashion. Possible duplicates due to nested structures are removed.
- get_leaf_channels()#
Returns all child channels from the
channels
index that have no child channels themselves in a recursive fashion. Possible duplicates due to nested structures are removed.
- get_leaf_processes()#
Returns all child processes from the
processes
index that have no child processes themselves in a recursive fashion. Possible duplicates due to nested structures are removed.
- get_process(obj, deep=True, default=no_default)#
Returns a child process given by obj, which might be a name, id, or an instance from the
processes
index. If deep is True, the lookup is recursive through potentially nested child processes. When no process is found, default is returned when set. Otherwise, an error is raised.
- get_shift(obj, default=no_default)#
Returns a child shift given by obj, which might be a name, id, or an instance from the
shifts
index. When no shift is found, default is returned when set. Otherwise, an error is raised.
- get_variable(obj, default=no_default)#
Returns a child variable given by obj, which might be a name, id, or an instance from the
variables
index. When no variable is found, default is returned when set. Otherwise, an error is raised.
- property has_categories#
Returns True when this category has child categories, False otherwise.
- has_category(obj, deep=True)#
Checks if the
categories
index contains an obj which might be a name, id, or an instance. If deep is True, the lookup is recursive through potentially nested child categories.
- has_channel(obj, deep=True)#
Checks if the
channels
index contains an obj which might be a name, id, or an instance. If deep is True, the lookup is recursive through potentially nested child channels.
- property has_channels#
Returns True when this channel has child channels, False otherwise.
- has_dataset(obj)#
Checks if the
datasets
index contains an obj which might be a name, id, or an instance.
- property has_datasets#
Returns True when this dataset has child datasets, False otherwise.
- has_process(obj, deep=True)#
Checks if the
processes
index contains an obj which might be a name, id, or an instance. If deep is True, the lookup is recursive through potentially nested child processes.
- property has_processes#
Returns True when this process has child processes, False otherwise.
- has_shift(obj)#
Checks if the
shifts
index contains an obj which might be a name, id, or an instance.
- property has_shifts#
Returns True when this shift has child shifts, False otherwise.
- has_variable(obj)#
Checks if the
variables
index contains an obj which might be a name, id, or an instance.
- property has_variables#
Returns True when this variable has child variables, False otherwise.
- property is_leaf_category#
Returns True when this category has no child categories, False otherwise.
- property is_leaf_channel#
Returns True when this channel has no child channels, False otherwise.
- property is_leaf_dataset#
Returns True when this dataset has no child datasets, False otherwise.
- property is_leaf_process#
Returns True when this process has no child processes, False otherwise.
- property is_leaf_shift#
Returns True when this shift has no child shifts, False otherwise.
- property is_leaf_variable#
Returns True when this variable has no child variables, False otherwise.
- remove_category(obj, silent=False)#
Removes a child category given by obj, which might be a name, id, or an instance from the
categories
index and returns the removed object. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()
for more info.
- remove_channel(obj, silent=False)#
Removes a child channel given by obj, which might be a name, id, or an instance from the
channels
index and returns the removed object. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()
for more info.
- remove_dataset(obj, silent=False)#
Removes a child dataset given by obj, which might be a name, id, or an instance from the
datasets
index and returns the removed object. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()
for more info.
- remove_process(obj, silent=False)#
Removes a child process given by obj, which might be a name, id, or an instance from the
processes
index and returns the removed object. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()
for more info.
- remove_shift(obj, silent=False)#
Removes a child shift given by obj, which might be a name, id, or an instance from the
shifts
index and returns the removed object. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()
for more info.
- remove_variable(obj, silent=False)#
Removes a child variable given by obj, which might be a name, id, or an instance from the
variables
index and returns the removed object. Unless silent is True, an error is raised if the object was not found. SeeUniqueObjectIndex.remove()
for more info.
- walk_categories(algo='bfs', depth_first=False, include_self=False)#
Walks through the
categories
index and per iteration, yields a child category, its depth relative to this category, and its child categories in a list that can be modified to alter the walking.The traversal order is defined by algo which allows different values (more info):
"bfs"
: Breadth-first search."dfs_preorder"
: Pre-order depth-first search."dfs_postorder"
: Post-order depth-first search."dfs"
: Alias for"dfs_preorder"
."dfs_pre"
: Alias for"dfs_preorder"
."dfs_post"
: Alias for"dfs_postorder"
.
When include_self is True, this category instance is yielded as well with a depth of 0.
- walk_channels(algo='bfs', depth_first=False, include_self=False)#
Walks through the
channels
index and per iteration, yields a child channel, its depth relative to this channel, and its child channels in a list that can be modified to alter the walking.The traversal order is defined by algo which allows different values (more info):
"bfs"
: Breadth-first search."dfs_preorder"
: Pre-order depth-first search."dfs_postorder"
: Post-order depth-first search."dfs"
: Alias for"dfs_preorder"
."dfs_pre"
: Alias for"dfs_preorder"
."dfs_post"
: Alias for"dfs_postorder"
.
When include_self is True, this channel instance is yielded as well with a depth of 0.
- walk_processes(algo='bfs', depth_first=False, include_self=False)#
Walks through the
processes
index and per iteration, yields a child process, its depth relative to this process, and its child processes in a list that can be modified to alter the walking.The traversal order is defined by algo which allows different values (more info):
"bfs"
: Breadth-first search."dfs_preorder"
: Pre-order depth-first search."dfs_postorder"
: Post-order depth-first search."dfs"
: Alias for"dfs_preorder"
."dfs_pre"
: Alias for"dfs_preorder"
."dfs_post"
: Alias for"dfs_postorder"
.
When include_self is True, this process instance is yielded as well with a depth of 0.