Skip to content

Commit

Permalink
Fixes for w_ipa run_calculation and reading filenames from h5 file (#147
Browse files Browse the repository at this point in the history
)

* added pull templates and issues templates

* removed westpa 2.0 workflows

* small fix to a potential bug in kinetics_tool

* Update README.rst

* Fixed a bug caused by bytestring when reading the basis state filename from west.h5

* Revert "Merge pull request #3 from westpa/main"

This reverts commit 7257846, reversing
changes made to b13b32a.

* documentation changes

* minor change`

* Update src/westpa/core/h5io.py

Changed based on review.

Co-authored-by: Jeremy Leung <63817169+jeremyleung521@users.noreply.github.com>

Co-authored-by: Jeremy Leung <jeremyleung521@gmail.com>
Co-authored-by: Jeremy Leung <63817169+jeremyleung521@users.noreply.github.com>
Co-authored-by: She Zhang <she.zhang@eyesopen.com>
Co-authored-by: Lillian Chong <ltchong@pitt.edu>
  • Loading branch information
5 people committed Mar 26, 2021
1 parent 96f2dc8 commit f1df2b5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/westpa/core/data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def get_basis_states(self, n_iter=None):
state_id=i,
label=row['label'],
probability=row['probability'],
auxref=str(row['auxref']) or None,
auxref=h5io.tostr(row['auxref']) or None,
pcoord=pcoord.copy(),
)
for (i, (row, pcoord)) in enumerate(zip(bstate_index, bstate_pcoords))
Expand Down
12 changes: 12 additions & 0 deletions src/westpa/core/h5io.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ def calc_chunksize(shape, dtype, max_chunksize=262144):
return chunk_shape


def tostr(b):
'''Convert a nonstandard string object ``b`` to str with the handling of the
case where ``b`` is bytes.'''

if b is None:
return None
elif isinstance(b, bytes):
return b.decode('utf-8')
else:
return str(b)


#
# Group and dataset manipulation functions
#
Expand Down
2 changes: 1 addition & 1 deletion src/westpa/tools/kinetics_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def run_calculation(
# This is appropriate for bootstrapped quantities, I think.
all_items = np.arange(1, len(start_pts) + 1)
bootstrap_length = 0.5 * (len(start_pts) * (len(start_pts) + 1)) - np.delete(
all_items, np.arange(1, len(start_pts) + 1, step_iter)
all_items, np.arange(1, len(start_pts), step_iter)
)
if True:
pi.new_operation('Calculating {}'.format(name), bootstrap_length[0])
Expand Down

0 comments on commit f1df2b5

Please sign in to comment.