id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
14,000
rootpy/rootpy
rootpy/extern/byteplay2/__init__.py
Code.from_code
def from_code(cls, co): """Disassemble a Python code object into a Code object.""" co_code = co.co_code labels = dict((addr, Label()) for addr in findlabels(co_code)) linestarts = dict(cls._findlinestarts(co)) cellfree = co.co_cellvars + co.co_freevars code = CodeList() ...
python
def from_code(cls, co): """Disassemble a Python code object into a Code object.""" co_code = co.co_code labels = dict((addr, Label()) for addr in findlabels(co_code)) linestarts = dict(cls._findlinestarts(co)) cellfree = co.co_cellvars + co.co_freevars code = CodeList() ...
[ "def", "from_code", "(", "cls", ",", "co", ")", ":", "co_code", "=", "co", ".", "co_code", "labels", "=", "dict", "(", "(", "addr", ",", "Label", "(", ")", ")", "for", "addr", "in", "findlabels", "(", "co_code", ")", ")", "linestarts", "=", "dict",...
Disassemble a Python code object into a Code object.
[ "Disassemble", "a", "Python", "code", "object", "into", "a", "Code", "object", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/extern/byteplay2/__init__.py#L320-L387
14,001
rootpy/rootpy
rootpy/plotting/contrib/quantiles.py
effective_sample_size
def effective_sample_size(h): """ Calculate the effective sample size for a histogram the same way as ROOT does. """ sum = 0 ew = 0 w = 0 for bin in h.bins(overflow=False): sum += bin.value ew = bin.error w += ew * ew esum = sum * sum / w return esum
python
def effective_sample_size(h): """ Calculate the effective sample size for a histogram the same way as ROOT does. """ sum = 0 ew = 0 w = 0 for bin in h.bins(overflow=False): sum += bin.value ew = bin.error w += ew * ew esum = sum * sum / w return esum
[ "def", "effective_sample_size", "(", "h", ")", ":", "sum", "=", "0", "ew", "=", "0", "w", "=", "0", "for", "bin", "in", "h", ".", "bins", "(", "overflow", "=", "False", ")", ":", "sum", "+=", "bin", ".", "value", "ew", "=", "bin", ".", "error",...
Calculate the effective sample size for a histogram the same way as ROOT does.
[ "Calculate", "the", "effective", "sample", "size", "for", "a", "histogram", "the", "same", "way", "as", "ROOT", "does", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/contrib/quantiles.py#L107-L120
14,002
rootpy/rootpy
rootpy/plotting/contrib/quantiles.py
critical_value
def critical_value(n, p): """ This function calculates the critical value given n and p, and confidence level = 1 - p. """ dn = 1 delta = 0.5 res = ROOT.TMath.KolmogorovProb(dn * sqrt(n)) while res > 1.0001 * p or res < 0.9999 * p: if (res > 1.0001 * p): dn = dn + del...
python
def critical_value(n, p): """ This function calculates the critical value given n and p, and confidence level = 1 - p. """ dn = 1 delta = 0.5 res = ROOT.TMath.KolmogorovProb(dn * sqrt(n)) while res > 1.0001 * p or res < 0.9999 * p: if (res > 1.0001 * p): dn = dn + del...
[ "def", "critical_value", "(", "n", ",", "p", ")", ":", "dn", "=", "1", "delta", "=", "0.5", "res", "=", "ROOT", ".", "TMath", ".", "KolmogorovProb", "(", "dn", "*", "sqrt", "(", "n", ")", ")", "while", "res", ">", "1.0001", "*", "p", "or", "res...
This function calculates the critical value given n and p, and confidence level = 1 - p.
[ "This", "function", "calculates", "the", "critical", "value", "given", "n", "and", "p", "and", "confidence", "level", "=", "1", "-", "p", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/contrib/quantiles.py#L123-L138
14,003
rootpy/rootpy
rootpy/io/pickler.py
dump
def dump(obj, root_file, proto=0, key=None): """Dump an object into a ROOT TFile. `root_file` may be an open ROOT file or directory, or a string path to an existing ROOT file. """ if isinstance(root_file, string_types): root_file = root_open(root_file, 'recreate') own_file = True ...
python
def dump(obj, root_file, proto=0, key=None): """Dump an object into a ROOT TFile. `root_file` may be an open ROOT file or directory, or a string path to an existing ROOT file. """ if isinstance(root_file, string_types): root_file = root_open(root_file, 'recreate') own_file = True ...
[ "def", "dump", "(", "obj", ",", "root_file", ",", "proto", "=", "0", ",", "key", "=", "None", ")", ":", "if", "isinstance", "(", "root_file", ",", "string_types", ")", ":", "root_file", "=", "root_open", "(", "root_file", ",", "'recreate'", ")", "own_f...
Dump an object into a ROOT TFile. `root_file` may be an open ROOT file or directory, or a string path to an existing ROOT file.
[ "Dump", "an", "object", "into", "a", "ROOT", "TFile", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/io/pickler.py#L344-L358
14,004
rootpy/rootpy
rootpy/io/pickler.py
load
def load(root_file, use_proxy=True, key=None): """Load an object from a ROOT TFile. `root_file` may be an open ROOT file or directory, or a string path to an existing ROOT file. """ if isinstance(root_file, string_types): root_file = root_open(root_file) own_file = True else: ...
python
def load(root_file, use_proxy=True, key=None): """Load an object from a ROOT TFile. `root_file` may be an open ROOT file or directory, or a string path to an existing ROOT file. """ if isinstance(root_file, string_types): root_file = root_open(root_file) own_file = True else: ...
[ "def", "load", "(", "root_file", ",", "use_proxy", "=", "True", ",", "key", "=", "None", ")", ":", "if", "isinstance", "(", "root_file", ",", "string_types", ")", ":", "root_file", "=", "root_open", "(", "root_file", ")", "own_file", "=", "True", "else",...
Load an object from a ROOT TFile. `root_file` may be an open ROOT file or directory, or a string path to an existing ROOT file.
[ "Load", "an", "object", "from", "a", "ROOT", "TFile", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/io/pickler.py#L361-L375
14,005
rootpy/rootpy
rootpy/io/pickler.py
Pickler.dump
def dump(self, obj, key=None): """Write a pickled representation of obj to the open TFile.""" if key is None: key = '_pickle' with preserve_current_directory(): self.__file.cd() if sys.version_info[0] < 3: pickle.Pickler.dump(self, obj) ...
python
def dump(self, obj, key=None): """Write a pickled representation of obj to the open TFile.""" if key is None: key = '_pickle' with preserve_current_directory(): self.__file.cd() if sys.version_info[0] < 3: pickle.Pickler.dump(self, obj) ...
[ "def", "dump", "(", "self", ",", "obj", ",", "key", "=", "None", ")", ":", "if", "key", "is", "None", ":", "key", "=", "'_pickle'", "with", "preserve_current_directory", "(", ")", ":", "self", ".", "__file", ".", "cd", "(", ")", "if", "sys", ".", ...
Write a pickled representation of obj to the open TFile.
[ "Write", "a", "pickled", "representation", "of", "obj", "to", "the", "open", "TFile", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/io/pickler.py#L162-L176
14,006
rootpy/rootpy
rootpy/io/pickler.py
Unpickler.load
def load(self, key=None): """Read a pickled object representation from the open file.""" if key is None: key = '_pickle' obj = None if _compat_hooks: save = _compat_hooks[0]() try: self.__n += 1 s = self.__file.Get(key + ';{0:d}'.fo...
python
def load(self, key=None): """Read a pickled object representation from the open file.""" if key is None: key = '_pickle' obj = None if _compat_hooks: save = _compat_hooks[0]() try: self.__n += 1 s = self.__file.Get(key + ';{0:d}'.fo...
[ "def", "load", "(", "self", ",", "key", "=", "None", ")", ":", "if", "key", "is", "None", ":", "key", "=", "'_pickle'", "obj", "=", "None", "if", "_compat_hooks", ":", "save", "=", "_compat_hooks", "[", "0", "]", "(", ")", "try", ":", "self", "."...
Read a pickled object representation from the open file.
[ "Read", "a", "pickled", "object", "representation", "from", "the", "open", "file", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/io/pickler.py#L272-L291
14,007
rootpy/rootpy
rootpy/utils/extras.py
iter_ROOT_classes
def iter_ROOT_classes(): """ Iterator over all available ROOT classes """ class_index = "http://root.cern.ch/root/html/ClassIndex.html" for s in minidom.parse(urlopen(class_index)).getElementsByTagName("span"): if ("class", "typename") in s.attributes.items(): class_name = s.chil...
python
def iter_ROOT_classes(): """ Iterator over all available ROOT classes """ class_index = "http://root.cern.ch/root/html/ClassIndex.html" for s in minidom.parse(urlopen(class_index)).getElementsByTagName("span"): if ("class", "typename") in s.attributes.items(): class_name = s.chil...
[ "def", "iter_ROOT_classes", "(", ")", ":", "class_index", "=", "\"http://root.cern.ch/root/html/ClassIndex.html\"", "for", "s", "in", "minidom", ".", "parse", "(", "urlopen", "(", "class_index", ")", ")", ".", "getElementsByTagName", "(", "\"span\"", ")", ":", "if...
Iterator over all available ROOT classes
[ "Iterator", "over", "all", "available", "ROOT", "classes" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/utils/extras.py#L27-L38
14,008
rootpy/rootpy
rootpy/plotting/style/cmstdr/labels.py
CMS_label
def CMS_label(text="Preliminary 2012", sqrts=8, pad=None): """ Add a 'CMS Preliminary' style label to the current Pad. The blurbs are drawn in the top margin. The label "CMS " + text is drawn in the upper left. If sqrts is None, it will be omitted. Otherwise, it will be drawn in the upper right. ...
python
def CMS_label(text="Preliminary 2012", sqrts=8, pad=None): """ Add a 'CMS Preliminary' style label to the current Pad. The blurbs are drawn in the top margin. The label "CMS " + text is drawn in the upper left. If sqrts is None, it will be omitted. Otherwise, it will be drawn in the upper right. ...
[ "def", "CMS_label", "(", "text", "=", "\"Preliminary 2012\"", ",", "sqrts", "=", "8", ",", "pad", "=", "None", ")", ":", "if", "pad", "is", "None", ":", "pad", "=", "ROOT", ".", "gPad", "with", "preserve_current_canvas", "(", ")", ":", "pad", ".", "c...
Add a 'CMS Preliminary' style label to the current Pad. The blurbs are drawn in the top margin. The label "CMS " + text is drawn in the upper left. If sqrts is None, it will be omitted. Otherwise, it will be drawn in the upper right.
[ "Add", "a", "CMS", "Preliminary", "style", "label", "to", "the", "current", "Pad", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/style/cmstdr/labels.py#L15-L50
14,009
rootpy/rootpy
rootpy/stats/histfactory/utils.py
make_channel
def make_channel(name, samples, data=None, verbose=False): """ Create a Channel from a list of Samples """ if verbose: llog = log['make_channel'] llog.info("creating channel {0}".format(name)) # avoid segfault if name begins with a digit by using "channel_" prefix chan = Channel(...
python
def make_channel(name, samples, data=None, verbose=False): """ Create a Channel from a list of Samples """ if verbose: llog = log['make_channel'] llog.info("creating channel {0}".format(name)) # avoid segfault if name begins with a digit by using "channel_" prefix chan = Channel(...
[ "def", "make_channel", "(", "name", ",", "samples", ",", "data", "=", "None", ",", "verbose", "=", "False", ")", ":", "if", "verbose", ":", "llog", "=", "log", "[", "'make_channel'", "]", "llog", ".", "info", "(", "\"creating channel {0}\"", ".", "format...
Create a Channel from a list of Samples
[ "Create", "a", "Channel", "from", "a", "list", "of", "Samples" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stats/histfactory/utils.py#L32-L53
14,010
rootpy/rootpy
rootpy/stats/histfactory/utils.py
make_measurement
def make_measurement(name, channels, lumi=1.0, lumi_rel_error=0.1, output_prefix='./histfactory', POI=None, const_params=None, verbose=False): """ Create a Measurement from a list of Cha...
python
def make_measurement(name, channels, lumi=1.0, lumi_rel_error=0.1, output_prefix='./histfactory', POI=None, const_params=None, verbose=False): """ Create a Measurement from a list of Cha...
[ "def", "make_measurement", "(", "name", ",", "channels", ",", "lumi", "=", "1.0", ",", "lumi_rel_error", "=", "0.1", ",", "output_prefix", "=", "'./histfactory'", ",", "POI", "=", "None", ",", "const_params", "=", "None", ",", "verbose", "=", "False", ")",...
Create a Measurement from a list of Channels
[ "Create", "a", "Measurement", "from", "a", "list", "of", "Channels" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stats/histfactory/utils.py#L56-L104
14,011
rootpy/rootpy
rootpy/stats/histfactory/utils.py
make_workspace
def make_workspace(measurement, channel=None, name=None, silence=False): """ Create a workspace containing the model for a measurement If `channel` is None then include all channels in the model If `silence` is True, then silence HistFactory's output on stdout and stderr. """ context = sil...
python
def make_workspace(measurement, channel=None, name=None, silence=False): """ Create a workspace containing the model for a measurement If `channel` is None then include all channels in the model If `silence` is True, then silence HistFactory's output on stdout and stderr. """ context = sil...
[ "def", "make_workspace", "(", "measurement", ",", "channel", "=", "None", ",", "name", "=", "None", ",", "silence", "=", "False", ")", ":", "context", "=", "silence_sout_serr", "if", "silence", "else", "do_nothing", "with", "context", "(", ")", ":", "hist2...
Create a workspace containing the model for a measurement If `channel` is None then include all channels in the model If `silence` is True, then silence HistFactory's output on stdout and stderr.
[ "Create", "a", "workspace", "containing", "the", "model", "for", "a", "measurement" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stats/histfactory/utils.py#L107-L129
14,012
rootpy/rootpy
rootpy/stats/histfactory/utils.py
measurements_from_xml
def measurements_from_xml(filename, collect_histograms=True, cd_parent=False, silence=False): """ Read in a list of Measurements from XML """ if not os.path.isfile(filename): raise OSError("the file {0} does not exist"...
python
def measurements_from_xml(filename, collect_histograms=True, cd_parent=False, silence=False): """ Read in a list of Measurements from XML """ if not os.path.isfile(filename): raise OSError("the file {0} does not exist"...
[ "def", "measurements_from_xml", "(", "filename", ",", "collect_histograms", "=", "True", ",", "cd_parent", "=", "False", ",", "silence", "=", "False", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "filename", ")", ":", "raise", "OSError", ...
Read in a list of Measurements from XML
[ "Read", "in", "a", "list", "of", "Measurements", "from", "XML" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stats/histfactory/utils.py#L132-L166
14,013
rootpy/rootpy
rootpy/stats/histfactory/utils.py
write_measurement
def write_measurement(measurement, root_file=None, xml_path=None, output_path=None, output_suffix=None, write_workspaces=False, apply_xml_patches=True, silence=False)...
python
def write_measurement(measurement, root_file=None, xml_path=None, output_path=None, output_suffix=None, write_workspaces=False, apply_xml_patches=True, silence=False)...
[ "def", "write_measurement", "(", "measurement", ",", "root_file", "=", "None", ",", "xml_path", "=", "None", ",", "output_path", "=", "None", ",", "output_suffix", "=", "None", ",", "write_workspaces", "=", "False", ",", "apply_xml_patches", "=", "True", ",", ...
Write a measurement and RooWorkspaces for all contained channels into a ROOT file and write the XML files into a directory. Parameters ---------- measurement : HistFactory::Measurement An asrootpy'd ``HistFactory::Measurement`` object root_file : ROOT TFile or string, optional (default=No...
[ "Write", "a", "measurement", "and", "RooWorkspaces", "for", "all", "contained", "channels", "into", "a", "ROOT", "file", "and", "write", "the", "XML", "files", "into", "a", "directory", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stats/histfactory/utils.py#L169-L282
14,014
rootpy/rootpy
rootpy/stats/histfactory/utils.py
patch_xml
def patch_xml(files, root_file=None, float_precision=3): """ Apply patches to HistFactory XML output from PrintXML """ if float_precision < 0: raise ValueError("precision must be greater than 0") def fix_path(match): path = match.group(1) if path: head, tail = os...
python
def patch_xml(files, root_file=None, float_precision=3): """ Apply patches to HistFactory XML output from PrintXML """ if float_precision < 0: raise ValueError("precision must be greater than 0") def fix_path(match): path = match.group(1) if path: head, tail = os...
[ "def", "patch_xml", "(", "files", ",", "root_file", "=", "None", ",", "float_precision", "=", "3", ")", ":", "if", "float_precision", "<", "0", ":", "raise", "ValueError", "(", "\"precision must be greater than 0\"", ")", "def", "fix_path", "(", "match", ")", ...
Apply patches to HistFactory XML output from PrintXML
[ "Apply", "patches", "to", "HistFactory", "XML", "output", "from", "PrintXML" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stats/histfactory/utils.py#L285-L354
14,015
rootpy/rootpy
rootpy/plotting/views.py
_FolderView.path
def path(self): ''' Get the path of the wrapped folder ''' if isinstance(self.dir, Directory): return self.dir._path elif isinstance(self.dir, ROOT.TDirectory): return self.dir.GetPath() elif isinstance(self.dir, _FolderView): return self.dir.path() ...
python
def path(self): ''' Get the path of the wrapped folder ''' if isinstance(self.dir, Directory): return self.dir._path elif isinstance(self.dir, ROOT.TDirectory): return self.dir.GetPath() elif isinstance(self.dir, _FolderView): return self.dir.path() ...
[ "def", "path", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "dir", ",", "Directory", ")", ":", "return", "self", ".", "dir", ".", "_path", "elif", "isinstance", "(", "self", ".", "dir", ",", "ROOT", ".", "TDirectory", ")", ":", "ret...
Get the path of the wrapped folder
[ "Get", "the", "path", "of", "the", "wrapped", "folder" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/views.py#L293-L302
14,016
rootpy/rootpy
rootpy/plotting/views.py
_MultiFolderView.Get
def Get(self, path): ''' Merge the objects at path in all subdirectories ''' return self.merge_views(x.Get(path) for x in self.dirs)
python
def Get(self, path): ''' Merge the objects at path in all subdirectories ''' return self.merge_views(x.Get(path) for x in self.dirs)
[ "def", "Get", "(", "self", ",", "path", ")", ":", "return", "self", ".", "merge_views", "(", "x", ".", "Get", "(", "path", ")", "for", "x", "in", "self", ".", "dirs", ")" ]
Merge the objects at path in all subdirectories
[ "Merge", "the", "objects", "at", "path", "in", "all", "subdirectories" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/views.py#L341-L343
14,017
rootpy/rootpy
rootpy/logger/roothandler.py
python_logging_error_handler
def python_logging_error_handler(level, root_says_abort, location, msg): """ A python error handler for ROOT which maps ROOT's errors and warnings on to python's. """ from ..utils import quickroot as QROOT if not Initialized.value: try: QROOT.kTRUE except AttributeEr...
python
def python_logging_error_handler(level, root_says_abort, location, msg): """ A python error handler for ROOT which maps ROOT's errors and warnings on to python's. """ from ..utils import quickroot as QROOT if not Initialized.value: try: QROOT.kTRUE except AttributeEr...
[ "def", "python_logging_error_handler", "(", "level", ",", "root_says_abort", ",", "location", ",", "msg", ")", ":", "from", ".", ".", "utils", "import", "quickroot", "as", "QROOT", "if", "not", "Initialized", ".", "value", ":", "try", ":", "QROOT", ".", "k...
A python error handler for ROOT which maps ROOT's errors and warnings on to python's.
[ "A", "python", "error", "handler", "for", "ROOT", "which", "maps", "ROOT", "s", "errors", "and", "warnings", "on", "to", "python", "s", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/logger/roothandler.py#L42-L124
14,018
rootpy/rootpy
rootpy/context.py
preserve_current_canvas
def preserve_current_canvas(): """ Context manager which ensures that the current canvas remains the current canvas when the context is left. """ old = ROOT.gPad try: yield finally: if old: old.cd() elif ROOT.gPad: # Put things back how they we...
python
def preserve_current_canvas(): """ Context manager which ensures that the current canvas remains the current canvas when the context is left. """ old = ROOT.gPad try: yield finally: if old: old.cd() elif ROOT.gPad: # Put things back how they we...
[ "def", "preserve_current_canvas", "(", ")", ":", "old", "=", "ROOT", ".", "gPad", "try", ":", "yield", "finally", ":", "if", "old", ":", "old", ".", "cd", "(", ")", "elif", "ROOT", ".", "gPad", ":", "# Put things back how they were before.", "with", "invis...
Context manager which ensures that the current canvas remains the current canvas when the context is left.
[ "Context", "manager", "which", "ensures", "that", "the", "current", "canvas", "remains", "the", "current", "canvas", "when", "the", "context", "is", "left", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/context.py#L46-L62
14,019
rootpy/rootpy
rootpy/context.py
preserve_batch_state
def preserve_batch_state(): """ Context manager which ensures the batch state is the same on exit as it was on entry. """ with LOCK: old = ROOT.gROOT.IsBatch() try: yield finally: ROOT.gROOT.SetBatch(old)
python
def preserve_batch_state(): """ Context manager which ensures the batch state is the same on exit as it was on entry. """ with LOCK: old = ROOT.gROOT.IsBatch() try: yield finally: ROOT.gROOT.SetBatch(old)
[ "def", "preserve_batch_state", "(", ")", ":", "with", "LOCK", ":", "old", "=", "ROOT", ".", "gROOT", ".", "IsBatch", "(", ")", "try", ":", "yield", "finally", ":", "ROOT", ".", "gROOT", ".", "SetBatch", "(", "old", ")" ]
Context manager which ensures the batch state is the same on exit as it was on entry.
[ "Context", "manager", "which", "ensures", "the", "batch", "state", "is", "the", "same", "on", "exit", "as", "it", "was", "on", "entry", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/context.py#L81-L91
14,020
rootpy/rootpy
rootpy/context.py
invisible_canvas
def invisible_canvas(): """ Context manager yielding a temporary canvas drawn in batch mode, invisible to the user. Original state is restored on exit. Example use; obtain X axis object without interfering with anything:: with invisible_canvas() as c: efficiency.Draw() ...
python
def invisible_canvas(): """ Context manager yielding a temporary canvas drawn in batch mode, invisible to the user. Original state is restored on exit. Example use; obtain X axis object without interfering with anything:: with invisible_canvas() as c: efficiency.Draw() ...
[ "def", "invisible_canvas", "(", ")", ":", "with", "preserve_current_canvas", "(", ")", ":", "with", "preserve_batch_state", "(", ")", ":", "ROOT", ".", "gROOT", ".", "SetBatch", "(", ")", "c", "=", "ROOT", ".", "TCanvas", "(", ")", "try", ":", "c", "."...
Context manager yielding a temporary canvas drawn in batch mode, invisible to the user. Original state is restored on exit. Example use; obtain X axis object without interfering with anything:: with invisible_canvas() as c: efficiency.Draw() g = efficiency.GetPaintedGraph() ...
[ "Context", "manager", "yielding", "a", "temporary", "canvas", "drawn", "in", "batch", "mode", "invisible", "to", "the", "user", ".", "Original", "state", "is", "restored", "on", "exit", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/context.py#L95-L116
14,021
rootpy/rootpy
rootpy/context.py
thread_specific_tmprootdir
def thread_specific_tmprootdir(): """ Context manager which makes a thread specific gDirectory to avoid interfering with the current file. Use cases: A TTree Draw function which doesn't want to interfere with whatever gDirectory happens to be. Multi-threading where there are t...
python
def thread_specific_tmprootdir(): """ Context manager which makes a thread specific gDirectory to avoid interfering with the current file. Use cases: A TTree Draw function which doesn't want to interfere with whatever gDirectory happens to be. Multi-threading where there are t...
[ "def", "thread_specific_tmprootdir", "(", ")", ":", "with", "preserve_current_directory", "(", ")", ":", "dname", "=", "\"rootpy-tmp/thread/{0}\"", ".", "format", "(", "threading", ".", "current_thread", "(", ")", ".", "ident", ")", "d", "=", "ROOT", ".", "gRO...
Context manager which makes a thread specific gDirectory to avoid interfering with the current file. Use cases: A TTree Draw function which doesn't want to interfere with whatever gDirectory happens to be. Multi-threading where there are two threads creating objects with the s...
[ "Context", "manager", "which", "makes", "a", "thread", "specific", "gDirectory", "to", "avoid", "interfering", "with", "the", "current", "file", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/context.py#L120-L142
14,022
rootpy/rootpy
rootpy/context.py
working_directory
def working_directory(path): """ A context manager that changes the working directory to the given path, and then changes it back to its previous value on exit. """ prev_cwd = os.getcwd() os.chdir(path) try: yield finally: os.chdir(prev_cwd)
python
def working_directory(path): """ A context manager that changes the working directory to the given path, and then changes it back to its previous value on exit. """ prev_cwd = os.getcwd() os.chdir(path) try: yield finally: os.chdir(prev_cwd)
[ "def", "working_directory", "(", "path", ")", ":", "prev_cwd", "=", "os", ".", "getcwd", "(", ")", "os", ".", "chdir", "(", "path", ")", "try", ":", "yield", "finally", ":", "os", ".", "chdir", "(", "prev_cwd", ")" ]
A context manager that changes the working directory to the given path, and then changes it back to its previous value on exit.
[ "A", "context", "manager", "that", "changes", "the", "working", "directory", "to", "the", "given", "path", "and", "then", "changes", "it", "back", "to", "its", "previous", "value", "on", "exit", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/context.py#L181-L191
14,023
rootpy/rootpy
rootpy/plotting/autobinning.py
autobinning
def autobinning(data, method="freedman_diaconis"): """ This method determines the optimal binning for histogramming. Parameters ---------- data: 1D array-like Input data. method: string, one of the following: - sturges - sturges-doane - scott - ...
python
def autobinning(data, method="freedman_diaconis"): """ This method determines the optimal binning for histogramming. Parameters ---------- data: 1D array-like Input data. method: string, one of the following: - sturges - sturges-doane - scott - ...
[ "def", "autobinning", "(", "data", ",", "method", "=", "\"freedman_diaconis\"", ")", ":", "name", "=", "method", ".", "replace", "(", "\"-\"", ",", "\"_\"", ")", "try", ":", "method", "=", "getattr", "(", "BinningMethods", ",", "name", ")", "if", "not", ...
This method determines the optimal binning for histogramming. Parameters ---------- data: 1D array-like Input data. method: string, one of the following: - sturges - sturges-doane - scott - sqrt - doane - freedman-diaconis ...
[ "This", "method", "determines", "the", "optimal", "binning", "for", "histogramming", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/autobinning.py#L12-L50
14,024
rootpy/rootpy
rootpy/plotting/autobinning.py
BinningMethods.all_methods
def all_methods(cls): """ Return the names of all available binning methods """ def name(fn): return fn.__get__(cls).__name__.replace("_", "-") return sorted(name(f) for f in cls.__dict__.values() if isinstance(f, staticmethod))
python
def all_methods(cls): """ Return the names of all available binning methods """ def name(fn): return fn.__get__(cls).__name__.replace("_", "-") return sorted(name(f) for f in cls.__dict__.values() if isinstance(f, staticmethod))
[ "def", "all_methods", "(", "cls", ")", ":", "def", "name", "(", "fn", ")", ":", "return", "fn", ".", "__get__", "(", "cls", ")", ".", "__name__", ".", "replace", "(", "\"_\"", ",", "\"-\"", ")", "return", "sorted", "(", "name", "(", "f", ")", "fo...
Return the names of all available binning methods
[ "Return", "the", "names", "of", "all", "available", "binning", "methods" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/autobinning.py#L58-L65
14,025
rootpy/rootpy
rootpy/plotting/autobinning.py
BinningMethods.doane
def doane(data): """ Modified Doane modified """ from scipy.stats import skew n = len(data) sigma = np.sqrt(6. * (n - 2.) / (n + 1.) / (n + 3.)) return 1 + np.log2(n) + \ np.log2(1 + np.abs(skew(data)) / sigma)
python
def doane(data): """ Modified Doane modified """ from scipy.stats import skew n = len(data) sigma = np.sqrt(6. * (n - 2.) / (n + 1.) / (n + 3.)) return 1 + np.log2(n) + \ np.log2(1 + np.abs(skew(data)) / sigma)
[ "def", "doane", "(", "data", ")", ":", "from", "scipy", ".", "stats", "import", "skew", "n", "=", "len", "(", "data", ")", "sigma", "=", "np", ".", "sqrt", "(", "6.", "*", "(", "n", "-", "2.", ")", "/", "(", "n", "+", "1.", ")", "/", "(", ...
Modified Doane modified
[ "Modified", "Doane", "modified" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/autobinning.py#L84-L92
14,026
rootpy/rootpy
rootpy/utils/lock.py
lock
def lock(path, poll_interval=5, max_age=60): """ Aquire a file lock in a thread-safe manner that also reaps stale locks possibly left behind by processes that crashed hard. """ if max_age < 30: raise ValueError("`max_age` must be at least 30 seconds") if poll_interval < 1: raise ...
python
def lock(path, poll_interval=5, max_age=60): """ Aquire a file lock in a thread-safe manner that also reaps stale locks possibly left behind by processes that crashed hard. """ if max_age < 30: raise ValueError("`max_age` must be at least 30 seconds") if poll_interval < 1: raise ...
[ "def", "lock", "(", "path", ",", "poll_interval", "=", "5", ",", "max_age", "=", "60", ")", ":", "if", "max_age", "<", "30", ":", "raise", "ValueError", "(", "\"`max_age` must be at least 30 seconds\"", ")", "if", "poll_interval", "<", "1", ":", "raise", "...
Aquire a file lock in a thread-safe manner that also reaps stale locks possibly left behind by processes that crashed hard.
[ "Aquire", "a", "file", "lock", "in", "a", "thread", "-", "safe", "manner", "that", "also", "reaps", "stale", "locks", "possibly", "left", "behind", "by", "processes", "that", "crashed", "hard", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/utils/lock.py#L18-L71
14,027
rootpy/rootpy
rootpy/ROOT.py
proxy_global
def proxy_global(name, no_expand_macro=False, fname='func', args=()): """ Used to automatically asrootpy ROOT's thread local variables """ if no_expand_macro: # pragma: no cover # handle older ROOT versions without _ExpandMacroFunction wrapping @property def gSomething_no_func(s...
python
def proxy_global(name, no_expand_macro=False, fname='func', args=()): """ Used to automatically asrootpy ROOT's thread local variables """ if no_expand_macro: # pragma: no cover # handle older ROOT versions without _ExpandMacroFunction wrapping @property def gSomething_no_func(s...
[ "def", "proxy_global", "(", "name", ",", "no_expand_macro", "=", "False", ",", "fname", "=", "'func'", ",", "args", "=", "(", ")", ")", ":", "if", "no_expand_macro", ":", "# pragma: no cover", "# handle older ROOT versions without _ExpandMacroFunction wrapping", "@", ...
Used to automatically asrootpy ROOT's thread local variables
[ "Used", "to", "automatically", "asrootpy", "ROOT", "s", "thread", "local", "variables" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/ROOT.py#L61-L87
14,028
rootpy/rootpy
rootpy/plotting/legend.py
Legend.AddEntry
def AddEntry(self, thing, label=None, style=None): """ Add an entry to the legend. If `label` is None, `thing.GetTitle()` will be used as the label. If `style` is None, `thing.legendstyle` is used if present, otherwise `P`. """ if isinstance(thing, HistStack): ...
python
def AddEntry(self, thing, label=None, style=None): """ Add an entry to the legend. If `label` is None, `thing.GetTitle()` will be used as the label. If `style` is None, `thing.legendstyle` is used if present, otherwise `P`. """ if isinstance(thing, HistStack): ...
[ "def", "AddEntry", "(", "self", ",", "thing", ",", "label", "=", "None", ",", "style", "=", "None", ")", ":", "if", "isinstance", "(", "thing", ",", "HistStack", ")", ":", "things", "=", "thing", "else", ":", "things", "=", "[", "thing", "]", "for"...
Add an entry to the legend. If `label` is None, `thing.GetTitle()` will be used as the label. If `style` is None, `thing.legendstyle` is used if present, otherwise `P`.
[ "Add", "an", "entry", "to", "the", "legend", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/legend.py#L87-L105
14,029
rootpy/rootpy
rootpy/logger/magic.py
get_seh
def get_seh(): """ Makes a function which can be used to set the ROOT error handler with a python function and returns the existing error handler. """ if ON_RTD: return lambda x: x ErrorHandlerFunc_t = ctypes.CFUNCTYPE( None, ctypes.c_int, ctypes.c_bool, ctypes.c_char_p,...
python
def get_seh(): """ Makes a function which can be used to set the ROOT error handler with a python function and returns the existing error handler. """ if ON_RTD: return lambda x: x ErrorHandlerFunc_t = ctypes.CFUNCTYPE( None, ctypes.c_int, ctypes.c_bool, ctypes.c_char_p,...
[ "def", "get_seh", "(", ")", ":", "if", "ON_RTD", ":", "return", "lambda", "x", ":", "x", "ErrorHandlerFunc_t", "=", "ctypes", ".", "CFUNCTYPE", "(", "None", ",", "ctypes", ".", "c_int", ",", "ctypes", ".", "c_bool", ",", "ctypes", ".", "c_char_p", ",",...
Makes a function which can be used to set the ROOT error handler with a python function and returns the existing error handler.
[ "Makes", "a", "function", "which", "can", "be", "used", "to", "set", "the", "ROOT", "error", "handler", "with", "a", "python", "function", "and", "returns", "the", "existing", "error", "handler", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/logger/magic.py#L85-L129
14,030
rootpy/rootpy
rootpy/logger/magic.py
get_f_code_idx
def get_f_code_idx(): """ How many pointers into PyFrame is the ``f_code`` variable? """ frame = sys._getframe() frame_ptr = id(frame) LARGE_ENOUGH = 20 # Look through the frame object until we find the f_tstate variable, whose # value we know from above. ptrs = [ctypes.c_voidp.fro...
python
def get_f_code_idx(): """ How many pointers into PyFrame is the ``f_code`` variable? """ frame = sys._getframe() frame_ptr = id(frame) LARGE_ENOUGH = 20 # Look through the frame object until we find the f_tstate variable, whose # value we know from above. ptrs = [ctypes.c_voidp.fro...
[ "def", "get_f_code_idx", "(", ")", ":", "frame", "=", "sys", ".", "_getframe", "(", ")", "frame_ptr", "=", "id", "(", "frame", ")", "LARGE_ENOUGH", "=", "20", "# Look through the frame object until we find the f_tstate variable, whose", "# value we know from above.", "p...
How many pointers into PyFrame is the ``f_code`` variable?
[ "How", "many", "pointers", "into", "PyFrame", "is", "the", "f_code", "variable?" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/logger/magic.py#L138-L161
14,031
rootpy/rootpy
rootpy/logger/magic.py
get_frame_pointers
def get_frame_pointers(frame=None): """ Obtain writable pointers to ``frame.f_trace`` and ``frame.f_lineno``. Very dangerous. Unlikely to be portable between python implementations. This is hard in general because the ``PyFrameObject`` can have a variable size depending on the build configuration....
python
def get_frame_pointers(frame=None): """ Obtain writable pointers to ``frame.f_trace`` and ``frame.f_lineno``. Very dangerous. Unlikely to be portable between python implementations. This is hard in general because the ``PyFrameObject`` can have a variable size depending on the build configuration....
[ "def", "get_frame_pointers", "(", "frame", "=", "None", ")", ":", "if", "frame", "is", "None", ":", "frame", "=", "sys", ".", "_getframe", "(", "2", ")", "frame", "=", "id", "(", "frame", ")", "# http://hg.python.org/cpython/file/3aa530c2db06/Include/frameobject...
Obtain writable pointers to ``frame.f_trace`` and ``frame.f_lineno``. Very dangerous. Unlikely to be portable between python implementations. This is hard in general because the ``PyFrameObject`` can have a variable size depending on the build configuration. We can get it reliably because we can deter...
[ "Obtain", "writable", "pointers", "to", "frame", ".", "f_trace", "and", "frame", ".", "f_lineno", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/logger/magic.py#L166-L193
14,032
rootpy/rootpy
rootpy/logger/magic.py
set_linetrace_on_frame
def set_linetrace_on_frame(f, localtrace=None): """ Non-portable function to modify linetracing. Remember to enable global tracing with :py:func:`sys.settrace`, otherwise no effect! """ traceptr, _, _ = get_frame_pointers(f) if localtrace is not None: # Need to incref to avoid the f...
python
def set_linetrace_on_frame(f, localtrace=None): """ Non-portable function to modify linetracing. Remember to enable global tracing with :py:func:`sys.settrace`, otherwise no effect! """ traceptr, _, _ = get_frame_pointers(f) if localtrace is not None: # Need to incref to avoid the f...
[ "def", "set_linetrace_on_frame", "(", "f", ",", "localtrace", "=", "None", ")", ":", "traceptr", ",", "_", ",", "_", "=", "get_frame_pointers", "(", "f", ")", "if", "localtrace", "is", "not", "None", ":", "# Need to incref to avoid the frame causing a double-delet...
Non-portable function to modify linetracing. Remember to enable global tracing with :py:func:`sys.settrace`, otherwise no effect!
[ "Non", "-", "portable", "function", "to", "modify", "linetracing", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/logger/magic.py#L196-L212
14,033
rootpy/rootpy
rootpy/logger/magic.py
re_execute_with_exception
def re_execute_with_exception(frame, exception, traceback): """ Dark magic. Causes ``frame`` to raise an exception at the current location with ``traceback`` appended to it. Note that since the line tracer is raising an exception, the interpreter disables the global trace, so it's not possible to r...
python
def re_execute_with_exception(frame, exception, traceback): """ Dark magic. Causes ``frame`` to raise an exception at the current location with ``traceback`` appended to it. Note that since the line tracer is raising an exception, the interpreter disables the global trace, so it's not possible to r...
[ "def", "re_execute_with_exception", "(", "frame", ",", "exception", ",", "traceback", ")", ":", "if", "sys", ".", "gettrace", "(", ")", "==", "globaltrace", ":", "# If our trace handler is already installed, that means that this", "# function has been called twice before the ...
Dark magic. Causes ``frame`` to raise an exception at the current location with ``traceback`` appended to it. Note that since the line tracer is raising an exception, the interpreter disables the global trace, so it's not possible to restore the previous tracing conditions.
[ "Dark", "magic", ".", "Causes", "frame", "to", "raise", "an", "exception", "at", "the", "current", "location", "with", "traceback", "appended", "to", "it", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/logger/magic.py#L219-L269
14,034
rootpy/rootpy
rootpy/logger/magic.py
_inject_jump
def _inject_jump(self, where, dest): """ Monkeypatch bytecode at ``where`` to force it to jump to ``dest``. Returns function which puts things back to how they were. """ # We're about to do dangerous things to a function's code content. # We can't make a lock to prevent the interpreter from usi...
python
def _inject_jump(self, where, dest): """ Monkeypatch bytecode at ``where`` to force it to jump to ``dest``. Returns function which puts things back to how they were. """ # We're about to do dangerous things to a function's code content. # We can't make a lock to prevent the interpreter from usi...
[ "def", "_inject_jump", "(", "self", ",", "where", ",", "dest", ")", ":", "# We're about to do dangerous things to a function's code content.", "# We can't make a lock to prevent the interpreter from using those", "# bytes, so the best we can do is to set the check interval to be high", "# ...
Monkeypatch bytecode at ``where`` to force it to jump to ``dest``. Returns function which puts things back to how they were.
[ "Monkeypatch", "bytecode", "at", "where", "to", "force", "it", "to", "jump", "to", "dest", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/logger/magic.py#L272-L313
14,035
rootpy/rootpy
rootpy/tree/chain.py
BaseTreeChain.Draw
def Draw(self, *args, **kwargs): """ Loop over subfiles, draw each, and sum the output into a single histogram. """ self.reset() output = None while self._rollover(): if output is None: # Make our own copy of the drawn histogram ...
python
def Draw(self, *args, **kwargs): """ Loop over subfiles, draw each, and sum the output into a single histogram. """ self.reset() output = None while self._rollover(): if output is None: # Make our own copy of the drawn histogram ...
[ "def", "Draw", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "reset", "(", ")", "output", "=", "None", "while", "self", ".", "_rollover", "(", ")", ":", "if", "output", "is", "None", ":", "# Make our own copy of the d...
Loop over subfiles, draw each, and sum the output into a single histogram.
[ "Loop", "over", "subfiles", "draw", "each", "and", "sum", "the", "output", "into", "a", "single", "histogram", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/chain.py#L105-L128
14,036
rootpy/rootpy
rootpy/interactive/console.py
interact_plain
def interact_plain(header=UP_LINE, local_ns=None, module=None, dummy=None, stack_depth=1, global_ns=None): """ Create an interactive python console """ frame = sys._getframe(stack_depth) variables = {} if local_ns is not None: variables.update(loca...
python
def interact_plain(header=UP_LINE, local_ns=None, module=None, dummy=None, stack_depth=1, global_ns=None): """ Create an interactive python console """ frame = sys._getframe(stack_depth) variables = {} if local_ns is not None: variables.update(loca...
[ "def", "interact_plain", "(", "header", "=", "UP_LINE", ",", "local_ns", "=", "None", ",", "module", "=", "None", ",", "dummy", "=", "None", ",", "stack_depth", "=", "1", ",", "global_ns", "=", "None", ")", ":", "frame", "=", "sys", ".", "_getframe", ...
Create an interactive python console
[ "Create", "an", "interactive", "python", "console" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/interactive/console.py#L33-L54
14,037
rootpy/rootpy
rootpy/plotting/root2matplotlib.py
hist
def hist(hists, stacked=True, reverse=False, xpadding=0, ypadding=.1, yerror_in_padding=True, logy=None, snap=True, axes=None, **kwargs): """ Make a matplotlib hist plot from a ROOT histogram, stack or list of histograms. Parameter...
python
def hist(hists, stacked=True, reverse=False, xpadding=0, ypadding=.1, yerror_in_padding=True, logy=None, snap=True, axes=None, **kwargs): """ Make a matplotlib hist plot from a ROOT histogram, stack or list of histograms. Parameter...
[ "def", "hist", "(", "hists", ",", "stacked", "=", "True", ",", "reverse", "=", "False", ",", "xpadding", "=", "0", ",", "ypadding", "=", ".1", ",", "yerror_in_padding", "=", "True", ",", "logy", "=", "None", ",", "snap", "=", "True", ",", "axes", "...
Make a matplotlib hist plot from a ROOT histogram, stack or list of histograms. Parameters ---------- hists : Hist, list of Hist, HistStack The histogram(s) to be plotted stacked : bool, optional (default=True) If True then stack the histograms with the first histogram on the ...
[ "Make", "a", "matplotlib", "hist", "plot", "from", "a", "ROOT", "histogram", "stack", "or", "list", "of", "histograms", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/root2matplotlib.py#L141-L265
14,038
rootpy/rootpy
rootpy/plotting/root2matplotlib.py
errorbar
def errorbar(hists, xerr=True, yerr=True, xpadding=0, ypadding=.1, xerror_in_padding=True, yerror_in_padding=True, emptybins=True, snap=True, axes=None, **kwargs): """ Make a matplotlib errorbar plot from a R...
python
def errorbar(hists, xerr=True, yerr=True, xpadding=0, ypadding=.1, xerror_in_padding=True, yerror_in_padding=True, emptybins=True, snap=True, axes=None, **kwargs): """ Make a matplotlib errorbar plot from a R...
[ "def", "errorbar", "(", "hists", ",", "xerr", "=", "True", ",", "yerr", "=", "True", ",", "xpadding", "=", "0", ",", "ypadding", "=", ".1", ",", "xerror_in_padding", "=", "True", ",", "yerror_in_padding", "=", "True", ",", "emptybins", "=", "True", ","...
Make a matplotlib errorbar plot from a ROOT histogram or graph or list of histograms and graphs. Parameters ---------- hists : Hist, Graph or list of Hist and Graph The histogram(s) and/or Graph(s) to be plotted xerr : bool, optional (default=True) If True, x error bars will be di...
[ "Make", "a", "matplotlib", "errorbar", "plot", "from", "a", "ROOT", "histogram", "or", "graph", "or", "list", "of", "histograms", "and", "graphs", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/root2matplotlib.py#L481-L577
14,039
rootpy/rootpy
rootpy/plotting/root2matplotlib.py
step
def step(h, logy=None, axes=None, **kwargs): """ Make a matplotlib step plot from a ROOT histogram. Parameters ---------- h : Hist A rootpy Hist logy : bool, optional (default=None) If True then clip the y range between 1E-300 and 1E300. If None (the default) then auto...
python
def step(h, logy=None, axes=None, **kwargs): """ Make a matplotlib step plot from a ROOT histogram. Parameters ---------- h : Hist A rootpy Hist logy : bool, optional (default=None) If True then clip the y range between 1E-300 and 1E300. If None (the default) then auto...
[ "def", "step", "(", "h", ",", "logy", "=", "None", ",", "axes", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "axes", "is", "None", ":", "axes", "=", "plt", ".", "gca", "(", ")", "if", "logy", "is", "None", ":", "logy", "=", "axes", ...
Make a matplotlib step plot from a ROOT histogram. Parameters ---------- h : Hist A rootpy Hist logy : bool, optional (default=None) If True then clip the y range between 1E-300 and 1E300. If None (the default) then automatically determine if the axes are log-scale and...
[ "Make", "a", "matplotlib", "step", "plot", "from", "a", "ROOT", "histogram", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/root2matplotlib.py#L603-L641
14,040
rootpy/rootpy
rootpy/plotting/root2matplotlib.py
fill_between
def fill_between(a, b, logy=None, axes=None, **kwargs): """ Fill the region between two histograms or graphs. Parameters ---------- a : Hist A rootpy Hist b : Hist A rootpy Hist logy : bool, optional (default=None) If True then clip the region between 1E-300 and 1...
python
def fill_between(a, b, logy=None, axes=None, **kwargs): """ Fill the region between two histograms or graphs. Parameters ---------- a : Hist A rootpy Hist b : Hist A rootpy Hist logy : bool, optional (default=None) If True then clip the region between 1E-300 and 1...
[ "def", "fill_between", "(", "a", ",", "b", ",", "logy", "=", "None", ",", "axes", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "axes", "is", "None", ":", "axes", "=", "plt", ".", "gca", "(", ")", "if", "logy", "is", "None", ":", "log...
Fill the region between two histograms or graphs. Parameters ---------- a : Hist A rootpy Hist b : Hist A rootpy Hist logy : bool, optional (default=None) If True then clip the region between 1E-300 and 1E300. If None (the default) then automatically determine if ...
[ "Fill", "the", "region", "between", "two", "histograms", "or", "graphs", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/root2matplotlib.py#L644-L698
14,041
rootpy/rootpy
rootpy/plotting/root2matplotlib.py
hist2d
def hist2d(h, axes=None, colorbar=False, **kwargs): """ Draw a 2D matplotlib histogram plot from a 2D ROOT histogram. Parameters ---------- h : Hist2D A rootpy Hist2D axes : matplotlib Axes instance, optional (default=None) The axes to plot on. If None then use the global curr...
python
def hist2d(h, axes=None, colorbar=False, **kwargs): """ Draw a 2D matplotlib histogram plot from a 2D ROOT histogram. Parameters ---------- h : Hist2D A rootpy Hist2D axes : matplotlib Axes instance, optional (default=None) The axes to plot on. If None then use the global curr...
[ "def", "hist2d", "(", "h", ",", "axes", "=", "None", ",", "colorbar", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "axes", "is", "None", ":", "axes", "=", "plt", ".", "gca", "(", ")", "X", ",", "Y", "=", "np", ".", "meshgrid", "(", ...
Draw a 2D matplotlib histogram plot from a 2D ROOT histogram. Parameters ---------- h : Hist2D A rootpy Hist2D axes : matplotlib Axes instance, optional (default=None) The axes to plot on. If None then use the global current axes. colorbar : Boolean, optional (default=False) ...
[ "Draw", "a", "2D", "matplotlib", "histogram", "plot", "from", "a", "2D", "ROOT", "histogram", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/root2matplotlib.py#L701-L740
14,042
rootpy/rootpy
rootpy/plotting/root2matplotlib.py
imshow
def imshow(h, axes=None, colorbar=False, **kwargs): """ Draw a matplotlib imshow plot from a 2D ROOT histogram. Parameters ---------- h : Hist2D A rootpy Hist2D axes : matplotlib Axes instance, optional (default=None) The axes to plot on. If None then use the global current ax...
python
def imshow(h, axes=None, colorbar=False, **kwargs): """ Draw a matplotlib imshow plot from a 2D ROOT histogram. Parameters ---------- h : Hist2D A rootpy Hist2D axes : matplotlib Axes instance, optional (default=None) The axes to plot on. If None then use the global current ax...
[ "def", "imshow", "(", "h", ",", "axes", "=", "None", ",", "colorbar", "=", "False", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'aspect'", ",", "'auto'", ")", "if", "axes", "is", "None", ":", "axes", "=", "plt", ".", "gc...
Draw a matplotlib imshow plot from a 2D ROOT histogram. Parameters ---------- h : Hist2D A rootpy Hist2D axes : matplotlib Axes instance, optional (default=None) The axes to plot on. If None then use the global current axes. colorbar : Boolean, optional (default=False) If...
[ "Draw", "a", "matplotlib", "imshow", "plot", "from", "a", "2D", "ROOT", "histogram", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/root2matplotlib.py#L743-L785
14,043
rootpy/rootpy
rootpy/plotting/root2matplotlib.py
contour
def contour(h, axes=None, zoom=None, label_contour=False, **kwargs): """ Draw a matplotlib contour plot from a 2D ROOT histogram. Parameters ---------- h : Hist2D A rootpy Hist2D axes : matplotlib Axes instance, optional (default=None) The axes to plot on. If None then use the...
python
def contour(h, axes=None, zoom=None, label_contour=False, **kwargs): """ Draw a matplotlib contour plot from a 2D ROOT histogram. Parameters ---------- h : Hist2D A rootpy Hist2D axes : matplotlib Axes instance, optional (default=None) The axes to plot on. If None then use the...
[ "def", "contour", "(", "h", ",", "axes", "=", "None", ",", "zoom", "=", "None", ",", "label_contour", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "axes", "is", "None", ":", "axes", "=", "plt", ".", "gca", "(", ")", "x", "=", "np", ...
Draw a matplotlib contour plot from a 2D ROOT histogram. Parameters ---------- h : Hist2D A rootpy Hist2D axes : matplotlib Axes instance, optional (default=None) The axes to plot on. If None then use the global current axes. zoom : float or sequence, optional (default=None) ...
[ "Draw", "a", "matplotlib", "contour", "plot", "from", "a", "2D", "ROOT", "histogram", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/root2matplotlib.py#L788-L838
14,044
rootpy/rootpy
rootpy/tree/tree.py
BaseTree._post_init
def _post_init(self): """ The standard rootpy _post_init method that is used to initialize both new Trees and Trees retrieved from a File. """ if not hasattr(self, '_buffer'): # only set _buffer if model was not specified in the __init__ self._buffer = Tre...
python
def _post_init(self): """ The standard rootpy _post_init method that is used to initialize both new Trees and Trees retrieved from a File. """ if not hasattr(self, '_buffer'): # only set _buffer if model was not specified in the __init__ self._buffer = Tre...
[ "def", "_post_init", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_buffer'", ")", ":", "# only set _buffer if model was not specified in the __init__", "self", ".", "_buffer", "=", "TreeBuffer", "(", ")", "self", ".", "read_branches_on_demand",...
The standard rootpy _post_init method that is used to initialize both new Trees and Trees retrieved from a File.
[ "The", "standard", "rootpy", "_post_init", "method", "that", "is", "used", "to", "initialize", "both", "new", "Trees", "and", "Trees", "retrieved", "from", "a", "File", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/tree.py#L49-L62
14,045
rootpy/rootpy
rootpy/tree/tree.py
BaseTree.always_read
def always_read(self, branches): """ Always read these branches, even when in caching mode. Maybe you have caching enabled and there are branches you want to be updated for each entry even though you never access them directly. This is useful if you are iterating over an input tr...
python
def always_read(self, branches): """ Always read these branches, even when in caching mode. Maybe you have caching enabled and there are branches you want to be updated for each entry even though you never access them directly. This is useful if you are iterating over an input tr...
[ "def", "always_read", "(", "self", ",", "branches", ")", ":", "if", "type", "(", "branches", ")", "not", "in", "(", "list", ",", "tuple", ")", ":", "raise", "TypeError", "(", "\"branches must be a list or tuple\"", ")", "self", ".", "_always_read", "=", "b...
Always read these branches, even when in caching mode. Maybe you have caching enabled and there are branches you want to be updated for each entry even though you never access them directly. This is useful if you are iterating over an input tree and writing to an output tree sharing the ...
[ "Always", "read", "these", "branches", "even", "when", "in", "caching", "mode", ".", "Maybe", "you", "have", "caching", "enabled", "and", "there", "are", "branches", "you", "want", "to", "be", "updated", "for", "each", "entry", "even", "though", "you", "ne...
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/tree.py#L64-L82
14,046
rootpy/rootpy
rootpy/tree/tree.py
BaseTree.branch_type
def branch_type(cls, branch): """ Return the string representation for the type of a branch """ typename = branch.GetClassName() if not typename: leaf = branch.GetListOfLeaves()[0] typename = leaf.GetTypeName() # check if leaf has multiple elem...
python
def branch_type(cls, branch): """ Return the string representation for the type of a branch """ typename = branch.GetClassName() if not typename: leaf = branch.GetListOfLeaves()[0] typename = leaf.GetTypeName() # check if leaf has multiple elem...
[ "def", "branch_type", "(", "cls", ",", "branch", ")", ":", "typename", "=", "branch", ".", "GetClassName", "(", ")", "if", "not", "typename", ":", "leaf", "=", "branch", ".", "GetListOfLeaves", "(", ")", "[", "0", "]", "typename", "=", "leaf", ".", "...
Return the string representation for the type of a branch
[ "Return", "the", "string", "representation", "for", "the", "type", "of", "a", "branch" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/tree.py#L85-L101
14,047
rootpy/rootpy
rootpy/tree/tree.py
BaseTree.create_buffer
def create_buffer(self, ignore_unsupported=False): """ Create this tree's TreeBuffer """ bufferdict = OrderedDict() for branch in self.iterbranches(): # only include activated branches if not self.GetBranchStatus(branch.GetName()): continue...
python
def create_buffer(self, ignore_unsupported=False): """ Create this tree's TreeBuffer """ bufferdict = OrderedDict() for branch in self.iterbranches(): # only include activated branches if not self.GetBranchStatus(branch.GetName()): continue...
[ "def", "create_buffer", "(", "self", ",", "ignore_unsupported", "=", "False", ")", ":", "bufferdict", "=", "OrderedDict", "(", ")", "for", "branch", "in", "self", ".", "iterbranches", "(", ")", ":", "# only include activated branches", "if", "not", "self", "."...
Create this tree's TreeBuffer
[ "Create", "this", "tree", "s", "TreeBuffer" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/tree.py#L111-L127
14,048
rootpy/rootpy
rootpy/tree/tree.py
BaseTree.create_branches
def create_branches(self, branches): """ Create branches from a TreeBuffer or dict mapping names to type names Parameters ---------- branches : TreeBuffer or dict """ if not isinstance(branches, TreeBuffer): branches = TreeBuffer(branches) sel...
python
def create_branches(self, branches): """ Create branches from a TreeBuffer or dict mapping names to type names Parameters ---------- branches : TreeBuffer or dict """ if not isinstance(branches, TreeBuffer): branches = TreeBuffer(branches) sel...
[ "def", "create_branches", "(", "self", ",", "branches", ")", ":", "if", "not", "isinstance", "(", "branches", ",", "TreeBuffer", ")", ":", "branches", "=", "TreeBuffer", "(", "branches", ")", "self", ".", "set_buffer", "(", "branches", ",", "create_branches"...
Create branches from a TreeBuffer or dict mapping names to type names Parameters ---------- branches : TreeBuffer or dict
[ "Create", "branches", "from", "a", "TreeBuffer", "or", "dict", "mapping", "names", "to", "type", "names" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/tree.py#L129-L139
14,049
rootpy/rootpy
rootpy/tree/tree.py
BaseTree.update_buffer
def update_buffer(self, treebuffer, transfer_objects=False): """ Merge items from a TreeBuffer into this Tree's TreeBuffer Parameters ---------- buffer : rootpy.tree.buffer.TreeBuffer The TreeBuffer to merge into this Tree's buffer transfer_objects : bool, o...
python
def update_buffer(self, treebuffer, transfer_objects=False): """ Merge items from a TreeBuffer into this Tree's TreeBuffer Parameters ---------- buffer : rootpy.tree.buffer.TreeBuffer The TreeBuffer to merge into this Tree's buffer transfer_objects : bool, o...
[ "def", "update_buffer", "(", "self", ",", "treebuffer", ",", "transfer_objects", "=", "False", ")", ":", "self", ".", "_buffer", ".", "update", "(", "treebuffer", ")", "if", "transfer_objects", ":", "self", ".", "_buffer", ".", "set_objects", "(", "treebuffe...
Merge items from a TreeBuffer into this Tree's TreeBuffer Parameters ---------- buffer : rootpy.tree.buffer.TreeBuffer The TreeBuffer to merge into this Tree's buffer transfer_objects : bool, optional (default=False) If True then all objects and collections on t...
[ "Merge", "items", "from", "a", "TreeBuffer", "into", "this", "Tree", "s", "TreeBuffer" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/tree.py#L141-L156
14,050
rootpy/rootpy
rootpy/tree/tree.py
BaseTree.set_buffer
def set_buffer(self, treebuffer, branches=None, ignore_branches=None, create_branches=False, visible=True, ignore_missing=False, ignore_duplicates=False, transfer_objects=False): ...
python
def set_buffer(self, treebuffer, branches=None, ignore_branches=None, create_branches=False, visible=True, ignore_missing=False, ignore_duplicates=False, transfer_objects=False): ...
[ "def", "set_buffer", "(", "self", ",", "treebuffer", ",", "branches", "=", "None", ",", "ignore_branches", "=", "None", ",", "create_branches", "=", "False", ",", "visible", "=", "True", ",", "ignore_missing", "=", "False", ",", "ignore_duplicates", "=", "Fa...
Set the Tree buffer Parameters ---------- treebuffer : rootpy.tree.buffer.TreeBuffer a TreeBuffer branches : list, optional (default=None) only include these branches from the TreeBuffer ignore_branches : list, optional (default=None) ignore...
[ "Set", "the", "Tree", "buffer" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/tree.py#L158-L255
14,051
rootpy/rootpy
rootpy/tree/tree.py
BaseTree.glob
def glob(self, patterns, exclude=None): """ Return a list of branch names that match ``pattern``. Exclude all matched branch names which also match a pattern in ``exclude``. ``exclude`` may be a string or list of strings. Parameters ---------- patterns: str or li...
python
def glob(self, patterns, exclude=None): """ Return a list of branch names that match ``pattern``. Exclude all matched branch names which also match a pattern in ``exclude``. ``exclude`` may be a string or list of strings. Parameters ---------- patterns: str or li...
[ "def", "glob", "(", "self", ",", "patterns", ",", "exclude", "=", "None", ")", ":", "if", "isinstance", "(", "patterns", ",", "string_types", ")", ":", "patterns", "=", "[", "patterns", "]", "if", "isinstance", "(", "exclude", ",", "string_types", ")", ...
Return a list of branch names that match ``pattern``. Exclude all matched branch names which also match a pattern in ``exclude``. ``exclude`` may be a string or list of strings. Parameters ---------- patterns: str or list branches are matched against this pattern or ...
[ "Return", "a", "list", "of", "branch", "names", "that", "match", "pattern", ".", "Exclude", "all", "matched", "branch", "names", "which", "also", "match", "a", "pattern", "in", "exclude", ".", "exclude", "may", "be", "a", "string", "or", "list", "of", "s...
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/tree.py#L337-L369
14,052
rootpy/rootpy
rootpy/tree/tree.py
BaseTree.CopyTree
def CopyTree(self, selection, *args, **kwargs): """ Copy the tree while supporting a rootpy.tree.cut.Cut selection in addition to a simple string. """ return super(BaseTree, self).CopyTree(str(selection), *args, **kwargs)
python
def CopyTree(self, selection, *args, **kwargs): """ Copy the tree while supporting a rootpy.tree.cut.Cut selection in addition to a simple string. """ return super(BaseTree, self).CopyTree(str(selection), *args, **kwargs)
[ "def", "CopyTree", "(", "self", ",", "selection", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "BaseTree", ",", "self", ")", ".", "CopyTree", "(", "str", "(", "selection", ")", ",", "*", "args", ",", "*", "*", "kwa...
Copy the tree while supporting a rootpy.tree.cut.Cut selection in addition to a simple string.
[ "Copy", "the", "tree", "while", "supporting", "a", "rootpy", ".", "tree", ".", "cut", ".", "Cut", "selection", "in", "addition", "to", "a", "simple", "string", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/tree.py#L656-L661
14,053
rootpy/rootpy
rootpy/tree/tree.py
BaseTree.to_array
def to_array(self, *args, **kwargs): """ Convert this tree into a NumPy structured array """ from root_numpy import tree2array return tree2array(self, *args, **kwargs)
python
def to_array(self, *args, **kwargs): """ Convert this tree into a NumPy structured array """ from root_numpy import tree2array return tree2array(self, *args, **kwargs)
[ "def", "to_array", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", "root_numpy", "import", "tree2array", "return", "tree2array", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Convert this tree into a NumPy structured array
[ "Convert", "this", "tree", "into", "a", "NumPy", "structured", "array" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/tree.py#L858-L863
14,054
rootpy/rootpy
rootpy/roosh.py
color_key
def color_key(tkey): """ Function which returns a colorized TKey name given its type """ name = tkey.GetName() classname = tkey.GetClassName() for class_regex, color in _COLOR_MATCHER: if class_regex.match(classname): return colored(name, color=color) return name
python
def color_key(tkey): """ Function which returns a colorized TKey name given its type """ name = tkey.GetName() classname = tkey.GetClassName() for class_regex, color in _COLOR_MATCHER: if class_regex.match(classname): return colored(name, color=color) return name
[ "def", "color_key", "(", "tkey", ")", ":", "name", "=", "tkey", ".", "GetName", "(", ")", "classname", "=", "tkey", ".", "GetClassName", "(", ")", "for", "class_regex", ",", "color", "in", "_COLOR_MATCHER", ":", "if", "class_regex", ".", "match", "(", ...
Function which returns a colorized TKey name given its type
[ "Function", "which", "returns", "a", "colorized", "TKey", "name", "given", "its", "type" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/roosh.py#L49-L58
14,055
rootpy/rootpy
rootpy/plotting/contrib/plot_corrcoef_matrix.py
cov
def cov(m, y=None, rowvar=1, bias=0, ddof=None, weights=None, repeat_weights=0): """ Estimate a covariance matrix, given data. Covariance indicates the level to which two variables vary together. If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, then the covariance matrix elem...
python
def cov(m, y=None, rowvar=1, bias=0, ddof=None, weights=None, repeat_weights=0): """ Estimate a covariance matrix, given data. Covariance indicates the level to which two variables vary together. If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, then the covariance matrix elem...
[ "def", "cov", "(", "m", ",", "y", "=", "None", ",", "rowvar", "=", "1", ",", "bias", "=", "0", ",", "ddof", "=", "None", ",", "weights", "=", "None", ",", "repeat_weights", "=", "0", ")", ":", "import", "numpy", "as", "np", "# Check inputs", "if"...
Estimate a covariance matrix, given data. Covariance indicates the level to which two variables vary together. If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, then the covariance matrix element :math:`C_{ij}` is the covariance of :math:`x_i` and :math:`x_j`. The element :math:`C...
[ "Estimate", "a", "covariance", "matrix", "given", "data", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/contrib/plot_corrcoef_matrix.py#L136-L285
14,056
rootpy/rootpy
rootpy/plotting/contrib/plot_corrcoef_matrix.py
corrcoef
def corrcoef(x, y=None, rowvar=1, bias=0, ddof=None, weights=None, repeat_weights=0): """ Return correlation coefficients. Please refer to the documentation for `cov` for more detail. The relationship between the correlation coefficient matrix, `P`, and the covariance matrix, `C`, is ...
python
def corrcoef(x, y=None, rowvar=1, bias=0, ddof=None, weights=None, repeat_weights=0): """ Return correlation coefficients. Please refer to the documentation for `cov` for more detail. The relationship between the correlation coefficient matrix, `P`, and the covariance matrix, `C`, is ...
[ "def", "corrcoef", "(", "x", ",", "y", "=", "None", ",", "rowvar", "=", "1", ",", "bias", "=", "0", ",", "ddof", "=", "None", ",", "weights", "=", "None", ",", "repeat_weights", "=", "0", ")", ":", "import", "numpy", "as", "np", "c", "=", "cov"...
Return correlation coefficients. Please refer to the documentation for `cov` for more detail. The relationship between the correlation coefficient matrix, `P`, and the covariance matrix, `C`, is .. math:: P_{ij} = \\frac{ C_{ij} } { \\sqrt{ C_{ii} * C_{jj} } } The values of `P` are between -1 an...
[ "Return", "correlation", "coefficients", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/contrib/plot_corrcoef_matrix.py#L288-L355
14,057
rootpy/rootpy
rootpy/tree/cut.py
Cut.safe
def safe(self, parentheses=True): """ Returns a string representation with special characters replaced by safer characters for use in file names. """ if not self: return "" string = str(self) string = string.replace("**", "_pow_") string = stri...
python
def safe(self, parentheses=True): """ Returns a string representation with special characters replaced by safer characters for use in file names. """ if not self: return "" string = str(self) string = string.replace("**", "_pow_") string = stri...
[ "def", "safe", "(", "self", ",", "parentheses", "=", "True", ")", ":", "if", "not", "self", ":", "return", "\"\"", "string", "=", "str", "(", "self", ")", "string", "=", "string", ".", "replace", "(", "\"**\"", ",", "\"_pow_\"", ")", "string", "=", ...
Returns a string representation with special characters replaced by safer characters for use in file names.
[ "Returns", "a", "string", "representation", "with", "special", "characters", "replaced", "by", "safer", "characters", "for", "use", "in", "file", "names", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/cut.py#L222-L248
14,058
rootpy/rootpy
rootpy/tree/cut.py
Cut.latex
def latex(self): """ Returns a string representation for use in LaTeX """ if not self: return "" s = str(self) s = s.replace("==", " = ") s = s.replace("<=", " \leq ") s = s.replace(">=", " \geq ") s = s.replace("&&", r" \text{ and } ")...
python
def latex(self): """ Returns a string representation for use in LaTeX """ if not self: return "" s = str(self) s = s.replace("==", " = ") s = s.replace("<=", " \leq ") s = s.replace(">=", " \geq ") s = s.replace("&&", r" \text{ and } ")...
[ "def", "latex", "(", "self", ")", ":", "if", "not", "self", ":", "return", "\"\"", "s", "=", "str", "(", "self", ")", "s", "=", "s", ".", "replace", "(", "\"==\"", ",", "\" = \"", ")", "s", "=", "s", ".", "replace", "(", "\"<=\"", ",", "\" \\le...
Returns a string representation for use in LaTeX
[ "Returns", "a", "string", "representation", "for", "use", "in", "LaTeX" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/cut.py#L250-L262
14,059
rootpy/rootpy
rootpy/tree/cut.py
Cut.replace
def replace(self, name, newname): """ Replace all occurrences of name with newname """ if not re.match("[a-zA-Z]\w*", name): return None if not re.match("[a-zA-Z]\w*", newname): return None def _replace(match): return match.group(0).re...
python
def replace(self, name, newname): """ Replace all occurrences of name with newname """ if not re.match("[a-zA-Z]\w*", name): return None if not re.match("[a-zA-Z]\w*", newname): return None def _replace(match): return match.group(0).re...
[ "def", "replace", "(", "self", ",", "name", ",", "newname", ")", ":", "if", "not", "re", ".", "match", "(", "\"[a-zA-Z]\\w*\"", ",", "name", ")", ":", "return", "None", "if", "not", "re", ".", "match", "(", "\"[a-zA-Z]\\w*\"", ",", "newname", ")", ":...
Replace all occurrences of name with newname
[ "Replace", "all", "occurrences", "of", "name", "with", "newname" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/cut.py#L273-L287
14,060
rootpy/rootpy
docs/sphinxext/ipython_directive.py
EmbeddedSphinxShell.save_image
def save_image(self, image_file): """ Saves the image file to disk. """ self.ensure_pyplot() command = 'plt.gcf().savefig("%s")'%image_file #print 'SAVEFIG', command # dbg self.process_input_line('bookmark ipy_thisdir', store_history=False) self.process_i...
python
def save_image(self, image_file): """ Saves the image file to disk. """ self.ensure_pyplot() command = 'plt.gcf().savefig("%s")'%image_file #print 'SAVEFIG', command # dbg self.process_input_line('bookmark ipy_thisdir', store_history=False) self.process_i...
[ "def", "save_image", "(", "self", ",", "image_file", ")", ":", "self", ".", "ensure_pyplot", "(", ")", "command", "=", "'plt.gcf().savefig(\"%s\")'", "%", "image_file", "#print 'SAVEFIG', command # dbg", "self", ".", "process_input_line", "(", "'bookmark ipy_thisdir'",...
Saves the image file to disk.
[ "Saves", "the", "image", "file", "to", "disk", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/docs/sphinxext/ipython_directive.py#L393-L405
14,061
rootpy/rootpy
rootpy/plotting/base.py
Plottable.decorate
def decorate(self, other=None, **kwargs): """ Apply style options to a Plottable object. Returns a reference to self. """ if 'color' in kwargs: incompatible = [] for othercolor in ('linecolor', 'fillcolor', 'markercolor'): if othercolor in...
python
def decorate(self, other=None, **kwargs): """ Apply style options to a Plottable object. Returns a reference to self. """ if 'color' in kwargs: incompatible = [] for othercolor in ('linecolor', 'fillcolor', 'markercolor'): if othercolor in...
[ "def", "decorate", "(", "self", ",", "other", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "'color'", "in", "kwargs", ":", "incompatible", "=", "[", "]", "for", "othercolor", "in", "(", "'linecolor'", ",", "'fillcolor'", ",", "'markercolor'", ...
Apply style options to a Plottable object. Returns a reference to self.
[ "Apply", "style", "options", "to", "a", "Plottable", "object", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/base.py#L174-L231
14,062
rootpy/rootpy
rootpy/tree/treeobject.py
TreeCollection.getitem
def getitem(self, index): """ direct access without going through self.selection """ if index >= getattr(self.tree, self.size): raise IndexError(index) if self.__cache_objects and index in self.__cache: return self.__cache[index] obj = self.tree_ob...
python
def getitem(self, index): """ direct access without going through self.selection """ if index >= getattr(self.tree, self.size): raise IndexError(index) if self.__cache_objects and index in self.__cache: return self.__cache[index] obj = self.tree_ob...
[ "def", "getitem", "(", "self", ",", "index", ")", ":", "if", "index", ">=", "getattr", "(", "self", ".", "tree", ",", "self", ".", "size", ")", ":", "raise", "IndexError", "(", "index", ")", "if", "self", ".", "__cache_objects", "and", "index", "in",...
direct access without going through self.selection
[ "direct", "access", "without", "going", "through", "self", ".", "selection" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/treeobject.py#L219-L230
14,063
rootpy/rootpy
rootpy/defaults.py
configure_defaults
def configure_defaults(): """ This function is executed immediately after ROOT's finalSetup """ log.debug("configure_defaults()") global initialized initialized = True if use_rootpy_handler: # Need to do it again here, since it is overridden by ROOT. set_error_handler(pytho...
python
def configure_defaults(): """ This function is executed immediately after ROOT's finalSetup """ log.debug("configure_defaults()") global initialized initialized = True if use_rootpy_handler: # Need to do it again here, since it is overridden by ROOT. set_error_handler(pytho...
[ "def", "configure_defaults", "(", ")", ":", "log", ".", "debug", "(", "\"configure_defaults()\"", ")", "global", "initialized", "initialized", "=", "True", "if", "use_rootpy_handler", ":", "# Need to do it again here, since it is overridden by ROOT.", "set_error_handler", "...
This function is executed immediately after ROOT's finalSetup
[ "This", "function", "is", "executed", "immediately", "after", "ROOT", "s", "finalSetup" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/defaults.py#L70-L104
14,064
rootpy/rootpy
rootpy/defaults.py
rp_module_level_in_stack
def rp_module_level_in_stack(): """ Returns true if we're during a rootpy import """ from traceback import extract_stack from rootpy import _ROOTPY_SOURCE_PATH modlevel_files = [filename for filename, _, func, _ in extract_stack() if func == "<module>"] return any(path...
python
def rp_module_level_in_stack(): """ Returns true if we're during a rootpy import """ from traceback import extract_stack from rootpy import _ROOTPY_SOURCE_PATH modlevel_files = [filename for filename, _, func, _ in extract_stack() if func == "<module>"] return any(path...
[ "def", "rp_module_level_in_stack", "(", ")", ":", "from", "traceback", "import", "extract_stack", "from", "rootpy", "import", "_ROOTPY_SOURCE_PATH", "modlevel_files", "=", "[", "filename", "for", "filename", ",", "_", ",", "func", ",", "_", "in", "extract_stack", ...
Returns true if we're during a rootpy import
[ "Returns", "true", "if", "we", "re", "during", "a", "rootpy", "import" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/defaults.py#L107-L116
14,065
rootpy/rootpy
rootpy/memory/deletion.py
monitor_deletion
def monitor_deletion(): """ Function for checking for correct deletion of weakref-able objects. Example usage:: monitor, is_alive = monitor_deletion() obj = set() monitor(obj, "obj") assert is_alive("obj") # True because there is a ref to `obj` is_alive del obj ...
python
def monitor_deletion(): """ Function for checking for correct deletion of weakref-able objects. Example usage:: monitor, is_alive = monitor_deletion() obj = set() monitor(obj, "obj") assert is_alive("obj") # True because there is a ref to `obj` is_alive del obj ...
[ "def", "monitor_deletion", "(", ")", ":", "monitors", "=", "{", "}", "def", "set_deleted", "(", "x", ")", ":", "def", "_", "(", "weakref", ")", ":", "del", "monitors", "[", "x", "]", "return", "_", "def", "monitor", "(", "item", ",", "name", ")", ...
Function for checking for correct deletion of weakref-able objects. Example usage:: monitor, is_alive = monitor_deletion() obj = set() monitor(obj, "obj") assert is_alive("obj") # True because there is a ref to `obj` is_alive del obj assert not is_alive("obj") # Tru...
[ "Function", "for", "checking", "for", "correct", "deletion", "of", "weakref", "-", "able", "objects", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/memory/deletion.py#L25-L52
14,066
rootpy/rootpy
rootpy/plotting/utils.py
canvases_with
def canvases_with(drawable): """ Return a list of all canvases where `drawable` has been painted. Note: This function is inefficient because it inspects all objects on all canvases, recursively. Avoid calling it if you have a large number of canvases and primitives. """ return [...
python
def canvases_with(drawable): """ Return a list of all canvases where `drawable` has been painted. Note: This function is inefficient because it inspects all objects on all canvases, recursively. Avoid calling it if you have a large number of canvases and primitives. """ return [...
[ "def", "canvases_with", "(", "drawable", ")", ":", "return", "[", "c", "for", "c", "in", "ROOT", ".", "gROOT", ".", "GetListOfCanvases", "(", ")", "if", "drawable", "in", "find_all_primitives", "(", "c", ")", "]" ]
Return a list of all canvases where `drawable` has been painted. Note: This function is inefficient because it inspects all objects on all canvases, recursively. Avoid calling it if you have a large number of canvases and primitives.
[ "Return", "a", "list", "of", "all", "canvases", "where", "drawable", "has", "been", "painted", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/utils.py#L405-L414
14,067
rootpy/rootpy
rootpy/plotting/utils.py
tick_length_pixels
def tick_length_pixels(pad, xaxis, yaxis, xlength, ylength=None): """ Set the axes tick lengths in pixels """ if ylength is None: ylength = xlength xaxis.SetTickLength(xlength / float(pad.height_pixels)) yaxis.SetTickLength(ylength / float(pad.width_pixels))
python
def tick_length_pixels(pad, xaxis, yaxis, xlength, ylength=None): """ Set the axes tick lengths in pixels """ if ylength is None: ylength = xlength xaxis.SetTickLength(xlength / float(pad.height_pixels)) yaxis.SetTickLength(ylength / float(pad.width_pixels))
[ "def", "tick_length_pixels", "(", "pad", ",", "xaxis", ",", "yaxis", ",", "xlength", ",", "ylength", "=", "None", ")", ":", "if", "ylength", "is", "None", ":", "ylength", "=", "xlength", "xaxis", ".", "SetTickLength", "(", "xlength", "/", "float", "(", ...
Set the axes tick lengths in pixels
[ "Set", "the", "axes", "tick", "lengths", "in", "pixels" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/utils.py#L436-L443
14,068
rootpy/rootpy
rootpy/tree/treetypes.py
BaseArray.reset
def reset(self): """Reset the value to the default""" if self.resetable: for i in range(len(self)): self[i] = self.default
python
def reset(self): """Reset the value to the default""" if self.resetable: for i in range(len(self)): self[i] = self.default
[ "def", "reset", "(", "self", ")", ":", "if", "self", ".", "resetable", ":", "for", "i", "in", "range", "(", "len", "(", "self", ")", ")", ":", "self", "[", "i", "]", "=", "self", ".", "default" ]
Reset the value to the default
[ "Reset", "the", "value", "to", "the", "default" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/treetypes.py#L210-L214
14,069
rootpy/rootpy
rootpy/stats/fit.py
minimize
def minimize(func, minimizer_type=None, minimizer_algo=None, strategy=None, retry=0, scan=False, print_level=None): """ Minimize a RooAbsReal function Parameters ---------- func : RooAbsReal The function to minim...
python
def minimize(func, minimizer_type=None, minimizer_algo=None, strategy=None, retry=0, scan=False, print_level=None): """ Minimize a RooAbsReal function Parameters ---------- func : RooAbsReal The function to minim...
[ "def", "minimize", "(", "func", ",", "minimizer_type", "=", "None", ",", "minimizer_algo", "=", "None", ",", "strategy", "=", "None", ",", "retry", "=", "0", ",", "scan", "=", "False", ",", "print_level", "=", "None", ")", ":", "llog", "=", "log", "[...
Minimize a RooAbsReal function Parameters ---------- func : RooAbsReal The function to minimize minimizer_type : string, optional (default=None) The minimizer type: "Minuit" or "Minuit2". If None (the default) then use the current global default value. minimizer_algo : st...
[ "Minimize", "a", "RooAbsReal", "function" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stats/fit.py#L15-L113
14,070
rootpy/rootpy
rootpy/stl.py
make_string
def make_string(obj): """ If ``obj`` is a string, return that, otherwise attempt to figure out the name of a type. """ if inspect.isclass(obj): if issubclass(obj, Object): return obj._ROOT.__name__ if issubclass(obj, string_types): return 'string' retu...
python
def make_string(obj): """ If ``obj`` is a string, return that, otherwise attempt to figure out the name of a type. """ if inspect.isclass(obj): if issubclass(obj, Object): return obj._ROOT.__name__ if issubclass(obj, string_types): return 'string' retu...
[ "def", "make_string", "(", "obj", ")", ":", "if", "inspect", ".", "isclass", "(", "obj", ")", ":", "if", "issubclass", "(", "obj", ",", "Object", ")", ":", "return", "obj", ".", "_ROOT", ".", "__name__", "if", "issubclass", "(", "obj", ",", "string_t...
If ``obj`` is a string, return that, otherwise attempt to figure out the name of a type.
[ "If", "obj", "is", "a", "string", "return", "that", "otherwise", "attempt", "to", "figure", "out", "the", "name", "of", "a", "type", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stl.py#L302-L315
14,071
rootpy/rootpy
rootpy/stl.py
generate
def generate(declaration, headers=None, has_iterators=False): """Compile and load the reflection dictionary for a type. If the requested dictionary has already been cached, then load that instead. Parameters ---------- declaration : str A type declaration (for example "vector<int>") he...
python
def generate(declaration, headers=None, has_iterators=False): """Compile and load the reflection dictionary for a type. If the requested dictionary has already been cached, then load that instead. Parameters ---------- declaration : str A type declaration (for example "vector<int>") he...
[ "def", "generate", "(", "declaration", ",", "headers", "=", "None", ",", "has_iterators", "=", "False", ")", ":", "global", "NEW_DICTS", "# FIXME: _rootpy_dictionary_already_exists returns false positives", "# if a third-party module provides \"incomplete\" dictionaries.", "#if c...
Compile and load the reflection dictionary for a type. If the requested dictionary has already been cached, then load that instead. Parameters ---------- declaration : str A type declaration (for example "vector<int>") headers : str or list of str A header file or list of header fi...
[ "Compile", "and", "load", "the", "reflection", "dictionary", "for", "a", "type", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stl.py#L318-L406
14,072
rootpy/rootpy
rootpy/stl.py
CPPType.ensure_built
def ensure_built(self, headers=None): """ Make sure that a dictionary exists for this type. """ if not self.params: return else: for child in self.params: child.ensure_built(headers=headers) if headers is None: headers =...
python
def ensure_built(self, headers=None): """ Make sure that a dictionary exists for this type. """ if not self.params: return else: for child in self.params: child.ensure_built(headers=headers) if headers is None: headers =...
[ "def", "ensure_built", "(", "self", ",", "headers", "=", "None", ")", ":", "if", "not", "self", ".", "params", ":", "return", "else", ":", "for", "child", "in", "self", ".", "params", ":", "child", ".", "ensure_built", "(", "headers", "=", "headers", ...
Make sure that a dictionary exists for this type.
[ "Make", "sure", "that", "a", "dictionary", "exists", "for", "this", "type", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stl.py#L202-L214
14,073
rootpy/rootpy
rootpy/stl.py
CPPType.guess_headers
def guess_headers(self): """ Attempt to guess what headers may be required in order to use this type. Returns `guess_headers` of all children recursively. * If the typename is in the :const:`KNOWN_TYPES` dictionary, use the header specified there * If it's an STL typ...
python
def guess_headers(self): """ Attempt to guess what headers may be required in order to use this type. Returns `guess_headers` of all children recursively. * If the typename is in the :const:`KNOWN_TYPES` dictionary, use the header specified there * If it's an STL typ...
[ "def", "guess_headers", "(", "self", ")", ":", "name", "=", "self", ".", "name", ".", "replace", "(", "\"*\"", ",", "\"\"", ")", "headers", "=", "[", "]", "if", "name", "in", "KNOWN_TYPES", ":", "headers", ".", "append", "(", "KNOWN_TYPES", "[", "nam...
Attempt to guess what headers may be required in order to use this type. Returns `guess_headers` of all children recursively. * If the typename is in the :const:`KNOWN_TYPES` dictionary, use the header specified there * If it's an STL type, include <{type}> * If it exists in...
[ "Attempt", "to", "guess", "what", "headers", "may", "be", "required", "in", "order", "to", "use", "this", "type", ".", "Returns", "guess_headers", "of", "all", "children", "recursively", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stl.py#L217-L252
14,074
rootpy/rootpy
rootpy/stl.py
CPPType.cls
def cls(self): """ Return the class definition for this type """ # TODO: register the resulting type? return SmartTemplate(self.name)(", ".join(map(str, self.params)))
python
def cls(self): """ Return the class definition for this type """ # TODO: register the resulting type? return SmartTemplate(self.name)(", ".join(map(str, self.params)))
[ "def", "cls", "(", "self", ")", ":", "# TODO: register the resulting type?", "return", "SmartTemplate", "(", "self", ".", "name", ")", "(", "\", \"", ".", "join", "(", "map", "(", "str", ",", "self", ".", "params", ")", ")", ")" ]
Return the class definition for this type
[ "Return", "the", "class", "definition", "for", "this", "type" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stl.py#L255-L260
14,075
rootpy/rootpy
rootpy/stl.py
CPPType.from_string
def from_string(cls, string): """ Parse ``string`` into a CPPType instance """ cls.TYPE.setParseAction(cls.make) try: return cls.TYPE.parseString(string, parseAll=True)[0] except ParseException: log.error("Failed to parse '{0}'".format(string)) ...
python
def from_string(cls, string): """ Parse ``string`` into a CPPType instance """ cls.TYPE.setParseAction(cls.make) try: return cls.TYPE.parseString(string, parseAll=True)[0] except ParseException: log.error("Failed to parse '{0}'".format(string)) ...
[ "def", "from_string", "(", "cls", ",", "string", ")", ":", "cls", ".", "TYPE", ".", "setParseAction", "(", "cls", ".", "make", ")", "try", ":", "return", "cls", ".", "TYPE", ".", "parseString", "(", "string", ",", "parseAll", "=", "True", ")", "[", ...
Parse ``string`` into a CPPType instance
[ "Parse", "string", "into", "a", "CPPType", "instance" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stl.py#L275-L284
14,076
rootpy/rootpy
rootpy/utils/cinterface.py
callback
def callback(cfunc): """ Turn a ctypes CFUNCTYPE instance into a value which can be passed into PyROOT """ # Note: # ROOT wants a c_voidp whose addressof() == the call site of the target # function. This hackery is necessary to achieve that. return C.c_voidp.from_address(C.cast(cfunc, C.c_vo...
python
def callback(cfunc): """ Turn a ctypes CFUNCTYPE instance into a value which can be passed into PyROOT """ # Note: # ROOT wants a c_voidp whose addressof() == the call site of the target # function. This hackery is necessary to achieve that. return C.c_voidp.from_address(C.cast(cfunc, C.c_vo...
[ "def", "callback", "(", "cfunc", ")", ":", "# Note:", "# ROOT wants a c_voidp whose addressof() == the call site of the target", "# function. This hackery is necessary to achieve that.", "return", "C", ".", "c_voidp", ".", "from_address", "(", "C", ".", "cast", "(", "cfunc", ...
Turn a ctypes CFUNCTYPE instance into a value which can be passed into PyROOT
[ "Turn", "a", "ctypes", "CFUNCTYPE", "instance", "into", "a", "value", "which", "can", "be", "passed", "into", "PyROOT" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/utils/cinterface.py#L21-L28
14,077
rootpy/rootpy
rootpy/utils/cinterface.py
objectproxy_realaddress
def objectproxy_realaddress(obj): """ Obtain a real address as an integer from an objectproxy. """ voidp = QROOT.TPython.ObjectProxy_AsVoidPtr(obj) return C.addressof(C.c_char.from_buffer(voidp))
python
def objectproxy_realaddress(obj): """ Obtain a real address as an integer from an objectproxy. """ voidp = QROOT.TPython.ObjectProxy_AsVoidPtr(obj) return C.addressof(C.c_char.from_buffer(voidp))
[ "def", "objectproxy_realaddress", "(", "obj", ")", ":", "voidp", "=", "QROOT", ".", "TPython", ".", "ObjectProxy_AsVoidPtr", "(", "obj", ")", "return", "C", ".", "addressof", "(", "C", ".", "c_char", ".", "from_buffer", "(", "voidp", ")", ")" ]
Obtain a real address as an integer from an objectproxy.
[ "Obtain", "a", "real", "address", "as", "an", "integer", "from", "an", "objectproxy", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/utils/cinterface.py#L31-L36
14,078
rootpy/rootpy
rootpy/plotting/style/__init__.py
set_style
def set_style(style, mpl=False, **kwargs): """ If mpl is False accept either style name or a TStyle instance. If mpl is True accept either style name or a matplotlib.rcParams-like dictionary """ if mpl: import matplotlib as mpl style_dictionary = {} if isinstance(style, ...
python
def set_style(style, mpl=False, **kwargs): """ If mpl is False accept either style name or a TStyle instance. If mpl is True accept either style name or a matplotlib.rcParams-like dictionary """ if mpl: import matplotlib as mpl style_dictionary = {} if isinstance(style, ...
[ "def", "set_style", "(", "style", ",", "mpl", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "mpl", ":", "import", "matplotlib", "as", "mpl", "style_dictionary", "=", "{", "}", "if", "isinstance", "(", "style", ",", "string_types", ")", ":", ...
If mpl is False accept either style name or a TStyle instance. If mpl is True accept either style name or a matplotlib.rcParams-like dictionary
[ "If", "mpl", "is", "False", "accept", "either", "style", "name", "or", "a", "TStyle", "instance", ".", "If", "mpl", "is", "True", "accept", "either", "style", "name", "or", "a", "matplotlib", ".", "rcParams", "-", "like", "dictionary" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/style/__init__.py#L56-L80
14,079
rootpy/rootpy
rootpy/io/file.py
_DirectoryBase.cd_previous
def cd_previous(self): """ cd to the gDirectory before this file was open. """ if self._prev_dir is None or isinstance(self._prev_dir, ROOT.TROOT): return False if isinstance(self._prev_dir, ROOT.TFile): if self._prev_dir.IsOpen() and self._prev_dir.IsWrit...
python
def cd_previous(self): """ cd to the gDirectory before this file was open. """ if self._prev_dir is None or isinstance(self._prev_dir, ROOT.TROOT): return False if isinstance(self._prev_dir, ROOT.TFile): if self._prev_dir.IsOpen() and self._prev_dir.IsWrit...
[ "def", "cd_previous", "(", "self", ")", ":", "if", "self", ".", "_prev_dir", "is", "None", "or", "isinstance", "(", "self", ".", "_prev_dir", ",", "ROOT", ".", "TROOT", ")", ":", "return", "False", "if", "isinstance", "(", "self", ".", "_prev_dir", ","...
cd to the gDirectory before this file was open.
[ "cd", "to", "the", "gDirectory", "before", "this", "file", "was", "open", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/io/file.py#L229-L247
14,080
rootpy/rootpy
rootpy/io/file.py
_DirectoryBase.Close
def Close(self, *args): """ Like ROOT's Close but reverts to the gDirectory before this file was opened. """ super(_DirectoryBase, self).Close(*args) return self.cd_previous()
python
def Close(self, *args): """ Like ROOT's Close but reverts to the gDirectory before this file was opened. """ super(_DirectoryBase, self).Close(*args) return self.cd_previous()
[ "def", "Close", "(", "self", ",", "*", "args", ")", ":", "super", "(", "_DirectoryBase", ",", "self", ")", ".", "Close", "(", "*", "args", ")", "return", "self", ".", "cd_previous", "(", ")" ]
Like ROOT's Close but reverts to the gDirectory before this file was opened.
[ "Like", "ROOT", "s", "Close", "but", "reverts", "to", "the", "gDirectory", "before", "this", "file", "was", "opened", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/io/file.py#L249-L255
14,081
rootpy/rootpy
rootpy/io/file.py
_DirectoryBase.keys
def keys(self, latest=False): """ Return a list of the keys in this directory. Parameters ---------- latest : bool, optional (default=False) If True then return a list of keys with unique names where only the key with the highest cycle number is included...
python
def keys(self, latest=False): """ Return a list of the keys in this directory. Parameters ---------- latest : bool, optional (default=False) If True then return a list of keys with unique names where only the key with the highest cycle number is included...
[ "def", "keys", "(", "self", ",", "latest", "=", "False", ")", ":", "if", "latest", ":", "keys", "=", "{", "}", "for", "key", "in", "self", ".", "keys", "(", ")", ":", "name", "=", "key", ".", "GetName", "(", ")", "if", "name", "in", "keys", "...
Return a list of the keys in this directory. Parameters ---------- latest : bool, optional (default=False) If True then return a list of keys with unique names where only the key with the highest cycle number is included where multiple keys exist with the sa...
[ "Return", "a", "list", "of", "the", "keys", "in", "this", "directory", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/io/file.py#L289-L318
14,082
rootpy/rootpy
rootpy/io/file.py
_DirectoryBase.Get
def Get(self, path, rootpy=True, **kwargs): """ Return the requested object cast as its corresponding subclass in rootpy if one exists and ``rootpy=True``, otherwise return the unadulterated TObject. """ thing = super(_DirectoryBase, self).Get(path) if not thing: ...
python
def Get(self, path, rootpy=True, **kwargs): """ Return the requested object cast as its corresponding subclass in rootpy if one exists and ``rootpy=True``, otherwise return the unadulterated TObject. """ thing = super(_DirectoryBase, self).Get(path) if not thing: ...
[ "def", "Get", "(", "self", ",", "path", ",", "rootpy", "=", "True", ",", "*", "*", "kwargs", ")", ":", "thing", "=", "super", "(", "_DirectoryBase", ",", "self", ")", ".", "Get", "(", "path", ")", "if", "not", "thing", ":", "raise", "DoesNotExist",...
Return the requested object cast as its corresponding subclass in rootpy if one exists and ``rootpy=True``, otherwise return the unadulterated TObject.
[ "Return", "the", "requested", "object", "cast", "as", "its", "corresponding", "subclass", "in", "rootpy", "if", "one", "exists", "and", "rootpy", "=", "True", "otherwise", "return", "the", "unadulterated", "TObject", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/io/file.py#L321-L348
14,083
rootpy/rootpy
rootpy/io/file.py
_DirectoryBase.GetKey
def GetKey(self, path, cycle=9999, rootpy=True, **kwargs): """ Override TDirectory's GetKey and also handle accessing keys nested arbitrarily deep in subdirectories. """ key = super(_DirectoryBase, self).GetKey(path, cycle) if not key: raise DoesNotExist ...
python
def GetKey(self, path, cycle=9999, rootpy=True, **kwargs): """ Override TDirectory's GetKey and also handle accessing keys nested arbitrarily deep in subdirectories. """ key = super(_DirectoryBase, self).GetKey(path, cycle) if not key: raise DoesNotExist ...
[ "def", "GetKey", "(", "self", ",", "path", ",", "cycle", "=", "9999", ",", "rootpy", "=", "True", ",", "*", "*", "kwargs", ")", ":", "key", "=", "super", "(", "_DirectoryBase", ",", "self", ")", ".", "GetKey", "(", "path", ",", "cycle", ")", "if"...
Override TDirectory's GetKey and also handle accessing keys nested arbitrarily deep in subdirectories.
[ "Override", "TDirectory", "s", "GetKey", "and", "also", "handle", "accessing", "keys", "nested", "arbitrarily", "deep", "in", "subdirectories", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/io/file.py#L360-L370
14,084
rootpy/rootpy
rootpy/io/file.py
_DirectoryBase.mkdir
def mkdir(self, path, title="", recurse=False): """ Make a new directory. If recurse is True, create parent directories as required. Return the newly created TDirectory. """ head, tail = os.path.split(os.path.normpath(path)) if tail == "": raise ValueError("in...
python
def mkdir(self, path, title="", recurse=False): """ Make a new directory. If recurse is True, create parent directories as required. Return the newly created TDirectory. """ head, tail = os.path.split(os.path.normpath(path)) if tail == "": raise ValueError("in...
[ "def", "mkdir", "(", "self", ",", "path", ",", "title", "=", "\"\"", ",", "recurse", "=", "False", ")", ":", "head", ",", "tail", "=", "os", ".", "path", ".", "split", "(", "os", ".", "path", ".", "normpath", "(", "path", ")", ")", "if", "tail"...
Make a new directory. If recurse is True, create parent directories as required. Return the newly created TDirectory.
[ "Make", "a", "new", "directory", ".", "If", "recurse", "is", "True", "create", "parent", "directories", "as", "required", ".", "Return", "the", "newly", "created", "TDirectory", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/io/file.py#L385-L408
14,085
rootpy/rootpy
rootpy/io/file.py
_DirectoryBase.rm
def rm(self, path, cycle=';*'): """ Delete an object at `path` relative to this directory """ rdir = self with preserve_current_directory(): dirname, objname = os.path.split(os.path.normpath(path)) if dirname: rdir = rdir.Get(dirname) ...
python
def rm(self, path, cycle=';*'): """ Delete an object at `path` relative to this directory """ rdir = self with preserve_current_directory(): dirname, objname = os.path.split(os.path.normpath(path)) if dirname: rdir = rdir.Get(dirname) ...
[ "def", "rm", "(", "self", ",", "path", ",", "cycle", "=", "';*'", ")", ":", "rdir", "=", "self", "with", "preserve_current_directory", "(", ")", ":", "dirname", ",", "objname", "=", "os", ".", "path", ".", "split", "(", "os", ".", "path", ".", "nor...
Delete an object at `path` relative to this directory
[ "Delete", "an", "object", "at", "path", "relative", "to", "this", "directory" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/io/file.py#L410-L419
14,086
rootpy/rootpy
rootpy/io/file.py
_DirectoryBase.copytree
def copytree(self, dest_dir, src=None, newname=None, exclude=None, overwrite=False): """ Copy this directory or just one contained object into another directory. Parameters ---------- dest_dir : string or Directory The destination directory....
python
def copytree(self, dest_dir, src=None, newname=None, exclude=None, overwrite=False): """ Copy this directory or just one contained object into another directory. Parameters ---------- dest_dir : string or Directory The destination directory....
[ "def", "copytree", "(", "self", ",", "dest_dir", ",", "src", "=", "None", ",", "newname", "=", "None", ",", "exclude", "=", "None", ",", "overwrite", "=", "False", ")", ":", "def", "copy_object", "(", "obj", ",", "dest", ",", "name", "=", "None", "...
Copy this directory or just one contained object into another directory. Parameters ---------- dest_dir : string or Directory The destination directory. src : string, optional (default=None) If ``src`` is None then this entire directory is copied recurs...
[ "Copy", "this", "directory", "or", "just", "one", "contained", "object", "into", "another", "directory", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/io/file.py#L424-L506
14,087
rootpy/rootpy
rootpy/io/file.py
_FileBase.find
def find(self, regexp, negate_regexp=False, class_pattern=None, find_fnc=re.search, refresh_cache=False): """ yield the full path of the matching regular expression and the match itself """ if refresh_cache or not hasattr(self, ...
python
def find(self, regexp, negate_regexp=False, class_pattern=None, find_fnc=re.search, refresh_cache=False): """ yield the full path of the matching regular expression and the match itself """ if refresh_cache or not hasattr(self, ...
[ "def", "find", "(", "self", ",", "regexp", ",", "negate_regexp", "=", "False", ",", "class_pattern", "=", "None", ",", "find_fnc", "=", "re", ".", "search", ",", "refresh_cache", "=", "False", ")", ":", "if", "refresh_cache", "or", "not", "hasattr", "(",...
yield the full path of the matching regular expression and the match itself
[ "yield", "the", "full", "path", "of", "the", "matching", "regular", "expression", "and", "the", "match", "itself" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/io/file.py#L696-L730
14,088
rootpy/rootpy
rootpy/interactive/rootwait.py
start_new_gui_thread
def start_new_gui_thread(): """ Attempt to start a new GUI thread, if possible. It is only possible to start one if there was one running on module import. """ PyGUIThread = getattr(ROOT, 'PyGUIThread', None) if PyGUIThread is not None: assert not PyGUIThread.isAlive(), "GUI thread alr...
python
def start_new_gui_thread(): """ Attempt to start a new GUI thread, if possible. It is only possible to start one if there was one running on module import. """ PyGUIThread = getattr(ROOT, 'PyGUIThread', None) if PyGUIThread is not None: assert not PyGUIThread.isAlive(), "GUI thread alr...
[ "def", "start_new_gui_thread", "(", ")", ":", "PyGUIThread", "=", "getattr", "(", "ROOT", ",", "'PyGUIThread'", ",", "None", ")", "if", "PyGUIThread", "is", "not", "None", ":", "assert", "not", "PyGUIThread", ".", "isAlive", "(", ")", ",", "\"GUI thread alre...
Attempt to start a new GUI thread, if possible. It is only possible to start one if there was one running on module import.
[ "Attempt", "to", "start", "a", "new", "GUI", "thread", "if", "possible", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/interactive/rootwait.py#L85-L107
14,089
rootpy/rootpy
rootpy/interactive/rootwait.py
stop_gui_thread
def stop_gui_thread(): """ Try to stop the GUI thread. If it was running returns True, otherwise False. """ PyGUIThread = getattr(ROOT, 'PyGUIThread', None) if PyGUIThread is None or not PyGUIThread.isAlive(): log.debug("no existing GUI thread is runnng") return False ROOT....
python
def stop_gui_thread(): """ Try to stop the GUI thread. If it was running returns True, otherwise False. """ PyGUIThread = getattr(ROOT, 'PyGUIThread', None) if PyGUIThread is None or not PyGUIThread.isAlive(): log.debug("no existing GUI thread is runnng") return False ROOT....
[ "def", "stop_gui_thread", "(", ")", ":", "PyGUIThread", "=", "getattr", "(", "ROOT", ",", "'PyGUIThread'", ",", "None", ")", "if", "PyGUIThread", "is", "None", "or", "not", "PyGUIThread", ".", "isAlive", "(", ")", ":", "log", ".", "debug", "(", "\"no exi...
Try to stop the GUI thread. If it was running returns True, otherwise False.
[ "Try", "to", "stop", "the", "GUI", "thread", ".", "If", "it", "was", "running", "returns", "True", "otherwise", "False", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/interactive/rootwait.py#L110-L129
14,090
rootpy/rootpy
rootpy/interactive/rootwait.py
wait_for_zero_canvases
def wait_for_zero_canvases(middle_mouse_close=False): """ Wait for all canvases to be closed, or CTRL-c. If `middle_mouse_close`, middle click will shut the canvas. incpy.ignore """ if not __ACTIVE: wait_failover(wait_for_zero_canvases) return @dispatcher def count_can...
python
def wait_for_zero_canvases(middle_mouse_close=False): """ Wait for all canvases to be closed, or CTRL-c. If `middle_mouse_close`, middle click will shut the canvas. incpy.ignore """ if not __ACTIVE: wait_failover(wait_for_zero_canvases) return @dispatcher def count_can...
[ "def", "wait_for_zero_canvases", "(", "middle_mouse_close", "=", "False", ")", ":", "if", "not", "__ACTIVE", ":", "wait_failover", "(", "wait_for_zero_canvases", ")", "return", "@", "dispatcher", "def", "count_canvases", "(", ")", ":", "\"\"\"\n Count the numbe...
Wait for all canvases to be closed, or CTRL-c. If `middle_mouse_close`, middle click will shut the canvas. incpy.ignore
[ "Wait", "for", "all", "canvases", "to", "be", "closed", "or", "CTRL", "-", "c", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/interactive/rootwait.py#L161-L226
14,091
rootpy/rootpy
rootpy/interactive/rootwait.py
wait_for_frame
def wait_for_frame(frame): """ wait until a TGMainFrame is closed or ctrl-c """ if not frame: # It's already closed or maybe we're in batch mode return @dispatcher def close(): ROOT.gSystem.ExitLoop() if not getattr(frame, "_py_close_dispatcher_attached", False): ...
python
def wait_for_frame(frame): """ wait until a TGMainFrame is closed or ctrl-c """ if not frame: # It's already closed or maybe we're in batch mode return @dispatcher def close(): ROOT.gSystem.ExitLoop() if not getattr(frame, "_py_close_dispatcher_attached", False): ...
[ "def", "wait_for_frame", "(", "frame", ")", ":", "if", "not", "frame", ":", "# It's already closed or maybe we're in batch mode", "return", "@", "dispatcher", "def", "close", "(", ")", ":", "ROOT", ".", "gSystem", ".", "ExitLoop", "(", ")", "if", "not", "getat...
wait until a TGMainFrame is closed or ctrl-c
[ "wait", "until", "a", "TGMainFrame", "is", "closed", "or", "ctrl", "-", "c" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/interactive/rootwait.py#L231-L266
14,092
rootpy/rootpy
rootpy/interactive/rootwait.py
wait_for_browser_close
def wait_for_browser_close(b): """ Can be used to wait until a TBrowser is closed """ if b: if not __ACTIVE: wait_failover(wait_for_browser_close) return wait_for_frame(b.GetBrowserImp().GetMainFrame())
python
def wait_for_browser_close(b): """ Can be used to wait until a TBrowser is closed """ if b: if not __ACTIVE: wait_failover(wait_for_browser_close) return wait_for_frame(b.GetBrowserImp().GetMainFrame())
[ "def", "wait_for_browser_close", "(", "b", ")", ":", "if", "b", ":", "if", "not", "__ACTIVE", ":", "wait_failover", "(", "wait_for_browser_close", ")", "return", "wait_for_frame", "(", "b", ".", "GetBrowserImp", "(", ")", ".", "GetMainFrame", "(", ")", ")" ]
Can be used to wait until a TBrowser is closed
[ "Can", "be", "used", "to", "wait", "until", "a", "TBrowser", "is", "closed" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/interactive/rootwait.py#L269-L277
14,093
rootpy/rootpy
rootpy/logger/__init__.py
log_trace
def log_trace(logger, level=logging.DEBUG, show_enter=True, show_exit=True): """ log a statement on function entry and exit """ def wrap(function): l = logger.getChild(function.__name__).log @wraps(function) def thunk(*args, **kwargs): global trace_depth t...
python
def log_trace(logger, level=logging.DEBUG, show_enter=True, show_exit=True): """ log a statement on function entry and exit """ def wrap(function): l = logger.getChild(function.__name__).log @wraps(function) def thunk(*args, **kwargs): global trace_depth t...
[ "def", "log_trace", "(", "logger", ",", "level", "=", "logging", ".", "DEBUG", ",", "show_enter", "=", "True", ",", "show_exit", "=", "True", ")", ":", "def", "wrap", "(", "function", ")", ":", "l", "=", "logger", ".", "getChild", "(", "function", "....
log a statement on function entry and exit
[ "log", "a", "statement", "on", "function", "entry", "and", "exit" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/logger/__init__.py#L140-L168
14,094
rootpy/rootpy
rootpy/logger/extended_logger.py
log_stack
def log_stack(logger, level=logging.INFO, limit=None, frame=None): """ Display the current stack on ``logger``. This function is designed to be used during emission of log messages, so it won't call itself. """ if showing_stack.inside: return showing_stack.inside = True try: ...
python
def log_stack(logger, level=logging.INFO, limit=None, frame=None): """ Display the current stack on ``logger``. This function is designed to be used during emission of log messages, so it won't call itself. """ if showing_stack.inside: return showing_stack.inside = True try: ...
[ "def", "log_stack", "(", "logger", ",", "level", "=", "logging", ".", "INFO", ",", "limit", "=", "None", ",", "frame", "=", "None", ")", ":", "if", "showing_stack", ".", "inside", ":", "return", "showing_stack", ".", "inside", "=", "True", "try", ":", ...
Display the current stack on ``logger``. This function is designed to be used during emission of log messages, so it won't call itself.
[ "Display", "the", "current", "stack", "on", "logger", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/logger/extended_logger.py#L25-L42
14,095
rootpy/rootpy
rootpy/logger/extended_logger.py
ExtendedLogger.showdeletion
def showdeletion(self, *objects): """ Record a stack trace at the point when an ROOT TObject is deleted """ from ..memory import showdeletion as S for o in objects: S.monitor_object_cleanup(o)
python
def showdeletion(self, *objects): """ Record a stack trace at the point when an ROOT TObject is deleted """ from ..memory import showdeletion as S for o in objects: S.monitor_object_cleanup(o)
[ "def", "showdeletion", "(", "self", ",", "*", "objects", ")", ":", "from", ".", ".", "memory", "import", "showdeletion", "as", "S", "for", "o", "in", "objects", ":", "S", ".", "monitor_object_cleanup", "(", "o", ")" ]
Record a stack trace at the point when an ROOT TObject is deleted
[ "Record", "a", "stack", "trace", "at", "the", "point", "when", "an", "ROOT", "TObject", "is", "deleted" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/logger/extended_logger.py#L67-L73
14,096
rootpy/rootpy
rootpy/logger/extended_logger.py
ExtendedLogger.trace
def trace(self, level=logging.DEBUG, show_enter=True, show_exit=True): """ Functions decorated with this function show function entry and exit with values, defaults to debug log level. :param level: log severity to use for function tracing :param show_enter: log function entry ...
python
def trace(self, level=logging.DEBUG, show_enter=True, show_exit=True): """ Functions decorated with this function show function entry and exit with values, defaults to debug log level. :param level: log severity to use for function tracing :param show_enter: log function entry ...
[ "def", "trace", "(", "self", ",", "level", "=", "logging", ".", "DEBUG", ",", "show_enter", "=", "True", ",", "show_exit", "=", "True", ")", ":", "from", ".", "import", "log_trace", "return", "log_trace", "(", "self", ",", "level", ",", "show_enter", "...
Functions decorated with this function show function entry and exit with values, defaults to debug log level. :param level: log severity to use for function tracing :param show_enter: log function entry :param show_enter: log function exit Example use: .. sourcecode:: ...
[ "Functions", "decorated", "with", "this", "function", "show", "function", "entry", "and", "exit", "with", "values", "defaults", "to", "debug", "log", "level", "." ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/logger/extended_logger.py#L91-L127
14,097
rootpy/rootpy
rootpy/logger/extended_logger.py
ExtendedLogger.frame_unique
def frame_unique(f): """ A tuple representing a value which is unique to a given frame's line of execution """ return f.f_code.co_filename, f.f_code.co_name, f.f_lineno
python
def frame_unique(f): """ A tuple representing a value which is unique to a given frame's line of execution """ return f.f_code.co_filename, f.f_code.co_name, f.f_lineno
[ "def", "frame_unique", "(", "f", ")", ":", "return", "f", ".", "f_code", ".", "co_filename", ",", "f", ".", "f_code", ".", "co_name", ",", "f", ".", "f_lineno" ]
A tuple representing a value which is unique to a given frame's line of execution
[ "A", "tuple", "representing", "a", "value", "which", "is", "unique", "to", "a", "given", "frame", "s", "line", "of", "execution" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/logger/extended_logger.py#L157-L162
14,098
rootpy/rootpy
rootpy/logger/extended_logger.py
ExtendedLogger.show_stack_depth
def show_stack_depth(self, record, frame): """ Compute the maximum stack depth to show requested by any hooks, returning -1 if there are none matching, or if we've already emitted one for the line of code referred to. """ logger = self depths = [-1] msg =...
python
def show_stack_depth(self, record, frame): """ Compute the maximum stack depth to show requested by any hooks, returning -1 if there are none matching, or if we've already emitted one for the line of code referred to. """ logger = self depths = [-1] msg =...
[ "def", "show_stack_depth", "(", "self", ",", "record", ",", "frame", ")", ":", "logger", "=", "self", "depths", "=", "[", "-", "1", "]", "msg", "=", "record", ".", "getMessage", "(", ")", "# For each logger in the hierarchy", "while", "logger", ":", "to_ma...
Compute the maximum stack depth to show requested by any hooks, returning -1 if there are none matching, or if we've already emitted one for the line of code referred to.
[ "Compute", "the", "maximum", "stack", "depth", "to", "show", "requested", "by", "any", "hooks", "returning", "-", "1", "if", "there", "are", "none", "matching", "or", "if", "we", "ve", "already", "emitted", "one", "for", "the", "line", "of", "code", "ref...
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/logger/extended_logger.py#L164-L193
14,099
rootpy/rootpy
rootpy/logger/extended_logger.py
ExtendedLogger.getChild
def getChild(self, suffix): """ Taken from CPython 2.7, modified to remove duplicate prefix and suffixes """ if suffix is None: return self if self.root is not self: if suffix.startswith(self.name + "."): # Remove duplicate prefix ...
python
def getChild(self, suffix): """ Taken from CPython 2.7, modified to remove duplicate prefix and suffixes """ if suffix is None: return self if self.root is not self: if suffix.startswith(self.name + "."): # Remove duplicate prefix ...
[ "def", "getChild", "(", "self", ",", "suffix", ")", ":", "if", "suffix", "is", "None", ":", "return", "self", "if", "self", ".", "root", "is", "not", "self", ":", "if", "suffix", ".", "startswith", "(", "self", ".", "name", "+", "\".\"", ")", ":", ...
Taken from CPython 2.7, modified to remove duplicate prefix and suffixes
[ "Taken", "from", "CPython", "2", ".", "7", "modified", "to", "remove", "duplicate", "prefix", "and", "suffixes" ]
3926935e1f2100d8ba68070c2ab44055d4800f73
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/logger/extended_logger.py#L225-L241