icecube.gulliver_modules.iceopt module¶
IceOpt module
This module provides an optparse.OptionParser wrapper for IceTray script. It can be used to parse input i3-files to the scripts, specify common output files (ROOT, HDF5, …) and so on.
- class icecube.gulliver_modules.iceopt.IceTrayScriptOptions(name, definput='', defgcd='', defpulses='OfflinePulses', defverbose=False, defnevents=0, moreopts=False)¶
Bases:
OptionParser
IceTray wrapper for the standard optparse.OptionParser class
The iceopt.IceTrayScriptOptions class is a wrapper for the standard optparse.OptionParser class, and it predefines a bunch of very common options in typical IceTray scripts: GCD file, input file(s), ROOT output file, verbosity, output file, and number of events to be processed.
Input files are checked for existence and
i3(.gz)
suffix. A default input file can be defined that will only be used in case the user defines no input file at all (apart from maybe a GCD file). All input files (GCD and others) are collected in a list named infiles, which has the-g
and-i
files in front, if provided.You can add more options using the regular add_option method from optparse.OptionParser. If you plan to do so, then make sure to set
moreopts = True
when instantiating the iceopt.IceTrayScriptOptions object, and call parse after you have added all your custom options. If you leavemoreopts = False
(default) then the options will be parsed immediately during instantiation.- check(filename='', descr='input file')¶
Combination of checksuf and checkaccess
- checkaccess(filename='', descr='input file')¶
Check file accessibility.
- checksuf(filename='', descr='input file')¶
Check file suffix:
.i3
,.i3.gz
or.bz2
.
- noise(msg)¶
Printing messages only if allowed to do so.
- parse()¶
Parsing, standard checks, collect input files in a list.