Exemple #1
0
   def publish(self):
      alldata = []
      
      for i,val in enumerate(self.status['runs']):
         print val
         alldata.append(post_bout.read(path=val))
     
      alldata = np.array(alldata)
      print "alldata.shape: ", alldata.shape
      print  alldata[0]['Ni']['ave']['amp'].shape
      data = alldata[0]['Ni']['ave']['amp'] #Nt long array
      pp = PdfPages('output.pdf')
      plt.figure()
      cs = plt.plot(data)
      plt.title('amplitude ')
      plt.savefig(pp, format='pdf')

      gamma = alldata[2]['Ni']['modes'][0]['gamma'] #single value
      phase = alldata[2]['Ni']['modes'][0]['phase'] #Nt x Nx array 

      plt.figure()
      cs = plt.contour(phase)
      plt.clabel(cs, inline=1, fontsize=10)
      plt.title('phase')
      plt.savefig(pp, format='pdf')

      plt.close() 
      pp.close()
   
      explain = alldata[0]['meta']
      print explain
      
      allpickle = open('allpickled.pkl','wb')
      pickle.dump(alldata,allpickle)
      allpickle.close()
Exemple #2
0
def corral(cached=True,refresh=False,debug=False,IConly=1,
           logname='status.log',skew=False):

   print 'in corral'
   log  = read_log(logname=logname) 
   #done = log['done']
   runs = log['runs'] #a list of all directories, we need this,
   # only need 'runs' if the simulation is done 
  
   current = log['current'] #always return the last data_dir    
   
   print log
   print 'current:', current
   
   if refresh==True:
      
      for i,path in enumerate(runs):
         print i,path
         a = post_bout.save(path=path,IConly=IConly,transform=skew) #re post-process a run
         
         
      
   elif cached == False: #if all the ind. simulation pkl files are in place skip this part
  
      a = post_bout.save(path=current) #save to current dir
      #here is really where you shoudl write to status.log
      #write_log('status.log',
      cached = True
  
   #if done:
     
   alldata = []
   alldb =[]
   print 'last_one: '
   for i,val in enumerate(runs):
      print val
      db = post_bout.read(path=val)
      #alldata.append(array)
      alldb.append(db)
         
         #build the end database
         
         
      #remove the read in pickle

   #return alldb
   def islist(input):
      return isinstance(input,list)

   alldb = filter(islist,alldb)

   alldb = sum(alldb,[])
   #alldata = np.array(alldata)
   
   nt = []
   for mode in alldb:
      nt.append(len(mode['amp']))
      nt = [max(nt)]
   
   nt = nt[0]
   t = range(nt)             
   i = 0
    
   if debug:
       return alldb
   else:
       return LinRes(alldb)
Exemple #3
0
def corral(cached=True,
           refresh=False,
           debug=False,
           IConly=1,
           logname='status.log',
           skew=False):

    print 'in corral'
    log = read_log(logname=logname)
    #done = log['done']
    runs = log['runs']  #a list of all directories, we need this,
    # only need 'runs' if the simulation is done

    current = log['current']  #always return the last data_dir

    print log
    print 'current:', current

    if refresh == True:

        for i, path in enumerate(runs):
            print i, path
            a = post_bout.save(path=path,
                               IConly=IConly)  #re post-process a run

    elif cached == False:  #if all the ind. simulation pkl files are in place skip this part

        a = post_bout.save(path=current)  #save to current dir
        #here is really where you shoudl write to status.log
        #write_log('status.log',
        cached = True

    #if done:

    all_ave = []
    all_modes = []
    print 'last_one: '
    for i, val in enumerate(runs):
        print val
        mode_db, ave_db = post_bout.read(path=val)
        #alldata.append(array)
        all_modes.append(mode_db)
        all_ave.append(ave_db)

        #build the end database

        #remove the read in pickle

    #return alldb
    def islist(input):
        return isinstance(input, list)

    all_modes = filter(islist, all_modes)
    #all_ave = filter(islist,all_ave)

    #alldb = sum(alldb,[])
    #alldata = np.array(alldata)
    all_modes = sum(all_modes, [])

    nt = []
    for mode in all_modes:
        nt.append(len(mode['amp']))
        nt = [max(nt)]

    nt = nt[0]
    t = range(nt)
    i = 0

    if debug:
        return all_modes, all_ave
    else:
        return LinRes(all_modes)