Hi Schuyler,
I'm a little confused as to what isn't working on your end. Is `bin_mapper.assign()` erroring out based on your input? If so, I'll try to answer with an example.
Here's an example, with a 2x2 binning scheme, mapping four points into it:
```
In [1]: from westpa.core.binning import RectilinearBinMapper
In [2]: bm = RectilinearBinMapper([[0, 5, 10], [0, 5, 10]])
In [3]: bm.assign([[1,1], [1,7], [7,1], [7,7]])
Out[3]: array([0, 1, 2, 3], dtype=uint16)
```
This shows that the four points, which are 2D, are mapped to bins [0, 1, 2, 3]. If you're not using any recursive bins, these indices are expanded in row-major order. Otherwise, it's a little more complicated (
https://github.com/westpa/westpa/pull/524).
Attaching code below on loading the bin mapper, just in case you need it.
However, it seems that the code enforces that the type be simply of float.
```
I'm also not sure I'm seeing this in the code. but the rest of your assumptions are correct.
Best,
Jeremy L.
---
Jeremy M. G. Leung, PhDResearch Assistant Professor, Chemistry (Chong Lab)
University of Pittsburgh | 219 Parkman Avenue, Pittsburgh, PA 15260
jml...@pitt.edu | [He, Him, His]
```
# load_binmapper.py
#
# Code to load in the BinMapper from a WESTPA HDF5 file.
#
# Modify the `if __name__ == '__main__'` block at the end to your liking.
# You can also pass in an argument to replace the iteration you want to look at.
# When n_iter=None, it implies that it'll look at the last possible iteration.
#
# Note that RecursiveBinMapper had a bug where the binlabels and bin_indices are mismatched
# for simulations created on versions >=2022.06.
#
# By Jeremy Leung
#
# Last Modified: Oct 31, 2024
from westpa.tools.binning import mapper_from_hdf5
import h5py
import sys
def load_mapper(h5_filename='west.h5', n_iter=None):
'''
Function to load in the bin mapper from the HDF5 File.
'''
with h5py.File(h5_filename) as h5file:
if n_iter is None:
n_iter = h5file.attrs['west_current_iteration']
while True:
# There are times where the last iteration might not exist.
# This `while` loop will attempt to resolve that.
try:
h5file[f'iterations/iter_{n_iter:>08}'].attrs['binhash']
break
except KeyError:
n_iter -= 1
print(f'looking at iteration {n_iter}')
binhash = h5file[f'iterations/iter_{n_iter:>08}'].attrs['binhash']
bingroup = h5file['bin_topologies']
mapper, mapper_pickle, mapper_hash = mapper_from_hdf5(bingroup, binhash)
return mapper, mapper_pickle, mapper_hash
if __name__ == '__main__':
if len(sys.argv) > 1:
n_iter = sys.argv[1]
```