toolbox - Toolbox of various functions and generic utilities¶
Toolbox of various functions and generic utilities.
Authors: Steve Morley, Jon Niehof, Brian Larsen, Josef Koller, Dan Welling Institution: Los Alamos National Laboratory Contact: smorley@lanl.gov, jniehof@lanl.gov, balarsen@lanl.gov, jkoller@lanl.gov, dwelling@lanl.gov Los Alamos National Laboratory
Copyright 2010 Los Alamos National Security, LLC.
Array binning¶
|
Split a sequence into subsequences based on value. |
|
Convert a list of bin centers to their edges |
|
Convert a list of bin edges to their centers |
|
Calculates bin width and number of bins for histogram using Freedman-Diaconis rule, if rule fails, defaults to square-root method |
Array creation¶
|
Convert a probability distribution function to a list of values |
|
Returns geometrically spaced numbers. |
|
Returns linear-spaced bins. |
|
Returns log-spaced bins. |
Array searching and masking¶
|
given two array-like variables interweave them together. |
|
Returns if an object is a view of another object. |
|
Finds the elements in a list of datetime objects present in another |
|
Finds the overlapping elements in two lists of datetime objects |
|
Find overlapping elements in two lists of datetime objects |
Other functions¶
|
assembles all pickled files matching fln_pattern into single file and save as outfln. |
|
Bootstrap confidence intervals for a histogram. |
|
pretty print a dictionary tree |
|
Times an event then prints out the time and the name of the event, nice for debugging and seeing that the code is progressing |
|
Return the full path of a parent directory with name as the leaf |
|
Sort the given list in the way that humans expect. |
|
compute the N-dimensional hypot of an iterable or many arguments |
|
return the start and end indices implied by a range, useful when range is zero-length |
|
1-D linear interpolation with interpolation of hours/longitude |
|
Find the function input such that definite integral is desired value. |
|
Calculate median absolute deviation of a given input series |
|
Convert mlt values to radians for polar plotting transform mlt angles to radians from -pi to pi referenced from noon by default |
|
Given an input vector normalize the vector to a given range |
|
print min and max of input arrays |
|
Fit a Poisson distribution to data using the method and initial guess provided. |
|
Convert radians values to mlt transform radians from -pi to pi to mlt referenced from noon by default |
|
Windowing mean function, window overlap is user defined |
Multithreading and multiprocessing¶
|
Split a job into subjobs and run a thread for each |
|
Apply a function to every element of a list, in separate threads |
System tools¶
|
Execute a function (or method) with a timeout. |
|
Read data from a URL |
|
load a pickle and return content as dictionary |
|
print a progress bar with urllib.urlretrieve reporthook functionality |
|
Ask a yes/no question via raw_input() and return their answer. |
|
save dictionary variable dict to a pickle with filename fln |
|
Call a subprocess with a timeout. |
Raised when a time-limited process times out |
|
|
Download and update local database for omni, leapsecs etc |