def gp_background():
inDir, outDir = getWorkDirs()<EOL>data, REBIN = OrderedDict(), None<EOL>titles = [ '<STR_LIT>', '<STR_LIT>', '<STR_LIT>' ]<EOL>Apm = OrderedDict([<EOL>('<STR_LIT>', <NUM_LIT>), ('<STR_LIT>', <NUM_LIT>), ('<STR_LIT>', <NUM_LIT>), ('<STR_LIT>', <NUM_LIT>)<EOL>])<EOL>fake = np.array([[-<NUM_LIT:1>, <NUM_LIT:1>, <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>]])<EOL>lines = {'<STR_LIT>': '<STR_LIT>'.format(default_colors[-<NUM_LIT:4>])}<EOL>for energy in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>ekey = '<STR_LIT:U+0020>'.join([getEnergy4Key(energy), '<STR_LIT>'])<EOL>data[ekey] = [[], [], []]<EOL>for didx,dtype in enumerate(['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']):<EOL><INDENT>for idx,infile in enumerate(glob.glob(os.path.realpath(os.path.join(<EOL>inDir, '<STR_LIT>', energy, '<STR_LIT>', '<STR_LIT>' % dtype<EOL>)))):<EOL><INDENT>file_url = os.path.realpath(os.path.join(inDir, infile))<EOL>data_import = np.loadtxt(open(file_url, '<STR_LIT:rb>'))<EOL>if REBIN is None: REBIN = int(data_import[-<NUM_LIT:1>][<NUM_LIT:2>]*<NUM_LIT:2>*<NUM_LIT:1000>) <EOL>data_import[:,<NUM_LIT:4>] = data_import[:,<NUM_LIT:3>]<EOL>data_import[:,(<NUM_LIT:2>,<NUM_LIT:3>)] = <NUM_LIT:0><EOL>if dtype == '<STR_LIT>':<EOL><INDENT>data_import = data_import[data_import[:,<NUM_LIT:0>] <= <NUM_LIT>]<EOL><DEDENT>if dtype == '<STR_LIT>':<EOL><INDENT>data_import = data_import[data_import[:,<NUM_LIT:0>] > <NUM_LIT>]<EOL>data_import[:,(<NUM_LIT:1>,<NUM_LIT:4>)] *= Apm[energy]<EOL><DEDENT>col = colorscale(default_colors[didx], <NUM_LIT:1.>+idx*<NUM_LIT>)<EOL>momrange =  os.path.basename(infile).split('<STR_LIT:_>')[-<NUM_LIT:1>][:-<NUM_LIT:4>]<EOL>if idx < <NUM_LIT:1>:<EOL><INDENT>data[ekey][<NUM_LIT:0>].append(fake)<EOL>data[ekey][<NUM_LIT:1>].append('<STR_LIT>' % col)<EOL>data[ekey][<NUM_LIT:2>].append(titles[didx])<EOL><DEDENT>data[ekey][<NUM_LIT:0>].append(data_import)<EOL>data[ekey][<NUM_LIT:1>].append('<STR_LIT>' % col)<EOL>data[ekey][<NUM_LIT:2>].append('<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT>make_panel(<EOL>name = '<STR_LIT>' % outDir, dpt_dict = data,<EOL>xr = [<NUM_LIT:0>,<NUM_LIT>], yr = [<NUM_LIT>,<NUM_LIT>], ylog = True, lines = lines,<EOL>xlabel = '<STR_LIT>',<EOL>ylabel = '<STR_LIT>' % REBIN, layout = '<STR_LIT>',<EOL>key = ['<STR_LIT>', '<STR_LIT>'], gpcalls = ['<STR_LIT>'],<EOL>labels = {<EOL>'<STR_LIT>': (<NUM_LIT>, <NUM_LIT>)<EOL>}, key_subplot_id = <NUM_LIT:1>,<EOL>)<EOL>return '<STR_LIT>'<EOL>make_plot(<EOL>name = '<STR_LIT>' % (outDir, energy),<EOL>xr = [<NUM_LIT:0>,<NUM_LIT>], yr = [<NUM_LIT>,<NUM_LIT>],<EOL>data = graph_data[<NUM_LIT:3>:],<EOL>properties = [<EOL>'<STR_LIT>' % default_colors[i]<EOL>for i in xrange(<NUM_LIT:2>)<EOL>],<EOL>titles = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'<EOL>],<EOL>xlabel = '<STR_LIT>',<EOL>ylabel = '<STR_LIT>', key = [ '<STR_LIT>' ],<EOL>labels = { '<STR_LIT>' % energy: (<NUM_LIT>, <NUM_LIT>) }<EOL>)<EOL>graph_data_sn = []<EOL>for infile in os.listdir(os.path.join(inDir, '<STR_LIT>')):<EOL><INDENT>energy = re.compile('<STR_LIT>').search(infile).group()<EOL>file_url = os.path.join(inDir, '<STR_LIT>', infile)<EOL>data_import = np.loadtxt(open(file_url, '<STR_LIT:rb>'))<EOL>mask = (data_import[:,<NUM_LIT:0>] > <NUM_LIT>) & (data_import[:,<NUM_LIT:0>] < <NUM_LIT>)<EOL>data_import = data_import[mask]<EOL>weights = <NUM_LIT:1.>/data_import[:,<NUM_LIT:3>]<EOL>sn = np.average(data_import[:,<NUM_LIT:1>], weights = weights)<EOL>sn_err = np.average((data_import[:,<NUM_LIT:1>]-sn)**<NUM_LIT:2>, weights = weights)<EOL>graph_data_sn.append([float(getEnergy4Key(energy)), sn, <NUM_LIT:0>, sn_err, <NUM_LIT:0>])<EOL><DEDENT>graph_data_sn = np.array(graph_data_sn)<EOL>make_plot(<EOL>name = '<STR_LIT>' % (outDir), xr = [<NUM_LIT:15>,<NUM_LIT>],<EOL>yr = [<NUM_LIT>, <NUM_LIT>], xlog = True, ylog = True,<EOL>data = [ np.array([[<NUM_LIT:15>,<NUM_LIT:0.1>,<NUM_LIT:0>,<NUM_LIT:0>,<NUM_LIT:0>],[<NUM_LIT>,<NUM_LIT:0.1>,<NUM_LIT:0>,<NUM_LIT:0>,<NUM_LIT:0>]]), graph_data_sn ],<EOL>properties = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>' % default_colors[<NUM_LIT:0>]<EOL>],<EOL>titles = ['<STR_LIT>']*<NUM_LIT:2>,<EOL>xlabel = '<STR_LIT>',<EOL>ylabel = '<STR_LIT>',<EOL>lmargin = <NUM_LIT:0.1>, gpcalls = [<EOL>'<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>',<EOL>],<EOL>labels = { '<STR_LIT>': (<NUM_LIT:100>, <NUM_LIT>) }<EOL>)<EOL>return '<STR_LIT>'<EOL>
plot background methods and S/B vs energy