PyEMMA icon indicating copy to clipboard operation
PyEMMA copied to clipboard

Order of coarse grained states in coarse grained flux unclear

Open nsplattner opened this issue 9 years ago • 5 comments

The order (indices) of the coarse grained states obtained by

fluxAB = msm.tpt(M, A, B) fluxAB.coarse_grain(my_coarse_sets)

is unclear. A is always at index 0 and and B is always at index n, but the rest of the assignment is unclear. This is particularly confusing if A and B are two metastable sets obtained by PCCA and my_coarse_sets are all PCCA sets. In this case I get a coarse grained flux plot containing the same number of states as metastable sets provided, but with a different numbering. The assignment can be made, but requires matching of microstate indices, which is rather inconvenient.

It would be nice to have information on the change of indices here and a more convenient way to map the indices.

nsplattner avatar Dec 06 '16 17:12 nsplattner

The order of the intermediate sets is random because the coarse graining uses Python set operations to calculate intersections etc. Sets are unordered data structures, this is why we will loose this information on the way.

A very simple solution would be to replace the sets by OrderedSets (implemented in Cython, BSD over there: https://github.com/simonpercivall/orderedset)

We can include the code in _ext and compile the extension accordingly.

marscher avatar Dec 06 '16 17:12 marscher

Is this a duplicate of #981 ?

gph82 avatar Dec 06 '16 17:12 gph82

Its based on the same problem, but my request is more basic: I would just like to have a convenient way for assigning the output sets to the input sets. How they should be sorted is a different problem which probably needs some discussion.

nsplattner avatar Dec 06 '16 17:12 nsplattner

Sorry, got it. I also thought they'd be sorted by committor anyways, and not randomly. Thanks!

gph82 avatar Dec 06 '16 17:12 gph82

The internal state reshuffling can lead to wrong label placement and state scaling in plot_flux.

cwehmeyer avatar Jul 06 '18 13:07 cwehmeyer