w_ntop

usage:

w_ntop [-h] [-r RCFILE] [--quiet | --verbose | --debug] [--version] [-W WEST_H5FILE]
             [--first-iter N_ITER] [--last-iter N_ITER] [-a ASSIGNMENTS] [-n COUNT] [-t TIMEPOINT]
             [--highweight | --lowweight | --random] [-o OUTPUT]

Select walkers from bins . An assignment file mapping walkers to bins at each timepoint is required (see``w_assign –help`` for further information on generating this file). By default, high-weight walkers are selected (hence the name w_ntop: select the N top-weighted walkers from each bin); however, minimum weight walkers and randomly-selected walkers may be selected instead.

Output format

The output file (-o/–output, by default “ntop.h5”) contains the following datasets:

``/n_iter`` [iteration]
  *(Integer)* Iteration numbers for each entry in other datasets.

``/n_segs`` [iteration][bin]
  *(Integer)* Number of segments in each bin/state in the given iteration.
  This will generally be the same as the number requested with
  ``--n/--count`` but may be smaller if the requested number of walkers
  does not exist.

``/seg_ids`` [iteration][bin][segment]
  *(Integer)* Matching segments in each iteration for each bin.
  For an iteration ``n_iter``, only the first ``n_iter`` entries are
  valid. For example, the full list of matching seg_ids in bin 0 in the
  first stored iteration is ``seg_ids[0][0][:n_segs[0]]``.

``/weights`` [iteration][bin][segment]
  *(Floating-point)* Weights for each matching segment in ``/seg_ids``.

Command-line arguments

optional arguments:

-h, --help            show this help message and exit
--highweight          Select COUNT highest-weight walkers from each bin.
--lowweight           Select COUNT lowest-weight walkers from each bin.
--random              Select COUNT walkers randomly from each bin.

general options:

-r RCFILE, --rcfile RCFILE
                      use RCFILE as the WEST run-time configuration file (default: west.cfg)
--quiet               emit only essential information
--verbose             emit extra information
--debug               enable extra checks and emit copious information
--version             show program's version number and exit

WEST input data options:

-W WEST_H5FILE, --west-data WEST_H5FILE
                      Take WEST data from WEST_H5FILE (default: read from the HDF5 file specified in
                      west.cfg).

iteration range:

--first-iter N_ITER   Begin analysis at iteration N_ITER (default: 1).
--last-iter N_ITER    Conclude analysis with N_ITER, inclusive (default: last completed iteration).

input options:

-a ASSIGNMENTS, --assignments ASSIGNMENTS
                      Use assignments from the given ASSIGNMENTS file (default: assign.h5).

selection options:

-n COUNT, --count COUNT
                      Select COUNT walkers from each iteration for each bin (default: 1).
-t TIMEPOINT, --timepoint TIMEPOINT
                      Base selection on the given TIMEPOINT within each iteration. Default (-1)
                      corresponds to the last timepoint.

output options:

-o OUTPUT, --output OUTPUT
                      Write output to OUTPUT (default: ntop.h5).

westpa.cli.tools.w_ntop module

class westpa.cli.tools.w_ntop.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.cli.tools.w_ntop.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.cli.tools.w_ntop.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 and iter_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 holding iter_stop is returned unless otherwise specified using the dtype argument.

class westpa.cli.tools.w_ntop.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.cli.tools.w_ntop.seg_id_dtype

alias of int64

westpa.cli.tools.w_ntop.n_iter_dtype

alias of uint32

westpa.cli.tools.w_ntop.weight_dtype

alias of float64

westpa.cli.tools.w_ntop.assignments_list_to_table(nsegs, nbins, assignments)

Convert a list of bin assignments (integers) to a boolean table indicating indicating if a given segment is in a given bin

class westpa.cli.tools.w_ntop.WNTopTool

Bases: WESTTool

prog = 'w_ntop'
description = 'Select walkers from bins . An assignment file mapping walkers to\nbins at each timepoint is required (see``w_assign --help`` for further\ninformation on generating this file). By default, high-weight walkers are\nselected (hence the name ``w_ntop``: select the N top-weighted walkers from\neach bin); however, minimum weight walkers and randomly-selected walkers\nmay be selected instead.\n\n\n-----------------------------------------------------------------------------\nOutput format\n-----------------------------------------------------------------------------\n\nThe output file (-o/--output, by default "ntop.h5") contains the following\ndatasets:\n\n  ``/n_iter`` [iteration]\n    *(Integer)* Iteration numbers for each entry in other datasets.\n\n  ``/n_segs`` [iteration][bin]\n    *(Integer)* Number of segments in each bin/state in the given iteration.\n    This will generally be the same as the number requested with\n    ``--n/--count`` but may be smaller if the requested number of walkers\n    does not exist.\n\n  ``/seg_ids`` [iteration][bin][segment]\n    *(Integer)* Matching segments in each iteration for each bin.\n    For an iteration ``n_iter``, only the first ``n_iter`` entries are\n    valid. For example, the full list of matching seg_ids in bin 0 in the\n    first stored iteration is ``seg_ids[0][0][:n_segs[0]]``.\n\n  ``/weights`` [iteration][bin][segment]\n    *(Floating-point)* Weights for each matching segment in ``/seg_ids``.\n\n\n-----------------------------------------------------------------------------\nCommand-line arguments\n-----------------------------------------------------------------------------\n'
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.cli.tools.w_ntop.entry_point()