Exemplo n.º 1
0
def monitor_variable(df, path, file, variable):
    run_ranges = pt.read_run_range(path=path,file=file)

    run_ranges[variable + '_mean'] = np.zeros(run_ranges.shape[0])
    run_ranges[variable + '_std' ] = np.zeros(run_ranges.shape[0])
    run_ranges[variable + '_peak'] = np.zeros(run_ranges.shape[0])
    run_ranges[variable + '_nevt'] = np.zeros(run_ranges.shape[0])
    for index, row in run_ranges.iterrows():
        _data_ = df[np.logical_and(df['runNumber']>=row.run_min, df['runNumber']<=row.run_max)]['nPV']
        run_ranges[variable + '_mean'][index] = _data_.mean()
        run_ranges[variable + '_std' ][index] = _data_.std()
        run_ranges[variable + '_nevt'][index] = _data_.size
        # find a maximum
        bins,hist = np.histogram(_data_,n)

        print run_ranges['run_number'][index], ' -- ', run_ranges['nPV_mean'][index]

    run_ranges[variable + '_sem'  ] = run_ranges[variable + '_mean']/np.sqrt()
    run_ranges[variable + '_stde' ] = run_ranges[variable + '_std' ]/np.sqrt()

    run_ranges['bin']       = range(0,run_ranges.shape[0])
    run_ranges['bin_error'] = 0.5 * np.ones(run_ranges.shape[0])

    for k, spine in ax.spines.items():
        spine.set_zorder(10)
    ax.grid(which='major', color='0.7' , linestyle='--',dashes=(5,1),zorder=0)
    ax.grid(which='minor', color='0.85', linestyle='--',dashes=(5,1),zorder=0)

    ax.errorbar(run_ranges['bin'],run_ranges['nPV_mean'],
             yerr=run_ranges['_sem'  ],
             xerr=run_ranges['_error'],
             capthick=0,marker='o',ms=4,ls='None', zorder=10)
    plt.ylim([0,60])
    plt.savefig('test.pdf')
Exemplo n.º 2
0
def monitor_variable(df, path, file, variable):
    run_ranges = pt.read_run_range(path=path, file=file)

    run_ranges[variable + '_mean'] = np.zeros(run_ranges.shape[0])
    run_ranges[variable + '_std'] = np.zeros(run_ranges.shape[0])
    run_ranges[variable + '_peak'] = np.zeros(run_ranges.shape[0])
    run_ranges[variable + '_nevt'] = np.zeros(run_ranges.shape[0])
    for index, row in run_ranges.iterrows():
        _data_ = df[np.logical_and(df['runNumber'] >= row.run_min,
                                   df['runNumber'] <= row.run_max)]['nPV']
        run_ranges[variable + '_mean'][index] = _data_.mean()
        run_ranges[variable + '_std'][index] = _data_.std()
        run_ranges[variable + '_nevt'][index] = _data_.size
        # find a maximum
        bins, hist = np.histogram(_data_, n)

        print run_ranges['run_number'][index], ' -- ', run_ranges['nPV_mean'][
            index]

    run_ranges[variable + '_sem'] = run_ranges[variable + '_mean'] / np.sqrt()
    run_ranges[variable + '_stde'] = run_ranges[variable + '_std'] / np.sqrt()

    run_ranges['bin'] = range(0, run_ranges.shape[0])
    run_ranges['bin_error'] = 0.5 * np.ones(run_ranges.shape[0])

    for k, spine in ax.spines.items():
        spine.set_zorder(10)
    ax.grid(which='major',
            color='0.7',
            linestyle='--',
            dashes=(5, 1),
            zorder=0)
    ax.grid(which='minor',
            color='0.85',
            linestyle='--',
            dashes=(5, 1),
            zorder=0)

    ax.errorbar(run_ranges['bin'],
                run_ranges['nPV_mean'],
                yerr=run_ranges['_sem'],
                xerr=run_ranges['_error'],
                capthick=0,
                marker='o',
                ms=4,
                ls='None',
                zorder=10)
    plt.ylim([0, 60])
    plt.savefig('test.pdf')
Exemplo n.º 3
0
    os.makedirs(plot_path)

print "Starting plotmaking..."
for category in pt.ecal_regions:

    print "Beginning category ", category,
    if "gold" in category:
        print " ...skipping: gold"
        continue
    if "bad" in category:
        print " ...skipping: bad"
        continue
    print

    #Get runrange and time info from the the runranges file
    d = pt.read_run_range(path=data_path, file=runRangeFile)
    #Get variables information from the stability monitoring .tex file
    d = pt.append_variables(path=data_path,
                            file=stabilityFile,
                            data=d,
                            category=category)

    #Get variables to make plots of (data, not mc or err vars)
    variables = []
    timeVars = [
        'Nevents', 'UnixTime', 'run_number', 'UnixTime_min', 'UnixTime_max',
        'run_min', 'run_max', 'date_min', 'date_max', 'time'
    ]
    for label in d.columns.values.tolist():
        if "MC" not in label and label not in timeVars and "_err" not in label:
            variables.append(label)
Exemplo n.º 4
0
import IsolateClone
import ParseTable 
import ClusterClone
import translator
import AnnotateProtein
import WriteFast
import ReadIgBlastn
parser= argparse.ArgumentParser(prog='cat all.xls files',description="python PostAnalysis.py -d path -s species -c chain",epilog='')
parser.add_argument ('-d','--directory',help='input file directory',default='/home/zhaiqi1/NGS/mycode/Ab_NGS_4/test/results',action='store')
parser.add_argument('-s', '--species', help='mouse, rabbit or human', default="mouse")
parser.add_argument('-c', '--chain', help="folder", default="H")

args=parser.parse_args()

############### read the table from the Fastq2fastA################
raw_AbDict,count_seq=ParseTable.ParseTable(args.directory)
print "There are total %s sequences in the table." % str(count_seq)
print "Total number of sequences meets the keywords requirement\t:%s\n" %  str(len(raw_AbDict)) 

Outfile_summary=open(os.path.join(args.directory,"Summary.txt"),'w')

Outfile_summary.write("Total number of sequences meets the keywords requirement\t:%s\n" %  str(len(raw_AbDict)))
#print raw_AbDict
############################## cluster the clone based on the keywords_3, and then correct the pcr error ########
keywords_3=['CDR3-PRO','RID','DNAlen']
groupDict = IsolateClone.identifyClone(raw_AbDict,keywords_3)
Outfile_keywords3=os.path.join(args.directory,"uniqueclone.txt")
IsolateClone.writeCount(groupDict,Outfile_keywords3,keywords_3)  #this output has not been corrected

Outfile_summary.write("There are  DNA sequences by same CDR3-DNA, GERMLINE-V, RID, DNAlen : %s \n " % str(len(groupDict)))
print ("There are  DNA sequences by same CDR3-DNA, GERMLINE-V, RID, DNAlen : %s \n" % str(len(groupDict)))
Exemplo n.º 5
0
    os.makedirs(plot_path)

print "Starting plotmaking..."
for category in pt.ecal_regions:

    print "Beginning category ", category,
    if "gold" in category: 
        print " ...skipping: gold"
        continue
    if "bad"  in category: 
        print " ...skipping: bad"
        continue
    print

    #Get runrange and time info from the the runranges file
    d = pt.read_run_range(path=data_path,file=runRangeFile)
    #Get variables information from the stability monitoring .tex file
    d = pt.append_variables(path=data_path,file=stabilityFile,data=d,category=category)

    #Get variables to make plots of (data, not mc or err vars)
    variables = []
    timeVars = ['Nevents', 'UnixTime', 'run_number', 'UnixTime_min', 'UnixTime_max', 'run_min', 'run_max', 'date_min', 'date_max', 'time']
    for label in d.columns.values.tolist():
        if "MC" not in label and label not in timeVars and "_err" not in label:
            variables.append(label)

    #Loop over the vars
    for var in variables:

        #Get associated monte carlo info, or a placeholder
        varmc = var.replace("data","MC")
Exemplo n.º 6
0
    formatter = ticker.FormatStrFormatter('%d')
    ax.xaxis.set_major_formatter(formatter)
    plot(warmpix['year'], np.array(warmpix[thresh]) / npix)
    xlim(2000, 2020)
    ylim(-0.005, 0.251)
    xlabel('Year')
    ylabel('Fraction')
    title('Warm pixel fraction (Nominal and Worst)')
    draw()
    # savefig(thresh + '_' + case + '.png')

npix = 1024.0**2
secs2k = DateTime('2000:001:00:00:00').secs
sec2year = 1 / (86400. * 365.25)
yeardays = 365.25
alldarkcals = ParseTable.parse_table('darkcal_stats.dat')


def make_darkmaps(case='nominal', initial='pristine'):
    """Make dark current maps by degrading the CCD using the best-fit model
    from fit_evol.py"""

    date0 = DateTime('1999-05-23T18:00:00')

    if initial == 'pristine':
        # Start from a synthetic pristine CCD.  Probably no good reason to use this,
        # prefer starting from the pre-SSD-open dark cal on 1999223.
        dark = dark_models.pristine_ccd()
        darkcals = alldarkcals

    elif re.match('from|zero', initial):