def __init__(self,options): # # Read the dir # import large_dataset_manager self.DM=large_dataset_manager.data_manager(options.dir) # # Read all datasets # matrix={} count=0 data=self.DM(count) while data: count=count+1 data=self.DM(count) if count>1000: data=None print '\b.', import sys sys.stdout.flush() # if data: sum_intpkadiff,sum_intene,tit_fit,pHact_fit=self.analyze_point(data) if not matrix.has_key(sum_intpkadiff): matrix[sum_intpkadiff]={} if not matrix[sum_intpkadiff].has_key(sum_intene): matrix[sum_intpkadiff][sum_intene]=[0,0] matrix[sum_intpkadiff][sum_intene][0]=matrix[sum_intpkadiff][sum_intene][0]+tit_fit matrix[sum_intpkadiff][sum_intene][1]=matrix[sum_intpkadiff][sum_intene][1]+pHact_fit # # Calculate ratio # minS=9999.9 maxS=-9999.9 for ip in matrix.keys(): for ie in matrix[ip].keys(): minS=min(minS,ie) maxS=max(maxS,ie) # vals=matrix[ip][ie] matrix[ip][ie]=vals[0] # Fill in empty values minF=min(matrix.keys()) maxF=max(matrix.keys()) print minF,maxF print minS,maxS #stop for ip in np.arange(minF,maxF+1,1): if not matrix.has_key(ip): matrix[ip]={} for ie in range(minS,maxS+1,1): if not matrix[ip].has_key(ie): matrix[ip][ie]=0.0 import TwoDplots TwoDplots.heatmap(matrix,firstkey='sum intpka diff',secondkey='sum intene (kT)') print 'I found %7.2e datasets' %count return
def construct_permutations(self): """Construct the specification for all possible permutations specified in __init__""" # # Make pickled files for each configuration # import large_dataset_manager, os self.options.dir = os.path.join(os.getcwd(), options.dir) if not os.path.isdir(self.options.dir): os.mkdir(options.dir) self.Data = large_dataset_manager.data_manager(self.options.dir) print 'Constructing system permutations' print '000.00 perc done', perm = 0 last_perc = 0 # # Init the counters # import time start = time.time() # # Start the loop # while perm < self.tot_perms: # # Get the specification # spec = self.get_specs(perm) #print spec self.Data.put(perm, { 'configuration': spec, 'numgroups': self.number_of_groups }) # # Get the time to completion # now = time.time() time_passed = now - start perc = float(perm) / float( self.tot_perms) * 100.0 + 0.00001 # To avoid zerodivision error total_time = time_passed / (perc / 100.0) time_to_completion = total_time - time_passed text = '%5.2f perc done. Complete in %.2f minutes (= %.2f hours or %.2f days) ' % ( perc, time_to_completion / 60.0, time_to_completion / 60.0 / 60.0, time_to_completion / 60.0 / 60.0 / 24.0) text = (len(text) + 4) * '\b' + text print text, # # Calculate titration curves for this permutation # new_data = self.do_one_pKa_calc(perm) self.Data.put(perm, new_data) perm = perm + 1 return
def construct_permutations(self): """Construct the specification for all possible permutations specified in __init__""" # # Make pickled files for each configuration # import large_dataset_manager, os self.options.dir=os.path.join(os.getcwd(),options.dir) if not os.path.isdir(self.options.dir): os.mkdir(options.dir) self.Data=large_dataset_manager.data_manager(self.options.dir) print 'Constructing system permutations' print '000.00 perc done', perm=0 last_perc=0 # # Init the counters # import time start=time.time() # # Start the loop # while perm<self.tot_perms: # # Get the specification # spec=self.get_specs(perm) #print spec self.Data.put(perm,{'configuration':spec,'numgroups':self.number_of_groups}) # # Get the time to completion # now=time.time() time_passed=now-start perc=float(perm)/float(self.tot_perms)*100.0+0.00001 # To avoid zerodivision error total_time=time_passed/(perc/100.0) time_to_completion=total_time-time_passed text='%5.2f perc done. Complete in %.2f minutes (= %.2f hours or %.2f days) ' %(perc,time_to_completion/60.0,time_to_completion/60.0/60.0, time_to_completion/60.0/60.0/24.0) text=(len(text)+4)*'\b'+text print text, # # Calculate titration curves for this permutation # new_data=self.do_one_pKa_calc(perm) self.Data.put(perm,new_data) perm=perm+1 return