xboa
Classes | Namespaces | Functions | Variables
_common.py File Reference

Go to the source code of this file.

Classes

class  rg
 root globals line_color_int=1, line_style_int=1, line_width_int=2, fill_color_int=None, stats_bool=False, hist_title_string='' More...
 

Namespaces

 xboa.common._common
 

Functions

def substitute
 Read in file_name_in and write to file_name_out, replacing key with value in switch_dict. More...
 
def __y_function_wrapper
 
def nd_newton_raphson1
 Root finding in an arbitrary dimensional system. More...
 
def nd_newton_raphson2
 Alternative version of nd_newton_raphson1. More...
 
def has_multiprocessing
 Raise an exception if multiprocessing libraries have not been imported properly. More...
 
def has_maus
 Raise an exception if MAUS tracking library has not been imported properly. More...
 
def has_root
 Raise an exception if ROOT graphics libraries have not been imported properly. More...
 
def has_numpy
 Raise an exception if NumPy numerical algebra libraries have not been imported properly. More...
 
def has_scipy
 Raise an exception if SciPy math/analysis libraries have not been imported properly. More...
 
def has_matplot
 Raise an exception if NumPy numerical algebra libraries have not been imported properly. More...
 
def has_json
 Raise an exception if json data libraries have not been imported properly. More...
 
def min_max
 Return minimum and maximum of a list (i) discarding values with ~0 weight and (ii) adding a margin. More...
 
def multisort
 Sort a list of lists by the first list. More...
 
def n_bins
 Dynamically decide a number of bins depending on the number of points in the histogram. More...
 
def histogram
 Get a 1d or 2d list of bin weights from a set of data, weights and bin edges. More...
 
def get_bin_edges
 Get a sorted list of equally spaced bin edges from a list of floats. More...
 
def make_root_canvas
 Make a root canvas with name canvas_name_string-<index> where <index> is a unique integer starting from 0. More...
 
def make_root_histogram
 Make a root histogram with data taken from float lists and axes named after the axis strings. More...
 
def make_root_legend
 Build a legend for the canvas. More...
 
def make_matplot_histogram
 Make a matplot graph with data taken from float lists and axes naemd after the axis strings. More...
 
def make_root_graph
 Make a root graph with data taken from float lists and axes named after the axis strings. More...
 
def make_matplot_graph
 Make a matplot graph with data taken from float lists and axes naemd after the axis strings. More...
 
def make_root_multigraph
 Print several different graphs on the same canvas. More...
 
def make_matplot_multigraph
 Print several different graphs on the same axes. More...
 
def make_matplot_scatter
 Make a matplot scatter graph with data taken from float lists and axes naemd after the axis strings. More...
 
def wait_for_root
 Force python to halt processing until ROOT windows are closed. More...
 
def clear_root
 Close root plots (and free memory) More...
 
def wait_for_matplot
 Show any plots made using matplotlib on the screen. More...
 
def matplot_show_and_continue
 Show matplotlib plots and return to the script. More...
 
def subprocess
 Make a function call in a subprocess; return the subprocess pid. More...
 
def kill_all_subprocesses
 Kill all subprocesses generated by common.subprocess call; automatically called at exit unless kill_subprocesses_at_exit is set to False Note that this makes a call to the os, which may take a bit of time to respond. More...
 
def kolmogorov_smirnov_test
 Convenience wrapper for ROOT kolmogorov-smirnov test. More...
 
def __atexit
 Calls some functions automatically at exit. More...
 
def make_grid
 Make a rectangular n_dimensional grid of points evenly spaced between [-1,1] in each dimension. More...
 
def make_shell
 Make a shell of points that sit on a hyper-ellipsoid defined by ellipse matrix. More...
 
def normalise_vector
 Normalise vector so that vector.T() * matrix.inverse * vector = 1. More...
 
def __function_with_queue
 Wrapper function to put multiprocessing output into a queue. More...
 
def process_list
 Run multiprocessing on a list of arguments. More...
 
def _sum_weight
 
def _get_fit_ellipse_covariance_matrix
 
def _update_fit_ellipse_cut
 
def fit_ellipse
 Fit an ellipse of arbitrary dimension n to a set of points. More...
 
def make_root_ellipse_function
 Make a ROOT TFunction for a given beam ellipse. More...
 
def common_overview_doc
 Creates some summary documentation for the common module. More...
 

Variables

string xboa_version = '0.16.2'
 
int float_tolerance = 1
 
 kill_subprocesses_at_exit = True
 
 __has_maus = False
 
 __has_root = True
 
 __has_scipy = True
 
 __has_numpy = True
 
 __has_matplot = True
 
 __has_multiprocessing = True
 
 __has_json = True
 
dictionary pdg_pid_to_muon1 = {-13:'mu+'}
 
dictionary muon1_pid_to_pdg = {}
 
dictionary icool_pid_to_pdg = {0:0, 1:-11, 2:-13, 3:211, 4:321, 5:2212, -1:11, -2:13, -3:-211, -4:-321, -5:-2212}
 
dictionary pdg_pid_to_icool = {}
 
dictionary mars_pid_to_pdg = {1:2212, 2:2112, 3:211, 4:-211, 5:321, 6:-321, 7:-13, 8:13, 9:22, 10:11, 11:-11, 12:-2212, 13:111, 14:1000010020, 15:1000010030, 16:1000020030, 17:1000020040, 18:14, 19:-14, 20:12, 21:-12, 22:130, 23:310, 24:311, 25:-311,26:3122,27:-3122,28:0,29:0,30:0,31:-2112,32:0,33:0,34:0,35:0,36:0,38:0,39:0,40:0}
 
dictionary pdg_pid_to_mars = {}
 
dictionary pdg_pid_to_mass = {0:0, 11:0.510998910, 12:0., 13:105.6583668, 14:0., 22:0., 111:134.9766, 211:139.57018, 321:493.667, 2112:939.56536, 2212:938.271996, 1000010020:1876.1239, 1000010030:2809.432, 1000020030:2809.41346, 1000020040: 3728.4001, 130:497.614, 310:497.614, 311:497.614, 3122:1115.683}
 
dictionary pdg_pid_to_name
 
dictionary pdg_pid_to_charge = {0:0, 11:-1, 12:0, 13:-1, 14:0, 22:0, 111:0, 211:+1, 321:+1, 2112:0, 2212:+1, 1000010020:0, 1000010030:0, 1000020030:0, 1000020040:0, 130:0, 310:0, 311:0, 3122:0, -11:+1, -12:0, -13:+1, -14:0, -211:-1, -321:-1, -2112:0, -2212:-1, -3122:0}
 
dictionary constants = {'c_light':299.792458, 'pi':3.14159265,'echarge':1}
 
dictionary units
 
list _canvas_persistent = []
 privates More...
 
list _hist_persistent = []
 
list _graph_persistent = []
 
list _legend_persistent = []
 
list _function_persistent = []
 
int _figure_index = 1
 pyplot globals More...
 
 wrapped_y_function = None
 
list __mp_subprocesses = []
 
list __fk_subprocesses = []
 
tuple __doc__ = common_overview_doc()