def gp_rdiff(version, nomed, noxerr, diffRel, divdNdy):
inDir, outDir = getWorkDirs()<EOL>inDir = os.path.join(inDir, version)<EOL>data, cocktail, medium, rhofo, vacrho =OrderedDict(), OrderedDict(), OrderedDict(), OrderedDict(), OrderedDict()<EOL>scale = {<EOL>'<STR_LIT>': <NUM_LIT>, '<STR_LIT>': <NUM_LIT>,<EOL>'<STR_LIT>': <NUM_LIT>, '<STR_LIT>': <NUM_LIT>,<EOL>'<STR_LIT>': <NUM_LIT><EOL>}<EOL>yunit = <NUM_LIT> if not diffRel else <NUM_LIT:1.><EOL>for infile in os.listdir(inDir):<EOL><INDENT>if infile == "<STR_LIT>": continue<EOL>energy = re.compile('<STR_LIT>').search(infile).group()<EOL>data_type = re.sub('<STR_LIT>' % energy, '<STR_LIT>', infile)<EOL>energy = getEnergy4Key(energy)<EOL>file_url = os.path.join(inDir, infile)<EOL>data_import = np.loadtxt(open(file_url, '<STR_LIT:rb>'))<EOL>if data_type != '<STR_LIT:data>' and (<EOL>(version == '<STR_LIT>' and energy != '<STR_LIT>') or version == '<STR_LIT>'<EOL>):<EOL><INDENT>data_import[:,(<NUM_LIT:1>,<NUM_LIT:3>,<NUM_LIT:4>)] /= scale[energy]<EOL><DEDENT>if version == '<STR_LIT>':<EOL><INDENT>if data_type == '<STR_LIT:data>':<EOL><INDENT>data_import = data_import[(data_import[:,<NUM_LIT:0>] > <NUM_LIT>) & (data_import[:,<NUM_LIT:0>] < <NUM_LIT:1.0>)]<EOL><DEDENT>else:<EOL><INDENT>data_import = data_import[data_import[:,<NUM_LIT:0>] < <NUM_LIT:1.0>]<EOL><DEDENT><DEDENT>if data_type == '<STR_LIT:data>': data[energy] = data_import<EOL>elif data_type == '<STR_LIT>': cocktail[energy] = data_import<EOL>elif data_type == '<STR_LIT>' or data_type == '<STR_LIT>' or data_type == '<STR_LIT>':<EOL><INDENT>if noxerr and not diffRel: data_import[:,<NUM_LIT:2>:] = <NUM_LIT:0.><EOL>data_import[:,<NUM_LIT:1>] /= yunit<EOL>if data_type == '<STR_LIT>':<EOL><INDENT>mask = data_import[:,<NUM_LIT:1>] > <NUM_LIT:0.1><EOL>rhofo[energy] = data_import if diffRel else data_import[mask]<EOL><DEDENT>elif data_type == '<STR_LIT>':<EOL><INDENT>mask = (data_import[:,<NUM_LIT:0>] > <NUM_LIT>) & (data_import[:,<NUM_LIT:1>] > <NUM_LIT>)<EOL>vacrho[energy] = data_import if diffRel else data_import[mask]<EOL><DEDENT>elif not nomed and data_type == '<STR_LIT>':<EOL><INDENT>medium[energy] = data_import<EOL><DEDENT><DEDENT><DEDENT>nSetsData = len(data)<EOL>shift = { '<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>'<EOL>} if not diffRel else {<EOL>'<STR_LIT>': '<STR_LIT:1>', '<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>'<EOL>}<EOL>dataOrdered = OrderedDict()<EOL>for energy in sorted(data, key=float, reverse=True):<EOL><INDENT>uData = getUArray(data[energy])<EOL>eData = getEdges(data[energy])<EOL>uCocktail = getUArray(cocktail[energy])<EOL>eCocktail = getEdges(cocktail[energy])<EOL>loop = [eData]<EOL>if energy in medium and diffRel:<EOL><INDENT>uMedium = getUArray(medium[energy])<EOL>eMedium = getEdges(medium[energy])<EOL>loop.append(eMedium)<EOL><DEDENT>if energy in rhofo and diffRel:<EOL><INDENT>uRho = getUArray(rhofo[energy])<EOL>eRho = getEdges(rhofo[energy])<EOL>loop.append(eRho)<EOL><DEDENT>if energy in vacrho and diffRel:<EOL><INDENT>uVacRho = getUArray(vacrho[energy])<EOL>eVacRho = getEdges(vacrho[energy])<EOL>loop.append(eVacRho)<EOL><DEDENT>for l, eArr in enumerate(loop):<EOL><INDENT>for i, (e0, e1) in enumzipEdges(eArr):<EOL><INDENT>logging.debug('<STR_LIT>' % (energy, l, e0, e1))<EOL>uCocktailSum = getCocktailSum(e0, e1, eCocktail, uCocktail)<EOL>if uCocktailSum == <NUM_LIT:0.>: continue<EOL>if l == <NUM_LIT:0>:<EOL><INDENT>uDiff = uData[i] <EOL>if diffRel:<EOL><INDENT>uDiff /= uCocktailSum <EOL><DEDENT>else:<EOL><INDENT>uDiff -= uCocktailSum<EOL>uDiff /= data[energy][i,<NUM_LIT:2>] * <NUM_LIT:2> * yunit<EOL><DEDENT>dp = [<EOL>data[energy][i,<NUM_LIT:0>], uDiff.nominal_value,<EOL>data[energy][i,<NUM_LIT:2>] if not noxerr else <NUM_LIT:0.>,<EOL>getErrorComponent(uDiff, '<STR_LIT>'),<EOL>getErrorComponent(uDiff, '<STR_LIT>')<EOL>]<EOL>key = '<STR_LIT:U+0020>'.join([energy, '<STR_LIT>'])<EOL>if noxerr:<EOL><INDENT>if diffRel:<EOL><INDENT>key += '<STR_LIT>' % shift[energy]<EOL><DEDENT>else:<EOL><INDENT>expon = shift[energy].split('<STR_LIT:e>')[<NUM_LIT:1>]<EOL>key += '<STR_LIT>' % expon<EOL><DEDENT><DEDENT><DEDENT>elif l == <NUM_LIT:1>:<EOL><INDENT>uDiff = uMedium[i]<EOL>uDiff /= uCocktailSum<EOL>dp = [<EOL>medium[energy][i,<NUM_LIT:0>], uDiff.nominal_value+<NUM_LIT:1>,<EOL>medium[energy][i,<NUM_LIT:2>] if not noxerr else <NUM_LIT:0.>,<EOL><NUM_LIT:0.>, <NUM_LIT:0.> <EOL>]<EOL>key = '<STR_LIT:U+0020>'.join([energy, '<STR_LIT>'])<EOL><DEDENT>elif l == <NUM_LIT:2>:<EOL><INDENT>uDiff = uRho[i]<EOL>uDiff /= uCocktailSum<EOL>dp = [<EOL>rhofo[energy][i,<NUM_LIT:0>], uDiff.nominal_value+<NUM_LIT:1.>,<EOL>rhofo[energy][i,<NUM_LIT:2>] if not noxerr else <NUM_LIT:0.>,<EOL><NUM_LIT:0.>, <NUM_LIT:0.> <EOL>]<EOL>key = '<STR_LIT:U+0020>'.join([energy, '<STR_LIT>'])<EOL><DEDENT>elif l == <NUM_LIT:3>:<EOL><INDENT>uDiff = uVacRho[i]<EOL>uDiff /= uCocktailSum<EOL>dp = [<EOL>vacrho[energy][i,<NUM_LIT:0>], uDiff.nominal_value+<NUM_LIT:1.>,<EOL>vacrho[energy][i,<NUM_LIT:2>] if not noxerr else <NUM_LIT:0.>,<EOL><NUM_LIT:0.>, <NUM_LIT:0.> <EOL>]<EOL>key = '<STR_LIT:U+0020>'.join([energy, '<STR_LIT>'])<EOL><DEDENT>if diffRel or l == <NUM_LIT:0>:<EOL><INDENT>if dp[<NUM_LIT:0>] > <NUM_LIT> and dp[<NUM_LIT:0>] < <NUM_LIT>: continue <EOL>if dp[<NUM_LIT:0>] > <NUM_LIT> and dp[<NUM_LIT:0>] < <NUM_LIT>: continue <EOL><DEDENT>if key in dataOrdered:<EOL><INDENT>dataOrdered[key] = np.vstack([dataOrdered[key], dp])<EOL><DEDENT>else:<EOL><INDENT>dataOrdered[key] = np.array([ dp ])<EOL><DEDENT><DEDENT><DEDENT>if not diffRel:<EOL><INDENT>if energy in medium:<EOL><INDENT>dataOrdered['<STR_LIT:U+0020>'.join([energy, '<STR_LIT>'])] = medium[energy]<EOL><DEDENT>if energy in rhofo:<EOL><INDENT>dataOrdered['<STR_LIT:U+0020>'.join([energy, '<STR_LIT>'])] = rhofo[energy]<EOL><DEDENT>if energy in vacrho:<EOL><INDENT>dataOrdered['<STR_LIT:U+0020>'.join([energy, '<STR_LIT>'])] = vacrho[energy]<EOL><DEDENT><DEDENT><DEDENT>nSets = len(dataOrdered)<EOL>nCats = <NUM_LIT:4><EOL>nSetsPlot = nSets/nCats if nSets > nSetsData else nSets<EOL>props = [<EOL>'<STR_LIT>' % default_colors[i]<EOL>for i in reversed(list(range(nSetsPlot)))<EOL>]<EOL>titles = list(dataOrdered.keys())<EOL>if nSets > nSetsData:<EOL><INDENT>props = zip_flat(props, *[<EOL>[<EOL>'<STR_LIT>' % (j+<NUM_LIT:1>, default_colors[i])<EOL>for i in reversed(list(range(nSetsPlot)))<EOL>]<EOL>for j in range(nCats-<NUM_LIT:1>)<EOL>])<EOL>titles = zip_flat(list(dataOrdered.keys())[::nCats], *[ ['<STR_LIT>'] * nSetsPlot for j in range(nCats-<NUM_LIT:1>) ])<EOL><DEDENT>global labels<EOL>labels = {<EOL>'<STR_LIT>' if version == '<STR_LIT>' orversion == '<STR_LIT>' or version == '<STR_LIT>'<EOL>else '<STR_LIT>': [<EOL><NUM_LIT> if diffRel else <NUM_LIT>,<NUM_LIT> if not diffRel and noxerr else <NUM_LIT>,False<EOL>],<EOL>'<STR_LIT>' if version == '<STR_LIT>'or version == '<STR_LIT>' or version == '<STR_LIT>'<EOL>else '<STR_LIT>': [<NUM_LIT> if diffRel else <NUM_LIT>,<NUM_LIT> if not diffRel and noxerr else <NUM_LIT>,False],<EOL>}<EOL>yr = [<NUM_LIT>,<NUM_LIT>] if diffRel else [<NUM_LIT>,<NUM_LIT>]<EOL>if noxerr:<EOL><INDENT>for k,d in dataOrdered.items():<EOL><INDENT>energy = getEnergy4Key(re.compile('<STR_LIT>').search(k).group())<EOL>d[:,(<NUM_LIT:1>,<NUM_LIT:3>,<NUM_LIT:4>)] *= float(shift[energy])<EOL><DEDENT><DEDENT>gpcalls = [<EOL>'<STR_LIT>' %(<NUM_LIT> if diffRel else <NUM_LIT:0.5>, yr[<NUM_LIT:1>]),<EOL>'<STR_LIT>' %(<NUM_LIT> if diffRel else <NUM_LIT:0.5>, yr[<NUM_LIT:1>]),<EOL>'<STR_LIT>' %(<NUM_LIT> if diffRel else <NUM_LIT:0.5>, yr[<NUM_LIT:1>]),<EOL>'<STR_LIT>',<EOL>]<EOL>hline = <NUM_LIT:1.> if diffRel else <NUM_LIT><EOL>lines = dict(<EOL>(('<STR_LIT>' % (hline*float(shift[energy]))), '<STR_LIT>')<EOL>for energy in shift<EOL>)<EOL>pseudo_point = np.array([[-<NUM_LIT:1>,<NUM_LIT:1>,<NUM_LIT:0>,<NUM_LIT:0>,<NUM_LIT:0>]])<EOL>make_plot(<EOL>data = list(dataOrdered.values()) + [<EOL>pseudo_point, pseudo_point, pseudo_point, pseudo_point<EOL>],<EOL>properties = props + [<EOL>'<STR_LIT>' % (lt+<NUM_LIT:1>)<EOL>for lt in range(nCats)<EOL>],<EOL>titles = titles + [<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', <EOL>],<EOL>name = os.path.join(outDir, '<STR_LIT>' % (<EOL>'<STR_LIT>' if diffRel else '<STR_LIT>', version,<EOL>'<STR_LIT>' if nomed else '<STR_LIT>', '<STR_LIT>' if noxerr else '<STR_LIT>'<EOL>)),<EOL>xlabel = '<STR_LIT>',<EOL>ylabel = '<STR_LIT>' if diffRel else '<STR_LIT>',<EOL>xr = [<NUM_LIT>,<NUM_LIT>], yr = yr, ylog = True,<EOL>key = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'],<EOL>lines = lines if noxerr else {},<EOL>gpcalls = gpcalls,<EOL>lmargin = <NUM_LIT>, bmargin = <NUM_LIT:0.1>, tmargin = <NUM_LIT>, rmargin = <NUM_LIT>,<EOL>size = '<STR_LIT>', arrow_offset = <NUM_LIT>, <EOL>)<EOL>if nomed or noxerr or version == '<STR_LIT>': return '<STR_LIT>'<EOL>if diffRel:<EOL><INDENT>enhance = {}<EOL>data_enhance, medium_enhance, rhofo_enhance, vacrho_enhance = None, None, None, None<EOL>for energy in sorted(data, key=float):<EOL><INDENT>for systLMR in [False, True]:<EOL><INDENT>suffix = str(energy)<EOL>uEnhanceData = getMassRangesSums(<EOL>data[energy], onlyLMR = True,<EOL>systLMR = systLMR, suffix = suffix<EOL>)<EOL>uEnhanceCocktail = getMassRangesSums(<EOL>cocktail[energy], onlyLMR = True,<EOL>systLMR = systLMR, suffix = suffix<EOL>)<EOL>if energy in medium:<EOL><INDENT>uEnhanceMed = getMassRangesSums(<EOL>medium[energy], onlyLMR = True,<EOL>systLMR = systLMR, suffix = suffix<EOL>)<EOL><DEDENT>if energy in rhofo:<EOL><INDENT>uEnhanceRhoFO = getMassRangesSums(<EOL>rhofo[energy], onlyLMR = True,<EOL>systLMR = systLMR, suffix = suffix<EOL>)<EOL><DEDENT>if energy in vacrho:<EOL><INDENT>uEnhanceVacRho = getMassRangesSums(<EOL>vacrho[energy], onlyLMR = True,<EOL>systLMR = systLMR, suffix = suffix<EOL>)<EOL><DEDENT>if not systLMR: <EOL><INDENT>uEnhanceData /= uEnhanceCocktail<EOL>dp = [<EOL>float(energy), uEnhanceData.nominal_value, <NUM_LIT:0>,<EOL>getErrorComponent(uEnhanceData, '<STR_LIT>'),<EOL>getErrorComponent(uEnhanceData, '<STR_LIT>')<EOL>]<EOL>if data_enhance is None: data_enhance = [ dp ]<EOL>else: data_enhance.append(dp)<EOL>if energy in medium:<EOL><INDENT>uEnhanceMed /= uEnhanceCocktail<EOL>dpM = [ float(energy), uEnhanceMed.nominal_value+<NUM_LIT:1.>, <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0> ]<EOL>if medium_enhance is None: medium_enhance = [ dpM ]<EOL>else: medium_enhance.append(dpM)<EOL><DEDENT>if energy in rhofo:<EOL><INDENT>uEnhanceRhoFO /= uEnhanceCocktail<EOL>dpM = [ float(energy), uEnhanceRhoFO.nominal_value+<NUM_LIT:1.>, <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0> ]<EOL>if rhofo_enhance is None: rhofo_enhance = [ dpM ]<EOL>else: rhofo_enhance.append(dpM)<EOL><DEDENT>if energy in vacrho:<EOL><INDENT>uEnhanceVacRho /= uEnhanceCocktail<EOL>dpM = [ float(energy), uEnhanceVacRho.nominal_value+<NUM_LIT:1.>, <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0> ]<EOL>if vacrho_enhance is None: vacrho_enhance = [ dpM ]<EOL>else: vacrho_enhance.append(dpM)<EOL><DEDENT><DEDENT>else: <EOL><INDENT>for k in uEnhanceData:<EOL><INDENT>uEnhanceData[k] /= uEnhanceCocktail[k]<EOL>dp = [<EOL>float(energy), uEnhanceData[k].nominal_value, <NUM_LIT:0>,<EOL>getErrorComponent(uEnhanceData[k], '<STR_LIT>'),<EOL>getErrorComponent(uEnhanceData[k], '<STR_LIT>')<EOL>]<EOL>rngstr = k.split('<STR_LIT:_>')[-<NUM_LIT:1>]<EOL>data_key = '<STR_LIT>' + rngstr<EOL>if data_key not in enhance: enhance[data_key] = [ dp ]<EOL>else: enhance[data_key].append(dp)<EOL>if k in uEnhanceMed:<EOL><INDENT>uEnhanceMed[k] /= uEnhanceCocktail[k]<EOL>dpM = [ float(energy), uEnhanceMed[k].nominal_value ]<EOL>med_key = '<STR_LIT>' + rngstr<EOL>if med_key not in enhance: enhance[med_key] = [ dpM ]<EOL>else: enhance[med_key].append(dpM)<EOL><DEDENT>if k in uEnhanceRhoFO:<EOL><INDENT>uEnhanceRhoFO[k] /= uEnhanceCocktail[k]<EOL>dpM = [ float(energy), uEnhanceRhoFO[k].nominal_value+<NUM_LIT:1.> ]<EOL>rhofo_key = '<STR_LIT>' + rngstr<EOL>if rhofo_key not in enhance: enhance[rhofo_key] = [ dpM ]<EOL>else: enhance[rhofo_key].append(dpM)<EOL><DEDENT>if k in uEnhanceVacRho:<EOL><INDENT>uEnhanceVacRho[k] /= uEnhanceCocktail[k]<EOL>dpM = [ float(energy), uEnhanceVacRho[k].nominal_value+<NUM_LIT:1.> ]<EOL>vacrho_key = '<STR_LIT>' + rngstr<EOL>if vacrho_key not in enhance: enhance[vacrho_key] = [ dpM ]<EOL>else: enhance[vacrho_key].append(dpM)<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>xfacs = os.path.join(outDir, '<STR_LIT>' % version)<EOL>if os.path.exists(xfacs): os.remove(xfacs)<EOL>fSystLMR = open(xfacs, '<STR_LIT>')<EOL>for k in sorted(enhance.keys()):<EOL><INDENT>np.savetxt(fSystLMR, enhance[k], fmt = '<STR_LIT>', header = k, comments = '<STR_LIT>')<EOL><DEDENT>fSystLMR.close()<EOL>yr_upp = <NUM_LIT:4> if version == '<STR_LIT>' or version == '<STR_LIT>' else <NUM_LIT:7><EOL>if version == '<STR_LIT>': yr_upp = <NUM_LIT><EOL>make_plot(<EOL>data = [<EOL>pseudo_point, pseudo_point, pseudo_point,<EOL>np.array([[<NUM_LIT>,<NUM_LIT>,<NUM_LIT:0>,<NUM_LIT>,<NUM_LIT>]]),<EOL>np.array([[<NUM_LIT:200>,<NUM_LIT>,<NUM_LIT:0>,<NUM_LIT>,<NUM_LIT>]]),<EOL>np.array(enhance['<STR_LIT>']),<EOL>np.array(enhance['<STR_LIT>']),<EOL>np.array(medium_enhance),<EOL>np.array(rhofo_enhance), np.array(vacrho_enhance)<EOL>],<EOL>properties = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>' % default_colors[<NUM_LIT:1>],<EOL>'<STR_LIT>' % default_colors[<NUM_LIT:3>],<EOL>'<STR_LIT>' % default_colors[<NUM_LIT:4>],<EOL>'<STR_LIT>' % default_colors[<NUM_LIT:0>],<EOL>'<STR_LIT>' % default_colors[-<NUM_LIT:1>],<EOL>'<STR_LIT>' % default_colors[-<NUM_LIT:1>],<EOL>'<STR_LIT>' % default_colors[-<NUM_LIT:1>],<EOL>],<EOL>titles = [<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>],<EOL>name = os.path.join(outDir, '<STR_LIT>' % version),<EOL>xlabel = '<STR_LIT>',<EOL>ylabel = '<STR_LIT>',<EOL>xlog = True, key = [ '<STR_LIT>', '<STR_LIT>', '<STR_LIT>' ],<EOL>size = '<STR_LIT>', bmargin = <NUM_LIT>, tmargin = <NUM_LIT>, rmargin = <NUM_LIT>,<EOL>yr = [<NUM_LIT:1.>,yr_upp], xr = [<NUM_LIT>,<NUM_LIT>], gpcalls = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>' % default_colors[<NUM_LIT:1>],<EOL>'<STR_LIT>' % default_colors[<NUM_LIT:3>],<EOL>'<STR_LIT>' % default_colors[<NUM_LIT:0>],<EOL>'<STR_LIT>' % default_colors[<NUM_LIT:4>]<EOL>], <EOL>)<EOL>return '<STR_LIT>'<EOL><DEDENT>excess = {}<EOL>for k, v in dataOrdered.items():<EOL><INDENT>suffix = '<STR_LIT>'<EOL>energy = getEnergy4Key(re.compile('<STR_LIT>').search(k).group())<EOL>if fnmatch(k, '<STR_LIT>'):<EOL><INDENT>suffix = '<STR_LIT>'<EOL>if version != '<STR_LIT>' and energy == '<STR_LIT>': continue <EOL><DEDENT>if fnmatch(k, '<STR_LIT>'): suffix = '<STR_LIT>'<EOL>if fnmatch(k, '<STR_LIT>'): suffix = '<STR_LIT>'<EOL>exc = getMassRangesSums(np.array(v), onlyLMR = True)<EOL>if divdNdy: exc /= dNdyPi0[energy] * <NUM_LIT><EOL>dp = [<EOL>float(energy), exc.nominal_value, <NUM_LIT:0>,<EOL>getErrorComponent(exc, '<STR_LIT>'), getErrorComponent(exc, '<STR_LIT>')<EOL>]<EOL>if suffix == '<STR_LIT>' and not diffRel and not divdNdy:<EOL><INDENT>print(dp)<EOL><DEDENT>key = '<STR_LIT>' + suffix<EOL>if key not in excess: excess[key] = [ dp ]<EOL>else: excess[key].append(dp)<EOL><DEDENT>logging.debug(excess)<EOL>avdata = np.array(excess['<STR_LIT>'])<EOL>avg = np.average(avdata[:,<NUM_LIT:1>], weights = avdata[:,<NUM_LIT:3>])<EOL>graph_data = [<EOL>np.array([<EOL>[ <NUM_LIT>, avg, <NUM_LIT:0>, <NUM_LIT:0>, avdata[-<NUM_LIT:1>][-<NUM_LIT:1>]],<EOL>[ <NUM_LIT>, avg, <NUM_LIT:0>, <NUM_LIT:0>, avdata[-<NUM_LIT:1>][-<NUM_LIT:1>]]<EOL>]),<EOL>np.array([<EOL>[ <NUM_LIT>, avg, <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>], [ <NUM_LIT>, avg, <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>]<EOL>]),<EOL>np.array([<EOL>[ <NUM_LIT>, <NUM_LIT:2>*avg, <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>], [ <NUM_LIT>, avg, <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>],<EOL>]),<EOL>np.array(excess['<STR_LIT>']),<EOL>]<EOL>props = [<EOL>'<STR_LIT>' % default_colors[<NUM_LIT:8>],<EOL>'<STR_LIT>' % default_colors[<NUM_LIT:8>],<EOL>'<STR_LIT>' % default_colors[<NUM_LIT:1>],<EOL>'<STR_LIT>' % default_colors[<NUM_LIT:0>],<EOL>]<EOL>tits = [<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>]<EOL>if version != '<STR_LIT>':<EOL><INDENT>graph_data += [<EOL>np.array(excess['<STR_LIT>']),<EOL>np.array(excess['<STR_LIT>']),<EOL>np.array(excess['<STR_LIT>']),<EOL>]<EOL>props += [<EOL>'<STR_LIT>' % default_colors[-<NUM_LIT:1>],<EOL>'<STR_LIT>' % default_colors[-<NUM_LIT:1>],<EOL>'<STR_LIT>' % default_colors[-<NUM_LIT:1>],<EOL>]<EOL>tits += [<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>]<EOL><DEDENT>yr_upp = <NUM_LIT> if version == '<STR_LIT>' or version == '<STR_LIT>' else <NUM_LIT:7><EOL>if version == '<STR_LIT>': yr_upp = <NUM_LIT:2> if divdNdy else <NUM_LIT><EOL>labels = {} if version != '<STR_LIT>' else labels<EOL>if divdNdy:<EOL><INDENT>labels.update(dict((str(v), [float(k)*<NUM_LIT>,yr_upp*<NUM_LIT>,True]) for k,v in list(dNdyPi0.items())))<EOL>labels.update({ '<STR_LIT>': [<NUM_LIT:100>,yr_upp*<NUM_LIT>,True]})<EOL><DEDENT>gpcalls = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>]<EOL>if version == '<STR_LIT>':<EOL><INDENT>labels.update({<EOL>'<STR_LIT>' % (eRanges[<NUM_LIT:1>], eRanges[<NUM_LIT:2>]): [<NUM_LIT>,<NUM_LIT>,False],<EOL>})<EOL><DEDENT>else:<EOL><INDENT>gpcalls.append('<STR_LIT>' % default_colors[<NUM_LIT:0>])<EOL><DEDENT>make_plot(<EOL>data = graph_data, properties = props, titles = tits,<EOL>name = os.path.join(outDir, '<STR_LIT>' % (version,'<STR_LIT>' if divdNdy else '<STR_LIT>')),<EOL>xlabel = '<STR_LIT>',<EOL>ylabel = '<STR_LIT>' % (<EOL>'<STR_LIT>' if divdNdy else '<STR_LIT>', <NUM_LIT:5> if divdNdy else <NUM_LIT:3><EOL>),<EOL>xlog = True, xr = [<NUM_LIT:7>,<NUM_LIT>], size = '<STR_LIT>',<EOL>key = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'],<EOL>bmargin = <NUM_LIT>, tmargin = <NUM_LIT>, rmargin = <NUM_LIT>,<EOL>yr = [<NUM_LIT:0>,yr_upp], gpcalls = gpcalls, labels = labels,<EOL>)<EOL>return '<STR_LIT>'<EOL>
example for ratio or difference plots using QM12 data (see gp_panel)

    - uses uncertainties package for easier error propagation and rebinning
    - stat. error for medium = 0!
    - stat. error for cocktail ~ 0!
    - statistical error bar on data stays the same for diff
    - TODO: implement ratio!
    - TODO: adjust statistical error on data for ratio!
    - TODO: adjust name and ylabel for ratio

    .. image:: pics/diffAbsQM12.png
       :width: 450 px

    :param version: plot version
    :type version: str
    :param nomed: don't plot medium
    :type nomed: bool
    :param noxerr: don't plot x-errors
    :type noxerr: bool