Ejemplo n.º 1
0
  def update_potential(p):    
    # Update potential
    a = 0
    for fn in range(len(g.pot_functions['functions'])): 
      if(g.pot_functions['functions'][fn]['fit_type'] == 1):     # NODE SPLINE    
        ###NEED TO REDO MAYBE??###
      
        # Calc b
        b = a + g.pot_functions['functions'][fn]['fit_size']          
        # LOAD ORIGINAL
        g.pot_functions['functions'][fn]['points'] = numpy.copy(g.pot_functions['functions'][fn]['points_original'])        
        # VARY SPLINE
        potential.vary_tabulated_points(fn, p[a:b])
        # Update a
        a = b        
      elif(g.pot_functions['functions'][fn]['fit_type'] == 2):   # ANALYTIC  
        b = a + g.pot_functions['functions'][fn]['fit_size'] 
        # Make Analytic Points
        g.pot_functions['functions'][fn]['a_params'][:] = p[a:b]
        potential.make_analytic_points_inner(fn)
        a = b    
      
    # Rescale density functions 0.0 to 1.0  
    if(pf.rescale_on):
      rescale_density.run()

    
    # Update efs and bp modules
    potential.efs_add_potentials()     # Load potentials
    potential.bp_add_potentials()      # Load potentials
Ejemplo n.º 2
0
 def set_up():  
   # If a spline fit, convert into a spline 
   for fn in range(len(g.pot_functions['functions'])):       
     if(g.pot_functions['functions'][fn]['fit_type'] == 1): 
       potential.vary_tabulated_points(fn)
 
   # Setup EFS
   efs.init()                         # Initialise (allocate arrays)
   potential.efs_add_potentials()     # Load potentials
   configs.efs_add_config()           # Add configs
   
   # Setup BP    
   bp_calc.init()
   potential.bp_add_potentials()
   b_props.bp_add()
   
   # Rescale density function
   rescale_density.run()