HOPS
HOPS class reference
Classes | Functions
vpal.utility Namespace Reference

Classes

class  Bar
 
class  ContinuousQuantityFilter
 
class  DiscreteQuantityFilter
 
class  OptimizeResult
 

Functions

def basinhopping (func, x0, niter=100, minimizer_kwargs=None, take_step=None)
 
def collect_object_value_pairs (obj_list, value_name1, value_name2, sort_items=False)
 
def collect_object_values (obj_list, value_name)
 
def combined_filter (object_list, filter_list)
 
def compute_2d_pareto_front (obj_list, par1, par2, maximize1=True, maximize2=True)
 
def compute_weighted_mean (value_list, weight_list)
 
def int_to_time (t)
 
def limit_periodic_quantity_to_range (value_to_limit, low_value=-180.0, high_value=180.0)
 
def mad (value_list)
 
def minimize (func, x0, args=(), method="Nelder-Mead", options=None)
 
def minimum_angular_difference (angle1, angle2, low_value=-180.0, high_value=180.0)
 
def native_circmean (samples, high=2 *math.pi, low=0.0)
 
def native_circstd (samples, high=2 *math.pi, low=0.0)
 
def nelder_mead (func, x0, args=(), maxiter=200, tol=1e-6, disp=False)
 
def print_table (table, n_digits=9)
 
def sort_objects_by_quantity (object_list, quantity_name, reverse_boolean=False)
 
def tabulate (table, headers=None, n_digits=9, padding=3)
 
def time_to_int (year, day, hour, minute, sec)
 

Detailed Description

utility function module

Function Documentation

◆ basinhopping()

def vpal.utility.basinhopping (   func,
  x0,
  niter = 100,
  minimizer_kwargs = None,
  take_step = None 
)
Minimal replacement for scipy.optimize.basinhopping.

◆ collect_object_value_pairs()

def vpal.utility.collect_object_value_pairs (   obj_list,
  value_name1,
  value_name2,
  sort_items = False 
)
collect set of value pairs from a list of objects
(if sort_items=True, we sort them on the first value) 

◆ collect_object_values()

def vpal.utility.collect_object_values (   obj_list,
  value_name 
)
collect a value from a list of objects

◆ combined_filter()

def vpal.utility.combined_filter (   object_list,
  filter_list 
)
takes a list of objects, and a list of filters (may be a
combination of discrete or continuous value filters)
and returns a list of objects files which pass all of the filters

◆ compute_2d_pareto_front()

def vpal.utility.compute_2d_pareto_front (   obj_list,
  par1,
  par2,
  maximize1 = True,
  maximize2 = True 
)
returns a list of objects on the pareto front of par1 and par2
if maximize1 or maximize2 is false, then the objective for that variable will
be minimization rather than maximization

◆ compute_weighted_mean()

def vpal.utility.compute_weighted_mean (   value_list,
  weight_list 
)
return the weighted mean of a list of values

◆ int_to_time()

def vpal.utility.int_to_time (   t)
ported from int_to_time.c

◆ limit_periodic_quantity_to_range()

def vpal.utility.limit_periodic_quantity_to_range (   value_to_limit,
  low_value = -180.0,
  high_value = 180.0 
)
clamp periodic variable to range [low_value,high_value)

◆ mad()

def vpal.utility.mad (   value_list)
computes the median absolute deviation of a list of numbers
see: Anomaly Detection by Robust Statistics, P. Rousseeuw & M. Hubert

◆ minimize()

def vpal.utility.minimize (   func,
  x0,
  args = (),
  method = "Nelder-Mead",
  options = None 
)
Drop-in replacement for scipy.optimize.minimize with method='Nelder-Mead'.

◆ minimum_angular_difference()

def vpal.utility.minimum_angular_difference (   angle1,
  angle2,
  low_value = -180.0,
  high_value = 180.0 
)
compute the signed value of (angle1-angle2) folded into [-span/2, span/2),
i.e. the smallest-magnitude difference taking branch cuts into account

◆ native_circmean()

def vpal.utility.native_circmean (   samples,
  high = 2*math.pi,
  low = 0.0 
)
Compute the circular mean of angles.

Parameters
----------
samples : iterable of floats
    Input angles (can be in degrees or radians, but must be consistent).
high : float, optional
    Upper boundary of the range. Default is 2*pi (radians).
low : float, optional
    Lower boundary of the range. Default is 0 (radians).

Returns
-------
mean_angle : float
    Circular mean in the same units as input.

◆ native_circstd()

def vpal.utility.native_circstd (   samples,
  high = 2*math.pi,
  low = 0.0 
)
Compute the circular standard deviation of angles.

Parameters
----------
samples : iterable of floats
    Input angles (must be consistent units: all radians or all degrees).
high : float, optional
    Upper boundary of the range. Default is 2*pi(radians).
low : float, optional
    Lower boundary of the range. Default is 0 (radians).

Returns
-------
circ_std : float
    Circular standard deviation in the same units as input.

◆ nelder_mead()

def vpal.utility.nelder_mead (   func,
  x0,
  args = (),
  maxiter = 200,
  tol = 1e-6,
  disp = False 
)
Minimal Nelder-Mead optimizer, drop-in for scipy.optimize.minimize with method='Nelder-Mead'.

◆ print_table()

def vpal.utility.print_table (   table,
  n_digits = 9 
)
simple formatted print out of a table

◆ sort_objects_by_quantity()

def vpal.utility.sort_objects_by_quantity (   object_list,
  quantity_name,
  reverse_boolean = False 
)
#sorts low to high (if reverse is True, then high to low)

◆ tabulate()

def vpal.utility.tabulate (   table,
  headers = None,
  n_digits = 9,
  padding = 3 
)
simple formatted chunk of text representing a table, replacement for tabulate module

◆ time_to_int()

def vpal.utility.time_to_int (   year,
  day,
  hour,
  minute,
  sec 
)
ported from time_to_int.c in hops/sub/util