Ejemplo n.º 1
0
def PDF2(p, var):
    """
	My 2nd, more efficient version of randomly drawing from a pdf
	
  	PURPOSE: Calculate a value of x taken from p

  	ARGUMENTS:
    	p: function, A Python function or method to integrate
    	var: 1d increasing array, the range of the random variable var

  	RETURNS: a random number x generated according to the pdf
  	"""
    switch = 0
    while switch == 0:
        #draw two random numbers between the range of the pdf
        ux = n.random.uniform(n.min(var), n.max(var))
        uy = n.random.uniform(n.min(p(var)), n.max(p(var)))
        u = n.random.uniform()
        #decide if the random number, ux, should be kept
        #keep it if uy is less than p(ux)
        if uy <= p(ux):
            switch = 1
            return ux
Ejemplo n.º 2
0
 def load_ctrl_well_dict(self, c_wells):
     if type(c_wells)!=np.int64:
         result={}
         for c_well in c_wells:
             result[c_well]=self.load_ctrl_well_dict(c_well)
         return result
     else:
         try:
             f=open(os.path.join(self.settings.outputFolder,self.plate, self.settings.outputFile.format(self.plate[:10], c_wells)))
             counts=pickle.load(f); f.close()
             print "Loading pheno counts for ctrl well {} from file ".format(c_wells),
         except IOError:
             print "Computing pheno counts for ctrl well {} ".format(c_wells),
             p=pheno_seq_extractor(setting_file=self.settings_file, plate=self.plate, well=c_wells)
             counts= p(time_pheno_count_only=True)
             
         return counts
Ejemplo n.º 3
0
    parser = OptionParser(usage="usage: %prog [options]",
                         description=description)
    
    parser.add_option("-f", "--settings_file", dest="settings_file", default='analyzer/settings/settings_drug_screen_thalassa.py',
                      help="Settings_file")

    parser.add_option("-p", "--plate", dest="plate",
                      help="The plate which you are interested in")
    
    parser.add_option("-w", "--well", dest="well",
                      help="The well which you are interested in")

    parser.add_option("-c", dest="count_only",type=int,default=0,
                      help="For ctrl DS and Mitocheck, do the aggregated pheno count only")

    
    (options, args) = parser.parse_args()
    if options.well!='CTRL':
        if len(options.well)>3:
            well=int(options.well.split('_')[0])
        else:
            well=int(options.well)
    else:
        well='CTRL'
    
    p=pheno_seq_extractor(options.settings_file, options.plate,well)
    p(time_pheno_count_only=options.count_only)
    print "Done"