westpa.tools package
westpa.tools module
tools – classes for implementing command-line tools for WESTPA
- class westpa.tools.WESTTool
Bases:
WESTToolComponent
Base class for WEST command line tools
- add_args(parser)
Add arguments specific to this tool to the given argparse parser.
- description = None
- epilog = None
- go()
Perform the analysis associated with this tool.
- main()
A convenience function to make a parser, parse and process arguments, then call self.go()
- make_parser(prog=None, usage=None, description=None, epilog=None, args=None)
- make_parser_and_process(prog=None, usage=None, description=None, epilog=None, args=None)
A convenience function to create a parser, call add_all_args(), and then call process_all_args(). The argument namespace is returned.
- process_args(args)
Take argparse-processed arguments associated with this tool and deal with them appropriately (setting instance variables, etc)
- prog = None
- usage = None
- class westpa.tools.WESTParallelTool(wm_env=None)
Bases:
WESTTool
Base class for command-line tools parallelized with wwmgr. This automatically adds and processes wwmgr command-line arguments and creates a work manager at self.work_manager.
- add_args(parser)
Add arguments specific to this tool to the given argparse parser.
- go()
Perform the analysis associated with this tool.
- main()
A convenience function to make a parser, parse and process arguments, then run self.go() in the master process.
- make_parser_and_process(prog=None, usage=None, description=None, epilog=None, args=None)
A convenience function to create a parser, call add_all_args(), and then call process_all_args(). The argument namespace is returned.
- process_args(args)
Take argparse-processed arguments associated with this tool and deal with them appropriately (setting instance variables, etc)
- class westpa.tools.WESTToolComponent
Bases:
object
Base class for WEST command line tools and components used in constructing tools
- add_all_args(parser)
Add arguments for all components from which this class derives to the given parser, starting with the class highest up the inheritance chain (most distant ancestor).
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- exclude_arg(argname)
- include_arg(argname)
- process_all_args(args)
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- set_arg_default(argname, value)
- class westpa.tools.WESTSubcommand(parent)
Bases:
WESTToolComponent
Base class for command-line tool subcommands. A little sugar for making this more uniform.
- add_to_subparsers(subparsers)
- description = None
- go()
- help_text = None
- subcommand = None
- property work_manager
The work manager for this tool. Raises AttributeError if this is not a parallel tool.
- class westpa.tools.WESTMasterCommand
Bases:
WESTTool
Base class for command-line tools that employ subcommands
- add_args(parser)
Add arguments specific to this tool to the given argparse parser.
- go()
Perform the analysis associated with this tool.
- include_help_command = True
- process_args(args)
Take argparse-processed arguments associated with this tool and deal with them appropriately (setting instance variables, etc)
- subcommands = None
- subparsers_title = None
- class westpa.tools.WESTMultiTool(wm_env=None)
Bases:
WESTParallelTool
Base class for command-line tools which work with multiple simulations. Automatically parses for and gives commands to load multiple files.
- exception NoSimulationsException
Bases:
Exception
- add_args(parser)
Add arguments specific to this tool to the given argparse parser.
- generate_file_list(key_list)
A convenience function which takes in a list of keys that are filenames, and returns a dictionary which contains all the individual files loaded inside of a dictionary keyed to the filename.
- go()
Perform the analysis associated with this tool.
- main()
A convenience function to make a parser, parse and process arguments, then run self.go() in the master process.
- make_parser_and_process(prog=None, usage=None, description=None, epilog=None, args=None)
A convenience function to create a parser, call add_all_args(), and then call process_all_args(). The argument namespace is returned.
- parse_from_yaml(yamlfilepath)
Parse options from YAML input file. Command line arguments take precedence over options specified in the YAML hierarchy. TODO: add description on how YAML files should be constructed.
- process_args(args)
Take argparse-processed arguments associated with this tool and deal with them appropriately (setting instance variables, etc)
- class westpa.tools.WESTDataReader
Bases:
WESTToolComponent
Tool for reading data from WEST-related HDF5 files. Coordinates finding the main HDF5 file from west.cfg or command line arguments, caching of certain kinds of data (eventually), and retrieving auxiliary data sets from various places.
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- close()
- open(mode='r')
- property parent_id_dsspec
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- property weight_dsspec
- class westpa.tools.WESTDSSynthesizer(default_dsname=None, h5filename=None)
Bases:
WESTToolComponent
Tool for synthesizing a dataset for analysis from other datasets. This may be done using a custom function, or a list of “data set specifications”. It is anticipated that if several source datasets are required, then a tool will have multiple instances of this class.
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- group_name = 'input dataset options'
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- class westpa.tools.WESTWDSSynthesizer(default_dsname=None, h5filename=None)
Bases:
WESTToolComponent
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- group_name = 'weight dataset options'
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- class westpa.tools.IterRangeSelection(data_manager=None)
Bases:
WESTToolComponent
Select and record limits on iterations used in analysis and/or reporting. This class provides both the user-facing command-line options and parsing, and the application-side API for recording limits in HDF5.
HDF5 datasets calculated based on a restricted set of iterations should be tagged with the following attributes:
first_iter
The first iteration included in the calculation.
last_iter
One past the last iteration included in the calculation.
iter_step
Blocking or sampling period for iterations included in the calculation.
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- check_data_iter_range_equal(h5object, iter_start=None, iter_stop=None)
Check that the given HDF5 object contains (as denoted by its
iter_start
/iter_stop
attributes) data exactly for the iteration range specified.
- check_data_iter_range_least(h5object, iter_start=None, iter_stop=None)
Check that the given HDF5 object contains (as denoted by its
iter_start
/iter_stop
attributes) data at least for the iteration range specified.
- check_data_iter_step_conformant(h5object, iter_step=None)
Check that the given HDF5 object contains per-iteration data at an iteration stride suitable for extracting data with the given stride (in other words, the given
iter_step
is a multiple of the stride with which data was recorded).
- check_data_iter_step_equal(h5object, iter_step=None)
Check that the given HDF5 object contains per-iteration data at an iteration stride the same as that specified.
- iter_block_iter()
Return an iterable of (block_start,block_end) over the blocks of iterations selected by –first-iter/–last-iter/–step-iter.
- iter_range(iter_start=None, iter_stop=None, iter_step=None, dtype=None)
Return a sequence for the given iteration numbers and stride, filling in missing values from those stored on
self
. The smallest data type capable of holdingiter_stop
is returned unless otherwise specified using thedtype
argument.
- n_iter_blocks()
Return the number of blocks of iterations (as returned by
iter_block_iter
) selected by –first-iter/–last-iter/–step-iter.
- process_args(args, override_iter_start=None, override_iter_stop=None, default_iter_step=1)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- record_data_iter_range(h5object, iter_start=None, iter_stop=None)
Store attributes
iter_start
anditer_stop
on the given HDF5 object (group/dataset)
- record_data_iter_step(h5object, iter_step=None)
Store attribute
iter_step
on the given HDF5 object (group/dataset).
- slice_per_iter_data(dataset, iter_start=None, iter_stop=None, iter_step=None, axis=0)
Return the subset of the given dataset corresponding to the given iteration range and stride. Unless otherwise specified, the first dimension of the dataset is the one sliced.
- class westpa.tools.SegSelector
Bases:
WESTToolComponent
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- parse_segsel_file(filename)
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- class westpa.tools.BinMappingComponent
Bases:
WESTToolComponent
Component for obtaining a bin mapper from one of several places based on command-line arguments. Such locations include an HDF5 file that contains pickled mappers (including the primary WEST HDF5 file), the system object, an external function, or (in the common case of rectilinear bins) a list of lists of bin boundaries.
Some configuration is necessary prior to calling process_args() if loading a mapper from HDF5. Specifically, either set_we_h5file_info() or set_other_h5file_info() must be called to describe where to find the appropriate mapper. In the case of set_we_h5file_info(), the mapper used for WE at the end of a given iteration will be loaded. In the case of set_other_h5file_info(), an arbitrary group and hash value are specified; the mapper corresponding to that hash in the given group will be returned.
In the absence of arguments, the mapper contained in an existing HDF5 file is preferred; if that is not available, the mapper from the system driver is used.
This component adds the following arguments to argument parsers:
- --bins-from-system
Obtain bins from the system driver
—bins-from-expr=EXPR Construct rectilinear bins by parsing EXPR and calling RectilinearBinMapper() with the result. EXPR must therefore be a list of lists.
- –bins-from-function=[PATH:]MODULE.FUNC
Call an external function FUNC in module MODULE (optionally adding PATH to the search path when loading MODULE) which, when called, returns a fully-constructed bin mapper.
—bins-from-file Load bin definitions from a YAML configuration file.
- --bins-from-h5file
Load bins from the file being considered; this is intended to mean the master WEST HDF5 file or results of other binning calculations, as appropriate.
- add_args(parser, description='binning options', suppress=[])
Add arguments specific to this component to the given argparse parser.
- add_target_count_args(parser, description='bin target count options')
Add options to the given parser corresponding to target counts.
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- set_other_h5file_info(topology_group, hashval)
Set up to load a bin mapper from (any) open HDF5 file, where bin topologies are stored in
topology_group
(an h5py Group object) and the desired mapper has hash valuehashval
. The mapper itself is loaded when self.load_bin_mapper() is called.
- set_we_h5file_info(n_iter=None, data_manager=None, required=False)
Set up to load a bin mapper from the master WEST HDF5 file. The mapper is actually loaded from the file when self.load_bin_mapper() is called, if and only if command line arguments direct this. If
required
is true, then a mapper must be available at iterationn_iter
, or else an exception will be raised.
- westpa.tools.mapper_from_dict(ybins)
- class westpa.tools.ProgressIndicatorComponent
Bases:
WESTToolComponent
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- class westpa.tools.Plotter(h5file, h5key, iteration=-1, interface='matplotlib')
Bases:
object
This is a semi-generic plotting interface that has a built in curses based terminal plotter. It’s fairly specific to what we’re using it for here, but we could (and maybe should) build it out into a little library that we can use via the command line to plot things. Might be useful for looking at data later. That would also cut the size of this tool down by a good bit.
- plot(i=0, j=1, tau=1, iteration=None, dim=0, interface=None)
- class westpa.tools.KineticsIteration(kin_h5file, index, assign, iteration=-1)
Bases:
object
- keys()
- class westpa.tools.WIPIScheme(scheme, name, parent, settings)
Bases:
object
- property assign
- property bin_labels
- property current
The current iteration. See help for __get_data_for_iteration__
- property direct
The output from w_direct.py from the current scheme.
- property iteration
- property list_schemes
Lists what schemes are configured in west.cfg file. Schemes should be structured as follows, in west.cfg:
- west:
- system:
- analysis:
directory: analysis analysis_schemes:
- scheme.1:
enabled: True states:
label: unbound coords: [[7.0]]
label: bound coords: [[2.7]]
- bins:
type: RectilinearBinMapper boundaries: [[0.0, 2.80, 7, 10000]]
- property past
The previous iteration. See help for __get_data_for_iteration__
- property reweight
- property scheme
- property state_labels
- property west
westpa.tools.binning module
- class westpa.tools.binning.count(start=0, step=1)
Bases:
object
Return a count object whose .__next__() method returns consecutive values.
- Equivalent to:
- def count(firstval=0, step=1):
x = firstval while 1:
yield x x += step
- exception westpa.tools.binning.PickleError
Bases:
Exception
- class westpa.tools.binning.RectilinearBinMapper(boundaries)
Bases:
BinMapper
Bin into a rectangular grid based on tuples of float values
- assign(coords, mask=None, output=None)
- property boundaries
- westpa.tools.binning.weight_dtype
alias of
float64
- westpa.tools.binning.get_object(object_name, path=None)
Attempt to load the given object, using additional path information if given.
- class westpa.tools.binning.WESTToolComponent
Bases:
object
Base class for WEST command line tools and components used in constructing tools
- add_all_args(parser)
Add arguments for all components from which this class derives to the given parser, starting with the class highest up the inheritance chain (most distant ancestor).
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- exclude_arg(argname)
- include_arg(argname)
- process_all_args(args)
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- set_arg_default(argname, value)
- westpa.tools.binning.mapper_from_expr(expr)
- westpa.tools.binning.mapper_from_system()
- westpa.tools.binning.mapper_from_function(funcspec)
Return a mapper constructed by calling a function in a named module.
funcspec
should be formatted as[PATH]:MODULE.FUNC
. This function loads MODULE, optionally adding PATH to the search path, then returns MODULE.FUNC()
- westpa.tools.binning.mapper_from_hdf5(topol_group, hashval)
Retrieve the mapper identified by
hashval
from the given bin topology grouptopol_group
. Returns(mapper, pickle, hashval)
- westpa.tools.binning.mapper_from_yaml(yamlfilename)
- westpa.tools.binning.mapper_from_dict(ybins)
- westpa.tools.binning.write_bin_info(mapper, assignments, weights, n_target_states, outfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, detailed=False)
Write information about binning to
outfile
, given a mapper (mapper
) and the weights (weights
) and bin assignments (assignments
) of a set of segments, along with a target state count (n_target_states
). Ifdetailed
is true, then per-bin information is written as well as summary information about all bins.
- westpa.tools.binning.write_bin_labels(mapper, dest, header='# bin labels:\n', fmt='# bin {index:{max_iwidth}d} -- {label!s}\n')
Print labels for all bins in
mapper
to the file-like object``dest``.If provided,
header
is printed prior to any labels. A number of expansions are available inheader
:mapper
– the mapper itself (from which most of the following can be obtained)classname
– the class name of the mappernbins
– number of bins in the mapper
The
fmt
string specifies how bin labels are to be printed. A number of expansions are available infmt
:index
– the zero-based index of the binlabel
– the label of the binmax_iwidth
– the maximum width (in characters) of the bin index, for pretty alignment
- class westpa.tools.binning.BinMappingComponent
Bases:
WESTToolComponent
Component for obtaining a bin mapper from one of several places based on command-line arguments. Such locations include an HDF5 file that contains pickled mappers (including the primary WEST HDF5 file), the system object, an external function, or (in the common case of rectilinear bins) a list of lists of bin boundaries.
Some configuration is necessary prior to calling process_args() if loading a mapper from HDF5. Specifically, either set_we_h5file_info() or set_other_h5file_info() must be called to describe where to find the appropriate mapper. In the case of set_we_h5file_info(), the mapper used for WE at the end of a given iteration will be loaded. In the case of set_other_h5file_info(), an arbitrary group and hash value are specified; the mapper corresponding to that hash in the given group will be returned.
In the absence of arguments, the mapper contained in an existing HDF5 file is preferred; if that is not available, the mapper from the system driver is used.
This component adds the following arguments to argument parsers:
- --bins-from-system
Obtain bins from the system driver
—bins-from-expr=EXPR Construct rectilinear bins by parsing EXPR and calling RectilinearBinMapper() with the result. EXPR must therefore be a list of lists.
- –bins-from-function=[PATH:]MODULE.FUNC
Call an external function FUNC in module MODULE (optionally adding PATH to the search path when loading MODULE) which, when called, returns a fully-constructed bin mapper.
—bins-from-file Load bin definitions from a YAML configuration file.
- --bins-from-h5file
Load bins from the file being considered; this is intended to mean the master WEST HDF5 file or results of other binning calculations, as appropriate.
- add_args(parser, description='binning options', suppress=[])
Add arguments specific to this component to the given argparse parser.
- add_target_count_args(parser, description='bin target count options')
Add options to the given parser corresponding to target counts.
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- set_we_h5file_info(n_iter=None, data_manager=None, required=False)
Set up to load a bin mapper from the master WEST HDF5 file. The mapper is actually loaded from the file when self.load_bin_mapper() is called, if and only if command line arguments direct this. If
required
is true, then a mapper must be available at iterationn_iter
, or else an exception will be raised.
- set_other_h5file_info(topology_group, hashval)
Set up to load a bin mapper from (any) open HDF5 file, where bin topologies are stored in
topology_group
(an h5py Group object) and the desired mapper has hash valuehashval
. The mapper itself is loaded when self.load_bin_mapper() is called.
westpa.tools.core module
Core classes for creating WESTPA command-line tools
- class westpa.tools.core.WESTToolComponent
Bases:
object
Base class for WEST command line tools and components used in constructing tools
- include_arg(argname)
- exclude_arg(argname)
- set_arg_default(argname, value)
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- add_all_args(parser)
Add arguments for all components from which this class derives to the given parser, starting with the class highest up the inheritance chain (most distant ancestor).
- process_all_args(args)
- class westpa.tools.core.WESTTool
Bases:
WESTToolComponent
Base class for WEST command line tools
- prog = None
- usage = None
- description = None
- epilog = None
- add_args(parser)
Add arguments specific to this tool to the given argparse parser.
- process_args(args)
Take argparse-processed arguments associated with this tool and deal with them appropriately (setting instance variables, etc)
- make_parser(prog=None, usage=None, description=None, epilog=None, args=None)
- make_parser_and_process(prog=None, usage=None, description=None, epilog=None, args=None)
A convenience function to create a parser, call add_all_args(), and then call process_all_args(). The argument namespace is returned.
- go()
Perform the analysis associated with this tool.
- main()
A convenience function to make a parser, parse and process arguments, then call self.go()
- class westpa.tools.core.WESTParallelTool(wm_env=None)
Bases:
WESTTool
Base class for command-line tools parallelized with wwmgr. This automatically adds and processes wwmgr command-line arguments and creates a work manager at self.work_manager.
- make_parser_and_process(prog=None, usage=None, description=None, epilog=None, args=None)
A convenience function to create a parser, call add_all_args(), and then call process_all_args(). The argument namespace is returned.
- add_args(parser)
Add arguments specific to this tool to the given argparse parser.
- process_args(args)
Take argparse-processed arguments associated with this tool and deal with them appropriately (setting instance variables, etc)
- go()
Perform the analysis associated with this tool.
- main()
A convenience function to make a parser, parse and process arguments, then run self.go() in the master process.
- class westpa.tools.core.WESTMultiTool(wm_env=None)
Bases:
WESTParallelTool
Base class for command-line tools which work with multiple simulations. Automatically parses for and gives commands to load multiple files.
- make_parser_and_process(prog=None, usage=None, description=None, epilog=None, args=None)
A convenience function to create a parser, call add_all_args(), and then call process_all_args(). The argument namespace is returned.
- parse_from_yaml(yamlfilepath)
Parse options from YAML input file. Command line arguments take precedence over options specified in the YAML hierarchy. TODO: add description on how YAML files should be constructed.
- add_args(parser)
Add arguments specific to this tool to the given argparse parser.
- exception NoSimulationsException
Bases:
Exception
- generate_file_list(key_list)
A convenience function which takes in a list of keys that are filenames, and returns a dictionary which contains all the individual files loaded inside of a dictionary keyed to the filename.
- process_args(args)
Take argparse-processed arguments associated with this tool and deal with them appropriately (setting instance variables, etc)
- go()
Perform the analysis associated with this tool.
- main()
A convenience function to make a parser, parse and process arguments, then run self.go() in the master process.
- class westpa.tools.core.WESTSubcommand(parent)
Bases:
WESTToolComponent
Base class for command-line tool subcommands. A little sugar for making this more uniform.
- subcommand = None
- help_text = None
- description = None
- add_to_subparsers(subparsers)
- go()
- property work_manager
The work manager for this tool. Raises AttributeError if this is not a parallel tool.
- class westpa.tools.core.WESTMasterCommand
Bases:
WESTTool
Base class for command-line tools that employ subcommands
- subparsers_title = None
- subcommands = None
- include_help_command = True
- add_args(parser)
Add arguments specific to this tool to the given argparse parser.
- process_args(args)
Take argparse-processed arguments associated with this tool and deal with them appropriately (setting instance variables, etc)
- go()
Perform the analysis associated with this tool.
westpa.tools.data_reader module
- class westpa.tools.data_reader.WESTToolComponent
Bases:
object
Base class for WEST command line tools and components used in constructing tools
- add_all_args(parser)
Add arguments for all components from which this class derives to the given parser, starting with the class highest up the inheritance chain (most distant ancestor).
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- exclude_arg(argname)
- include_arg(argname)
- process_all_args(args)
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- set_arg_default(argname, value)
- westpa.tools.data_reader.get_object(object_name, path=None)
Attempt to load the given object, using additional path information if given.
- class westpa.tools.data_reader.FnDSSpec(h5file_or_name, fn)
Bases:
FileLinkedDSSpec
- get_iter_data(n_iter, seg_slice=(slice(None, None, None),))
- class westpa.tools.data_reader.MultiDSSpec(dsspecs)
Bases:
DSSpec
- get_iter_data(n_iter, seg_slice=(slice(None, None, None),))
- class westpa.tools.data_reader.SingleSegmentDSSpec(h5file_or_name, dsname, alias=None, slice=None)
Bases:
SingleDSSpec
- get_iter_data(n_iter, seg_slice=(slice(None, None, None),))
- get_segment_data(n_iter, seg_id)
- class westpa.tools.data_reader.SingleIterDSSpec(h5file_or_name, dsname, alias=None, slice=None)
Bases:
SingleDSSpec
- get_iter_data(n_iter, seg_slice=(slice(None, None, None),))
- class westpa.tools.data_reader.WESTDataReader
Bases:
WESTToolComponent
Tool for reading data from WEST-related HDF5 files. Coordinates finding the main HDF5 file from west.cfg or command line arguments, caching of certain kinds of data (eventually), and retrieving auxiliary data sets from various places.
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- open(mode='r')
- close()
- property weight_dsspec
- property parent_id_dsspec
- class westpa.tools.data_reader.WESTDSSynthesizer(default_dsname=None, h5filename=None)
Bases:
WESTToolComponent
Tool for synthesizing a dataset for analysis from other datasets. This may be done using a custom function, or a list of “data set specifications”. It is anticipated that if several source datasets are required, then a tool will have multiple instances of this class.
- group_name = 'input dataset options'
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- class westpa.tools.data_reader.WESTWDSSynthesizer(default_dsname=None, h5filename=None)
Bases:
WESTToolComponent
- group_name = 'weight dataset options'
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
westpa.tools.dtypes module
Numpy/HDF5 data types shared among several WESTPA tools
- westpa.tools.dtypes.n_iter_dtype
alias of
uint32
- westpa.tools.dtypes.seg_id_dtype
alias of
int64
- westpa.tools.dtypes.weight_dtype
alias of
float64
westpa.tools.iter_range module
- class westpa.tools.iter_range.WESTToolComponent
Bases:
object
Base class for WEST command line tools and components used in constructing tools
- add_all_args(parser)
Add arguments for all components from which this class derives to the given parser, starting with the class highest up the inheritance chain (most distant ancestor).
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- exclude_arg(argname)
- include_arg(argname)
- process_all_args(args)
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- set_arg_default(argname, value)
- class westpa.tools.iter_range.IterRangeSelection(data_manager=None)
Bases:
WESTToolComponent
Select and record limits on iterations used in analysis and/or reporting. This class provides both the user-facing command-line options and parsing, and the application-side API for recording limits in HDF5.
HDF5 datasets calculated based on a restricted set of iterations should be tagged with the following attributes:
first_iter
The first iteration included in the calculation.
last_iter
One past the last iteration included in the calculation.
iter_step
Blocking or sampling period for iterations included in the calculation.
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- process_args(args, override_iter_start=None, override_iter_stop=None, default_iter_step=1)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- iter_block_iter()
Return an iterable of (block_start,block_end) over the blocks of iterations selected by –first-iter/–last-iter/–step-iter.
- n_iter_blocks()
Return the number of blocks of iterations (as returned by
iter_block_iter
) selected by –first-iter/–last-iter/–step-iter.
- record_data_iter_range(h5object, iter_start=None, iter_stop=None)
Store attributes
iter_start
anditer_stop
on the given HDF5 object (group/dataset)
- record_data_iter_step(h5object, iter_step=None)
Store attribute
iter_step
on the given HDF5 object (group/dataset).
- check_data_iter_range_least(h5object, iter_start=None, iter_stop=None)
Check that the given HDF5 object contains (as denoted by its
iter_start
/iter_stop
attributes) data at least for the iteration range specified.
- check_data_iter_range_equal(h5object, iter_start=None, iter_stop=None)
Check that the given HDF5 object contains (as denoted by its
iter_start
/iter_stop
attributes) data exactly for the iteration range specified.
- check_data_iter_step_conformant(h5object, iter_step=None)
Check that the given HDF5 object contains per-iteration data at an iteration stride suitable for extracting data with the given stride (in other words, the given
iter_step
is a multiple of the stride with which data was recorded).
- check_data_iter_step_equal(h5object, iter_step=None)
Check that the given HDF5 object contains per-iteration data at an iteration stride the same as that specified.
- slice_per_iter_data(dataset, iter_start=None, iter_stop=None, iter_step=None, axis=0)
Return the subset of the given dataset corresponding to the given iteration range and stride. Unless otherwise specified, the first dimension of the dataset is the one sliced.
- iter_range(iter_start=None, iter_stop=None, iter_step=None, dtype=None)
Return a sequence for the given iteration numbers and stride, filling in missing values from those stored on
self
. The smallest data type capable of holdingiter_stop
is returned unless otherwise specified using thedtype
argument.
westpa.tools.kinetics_tool module
- class westpa.tools.kinetics_tool.WESTDataReader
Bases:
WESTToolComponent
Tool for reading data from WEST-related HDF5 files. Coordinates finding the main HDF5 file from west.cfg or command line arguments, caching of certain kinds of data (eventually), and retrieving auxiliary data sets from various places.
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- close()
- open(mode='r')
- property parent_id_dsspec
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- property weight_dsspec
- class westpa.tools.kinetics_tool.IterRangeSelection(data_manager=None)
Bases:
WESTToolComponent
Select and record limits on iterations used in analysis and/or reporting. This class provides both the user-facing command-line options and parsing, and the application-side API for recording limits in HDF5.
HDF5 datasets calculated based on a restricted set of iterations should be tagged with the following attributes:
first_iter
The first iteration included in the calculation.
last_iter
One past the last iteration included in the calculation.
iter_step
Blocking or sampling period for iterations included in the calculation.
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- check_data_iter_range_equal(h5object, iter_start=None, iter_stop=None)
Check that the given HDF5 object contains (as denoted by its
iter_start
/iter_stop
attributes) data exactly for the iteration range specified.
- check_data_iter_range_least(h5object, iter_start=None, iter_stop=None)
Check that the given HDF5 object contains (as denoted by its
iter_start
/iter_stop
attributes) data at least for the iteration range specified.
- check_data_iter_step_conformant(h5object, iter_step=None)
Check that the given HDF5 object contains per-iteration data at an iteration stride suitable for extracting data with the given stride (in other words, the given
iter_step
is a multiple of the stride with which data was recorded).
- check_data_iter_step_equal(h5object, iter_step=None)
Check that the given HDF5 object contains per-iteration data at an iteration stride the same as that specified.
- iter_block_iter()
Return an iterable of (block_start,block_end) over the blocks of iterations selected by –first-iter/–last-iter/–step-iter.
- iter_range(iter_start=None, iter_stop=None, iter_step=None, dtype=None)
Return a sequence for the given iteration numbers and stride, filling in missing values from those stored on
self
. The smallest data type capable of holdingiter_stop
is returned unless otherwise specified using thedtype
argument.
- n_iter_blocks()
Return the number of blocks of iterations (as returned by
iter_block_iter
) selected by –first-iter/–last-iter/–step-iter.
- process_args(args, override_iter_start=None, override_iter_stop=None, default_iter_step=1)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- record_data_iter_range(h5object, iter_start=None, iter_stop=None)
Store attributes
iter_start
anditer_stop
on the given HDF5 object (group/dataset)
- record_data_iter_step(h5object, iter_step=None)
Store attribute
iter_step
on the given HDF5 object (group/dataset).
- slice_per_iter_data(dataset, iter_start=None, iter_stop=None, iter_step=None, axis=0)
Return the subset of the given dataset corresponding to the given iteration range and stride. Unless otherwise specified, the first dimension of the dataset is the one sliced.
- class westpa.tools.kinetics_tool.WESTSubcommand(parent)
Bases:
WESTToolComponent
Base class for command-line tool subcommands. A little sugar for making this more uniform.
- add_to_subparsers(subparsers)
- description = None
- go()
- help_text = None
- subcommand = None
- property work_manager
The work manager for this tool. Raises AttributeError if this is not a parallel tool.
- class westpa.tools.kinetics_tool.ProgressIndicatorComponent
Bases:
WESTToolComponent
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- westpa.tools.kinetics_tool.generate_future(work_manager, name, eval_block, kwargs)
- class westpa.tools.kinetics_tool.WESTKineticsBase(parent)
Bases:
WESTSubcommand
Common argument processing for w_direct/w_reweight subcommands. Mostly limited to handling input and output from w_assign.
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- class westpa.tools.kinetics_tool.AverageCommands(parent)
Bases:
WESTKineticsBase
- default_output_file = 'direct.h5'
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- stamp_mcbs_info(dataset)
- open_files()
- open_assignments()
- print_averages(dataset, header, dim=1)
- run_calculation(pi, nstates, start_iter, stop_iter, step_iter, dataset, eval_block, name, dim, do_averages=False, **extra)
westpa.tools.plot module
- class westpa.tools.plot.Plotter(h5file, h5key, iteration=-1, interface='matplotlib')
Bases:
object
This is a semi-generic plotting interface that has a built in curses based terminal plotter. It’s fairly specific to what we’re using it for here, but we could (and maybe should) build it out into a little library that we can use via the command line to plot things. Might be useful for looking at data later. That would also cut the size of this tool down by a good bit.
- plot(i=0, j=1, tau=1, iteration=None, dim=0, interface=None)
westpa.tools.progress module
- class westpa.tools.progress.ProgressIndicator(stream=None, interval=1)
Bases:
object
- clear()
- draw()
- draw_fancy()
- draw_simple()
- property extent
- new_operation(operation, extent=None, progress=0)
- property operation
- property progress
- start()
- stop()
- class westpa.tools.progress.WESTToolComponent
Bases:
object
Base class for WEST command line tools and components used in constructing tools
- add_all_args(parser)
Add arguments for all components from which this class derives to the given parser, starting with the class highest up the inheritance chain (most distant ancestor).
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- exclude_arg(argname)
- include_arg(argname)
- process_all_args(args)
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- set_arg_default(argname, value)
- class westpa.tools.progress.ProgressIndicatorComponent
Bases:
WESTToolComponent
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
westpa.tools.selected_segs module
- class westpa.tools.selected_segs.WESTToolComponent
Bases:
object
Base class for WEST command line tools and components used in constructing tools
- add_all_args(parser)
Add arguments for all components from which this class derives to the given parser, starting with the class highest up the inheritance chain (most distant ancestor).
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- exclude_arg(argname)
- include_arg(argname)
- process_all_args(args)
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- set_arg_default(argname, value)
- westpa.tools.selected_segs.seg_id_dtype
alias of
int64
- class westpa.tools.selected_segs.SegmentSelection(iterable=None)
Bases:
object
Initialize this segment selection from an iterable of (n_iter,seg_id) pairs.
- add(pair)
- from_iter(n_iter)
- property start_iter
- property stop_iter
- classmethod from_text(filename)
- class westpa.tools.selected_segs.AllSegmentSelection(start_iter=None, stop_iter=None, data_manager=None)
Bases:
SegmentSelection
Initialize this segment selection from an iterable of (n_iter,seg_id) pairs.
- add(pair)
- from_iter(n_iter)
- class westpa.tools.selected_segs.SegSelector
Bases:
WESTToolComponent
- add_args(parser)
Add arguments specific to this component to the given argparse parser.
- process_args(args)
Take argparse-processed arguments associated with this component and deal with them appropriately (setting instance variables, etc)
- parse_segsel_file(filename)
westpa.tools.wipi module
- class westpa.tools.wipi.Plotter(h5file, h5key, iteration=-1, interface='matplotlib')
Bases:
object
This is a semi-generic plotting interface that has a built in curses based terminal plotter. It’s fairly specific to what we’re using it for here, but we could (and maybe should) build it out into a little library that we can use via the command line to plot things. Might be useful for looking at data later. That would also cut the size of this tool down by a good bit.
- plot(i=0, j=1, tau=1, iteration=None, dim=0, interface=None)
- class westpa.tools.wipi.KineticsIteration(kin_h5file, index, assign, iteration=-1)
Bases:
object
- keys()
- class westpa.tools.wipi.WIPIScheme(scheme, name, parent, settings)
Bases:
object
- property scheme
- property list_schemes
Lists what schemes are configured in west.cfg file. Schemes should be structured as follows, in west.cfg:
- west:
- system:
- analysis:
directory: analysis analysis_schemes:
- scheme.1:
enabled: True states:
label: unbound coords: [[7.0]]
label: bound coords: [[2.7]]
- bins:
type: RectilinearBinMapper boundaries: [[0.0, 2.80, 7, 10000]]
- property iteration
- property assign
- property direct
The output from w_direct.py from the current scheme.
- property state_labels
- property bin_labels
- property west
- property reweight
- property current
The current iteration. See help for __get_data_for_iteration__
- property past
The previous iteration. See help for __get_data_for_iteration__