ATLAS Offline Software
Loading...
Searching...
No Matches
yodamerge_tmp Namespace Reference

Variables

 parser = argparse.ArgumentParser(usage=__doc__)
 nargs
 help
 default
 dest
 metavar
 action
 False
 True
 args = parser.parse_args()
 S1D_MODE
 S2D_MODE
 S3D_MODE
dict analysisobjects_in = {}
 filename
 scale = float(scale)
 aos = yoda.read(filename, patterns=args.PATHPATTERNS, unpatterns=args.PATHUNPATTERNS)
dict analysisobjects_out = {}
 aotype = type(aos[0])
str msg = "WARNING: cannot merge mismatched analysis object types for path %s: " % p
bool scatter_fail = False
list saos = []
 sao = ao.mkScatter()
 saotype = type(saos[0])
list aos_nonzero = [ao for ao in aos if ao.sumW() != 0]
 rescale = None
 ao_out = aos[0].clone()
 dim = ao_out.dim()
 SND_MODE = getattr(args, "S%dD_MODE" % dim)
list axis = ['', 'x', 'y', 'z']
 npoints = len(ao_out.points())
float val_i = 0.0
dict ep_i = {}
dict em_i = {}
 variations = ao.variations()

Detailed Description

\
%(prog)s [-o outfile] <yodafile1>[:<scale1>] <yodafile2>[:<scale1>] ...
  e.g. %(prog)s run1.yoda run2.yoda run3.yoda  (unweighted merging of three runs)
    or %(prog)s run1.yoda:2.0 run2.yoda:3.142  (weighted merging of two runs)

Merge analysis objects from multiple YODA files, combining the statistics of
objects whose names are found in multiple files. May be used either to merge
disjoint collections of data objects, or to combine multiple statistically
independent runs of the same data objects into one high-statistics run. Optional
scaling parameters may be given to rescale the weights of the objects on a
per-file basis before merging.

By default the output is written to stdout since we can't guess what would be
a good automatic filename choice! Use the -o option to provide an output filename.


IMPORTANT!
  This script is not meant to handle all run merging situations or data objects:
  there are limitations to what can be inferred from data objects alone. If you
  need to do something more complex than the common cases handled by this script,
  please write your own script / program to load and process the data objects.


SCATTERS (E.G. HISTOGRAM RATIOS) CAN'T BE MERGED

  Note that 'scatter' data objects, as opposed to histograms, cannot be merged
  by this tool since they do not preserve sufficient statistical
  information. The canonical example of this is a ratio plot: there are
  infinitely many combinations of numerator and denominator which could give the
  same ratio, and the result does not indicate anything about which of those
  infinite inputs is right (or the effects of correlations in the division).

  If you need to merge Scatter2D objects, you can write your own Python script
  or C++ program using the YODA interface, and apply whatever case-specific
  treatment is appropriate. By default the first such copy encountered will be
  returned as the 'merged' output, with no actual merging having been done.

NORMALIZED, UNNORMALIZED, OR A MIX?

  An important detail in histogram merging is whether a statistical treatment
  for normalized or unnormalized histograms should be used: in the former case
  the normalization scaling must be undone *before* the histograms are added
  together, and then re-applied afterwards. This script examines the ScaledBy
  attribute each histograms to determine if it has been normalized. We make the
  assumption that if ScaledBy exists (i.e. h.scaleW has been called) then the
  histogram is normalized and we normalize the resulting merged histogram to the
  weighted average of input norms; if there is no ScaledBy, we assume that the
  histogram is not normalised.

  This is not an infallible approach, but we believe is more robust than heuristics
  to determine whether norms are sufficiently close to be considered equal.
  In complicated situations you will again be better off writing your own
  script or program to do the merging: the merging machinery of this script is
  available directly in the yoda Python module.

MORE NOTES
 
  If all the input histograms with a particular path are found to have the same
  normalization, and they have ScaledBy attributes indicating that a histogram
  weight scaling has been applied in producing the input histograms, each
  histogram in that group will be first unscaled by their appropriate factor, then
  merged, and then re-normalized to the target value. Otherwise the weights from
  each histogram copy will be directly added together with no attempt to guess an
  appropriate normalization. The normalization guesses (and they are guesses --
  see below) are made *before* application of the per-file scaling arguments.
 
  IMPORTANT: note from the above that this script can't work out what to do
  re. scaling and normalization of output histograms from the input data files
  alone. It may be possible (although unlikely) that input histograms have the
  same normalization but are meant to be added directly. It may also be the case
  (and much more likely) that histograms which should be normalized to a common
  value will not trigger the appropriate treatment due to e.g. statistical
  fluctuations in each run's calculation of a cross-section used in the
  normalization. And anything more complex than a global scaling (e.g. calculation
  of a ratio or asymmetry) cannot be handled at all with a post-hoc scaling
  treatment. The --assume-normalized command line option will force all histograms
  to be treated as if they are normalized in the input, which can be useful if
  you know that all the output histograms are indeed of this nature. If they are
  not, it will go wrong: you have been warned!
 
  Please use this script as a template if you need to do something more specific.
 
  NOTE: there are many possible desired behaviours when merging runs, depending on
  the factors above as well as whether the files being merged are of homogeneous
  type, heterogeneous type, or a combination of both. It is tempting, therefore,
  to add a large number of optional command-line parameters to this script, to
  handle these cases. Experience from Rivet 1.x suggests that this is a bad idea:
  if a problem is of programmatic complexity then a command-line interface which
  attempts to solve it in general is doomed to both failure and unusability. Hence
  we will NOT add extra arguments for applying different merging weights or
  strategies based on analysis object path regexes, auto-identifying 'types' of
  run, etc., etc.: if you need to merge data files in such complex ways, please
  use this script as a template around which to write logic that satisfies your
  particular requirements.

Variable Documentation

◆ action

yodamerge_tmp.action

Definition at line 116 of file yodamerge_tmp.py.

◆ analysisobjects_in

dict yodamerge_tmp.analysisobjects_in = {}

Definition at line 136 of file yodamerge_tmp.py.

◆ analysisobjects_out

dict yodamerge_tmp.analysisobjects_out = {}

Definition at line 150 of file yodamerge_tmp.py.

◆ ao_out

yodamerge_tmp.ao_out = aos[0].clone()

Definition at line 219 of file yodamerge_tmp.py.

◆ aos

list yodamerge_tmp.aos = yoda.read(filename, patterns=args.PATHPATTERNS, unpatterns=args.PATHUNPATTERNS)

Definition at line 145 of file yodamerge_tmp.py.

◆ aos_nonzero

list yodamerge_tmp.aos_nonzero = [ao for ao in aos if ao.sumW() != 0]

Definition at line 185 of file yodamerge_tmp.py.

◆ aotype

yodamerge_tmp.aotype = type(aos[0])

Definition at line 154 of file yodamerge_tmp.py.

◆ args

yodamerge_tmp.args = parser.parse_args()

Definition at line 126 of file yodamerge_tmp.py.

◆ axis

list yodamerge_tmp.axis = ['', 'x', 'y', 'z']

Definition at line 241 of file yodamerge_tmp.py.

◆ default

yodamerge_tmp.default

Definition at line 106 of file yodamerge_tmp.py.

◆ dest

yodamerge_tmp.dest

Definition at line 106 of file yodamerge_tmp.py.

◆ dim

yodamerge_tmp.dim = ao_out.dim()

Definition at line 239 of file yodamerge_tmp.py.

◆ em_i

dict yodamerge_tmp.em_i = {}

Definition at line 254 of file yodamerge_tmp.py.

◆ ep_i

dict yodamerge_tmp.ep_i = {}

Definition at line 253 of file yodamerge_tmp.py.

◆ False

yodamerge_tmp.False

Definition at line 116 of file yodamerge_tmp.py.

◆ filename

yodamerge_tmp.filename

Definition at line 138 of file yodamerge_tmp.py.

◆ help

yodamerge_tmp.help

Definition at line 105 of file yodamerge_tmp.py.

◆ metavar

yodamerge_tmp.metavar

Definition at line 106 of file yodamerge_tmp.py.

◆ msg

str yodamerge_tmp.msg = "WARNING: cannot merge mismatched analysis object types for path %s: " % p

Definition at line 158 of file yodamerge_tmp.py.

◆ nargs

yodamerge_tmp.nargs

Definition at line 105 of file yodamerge_tmp.py.

◆ npoints

yodamerge_tmp.npoints = len(ao_out.points())

Definition at line 250 of file yodamerge_tmp.py.

◆ parser

yodamerge_tmp.parser = argparse.ArgumentParser(usage=__doc__)

Definition at line 104 of file yodamerge_tmp.py.

◆ rescale

float yodamerge_tmp.rescale = None

Definition at line 198 of file yodamerge_tmp.py.

◆ S1D_MODE

yodamerge_tmp.S1D_MODE

Definition at line 131 of file yodamerge_tmp.py.

◆ S2D_MODE

yodamerge_tmp.S2D_MODE

Definition at line 132 of file yodamerge_tmp.py.

◆ S3D_MODE

yodamerge_tmp.S3D_MODE

Definition at line 133 of file yodamerge_tmp.py.

◆ sao

yodamerge_tmp.sao = ao.mkScatter()

Definition at line 163 of file yodamerge_tmp.py.

◆ saos

list yodamerge_tmp.saos = []

Definition at line 161 of file yodamerge_tmp.py.

◆ saotype

yodamerge_tmp.saotype = type(saos[0])

Definition at line 166 of file yodamerge_tmp.py.

◆ scale

yodamerge_tmp.scale = float(scale)

Definition at line 138 of file yodamerge_tmp.py.

◆ scatter_fail

bool yodamerge_tmp.scatter_fail = False

Definition at line 159 of file yodamerge_tmp.py.

◆ SND_MODE

yodamerge_tmp.SND_MODE = getattr(args, "S%dD_MODE" % dim)

Definition at line 240 of file yodamerge_tmp.py.

◆ True

yodamerge_tmp.True

Definition at line 118 of file yodamerge_tmp.py.

◆ val_i

float yodamerge_tmp.val_i = 0.0

Definition at line 252 of file yodamerge_tmp.py.

◆ variations

yodamerge_tmp.variations = ao.variations()

Definition at line 257 of file yodamerge_tmp.py.