Writing partition labels to state object

Dear all,

Given a NestedBlockState object called state, I can obtain the list of nested group belongings by

x = state.get_bs()

I can then order the partitions by

y = order_nested_partition_labels(x)

Is there a way to store the ordered labels in the original NestedBlockState object? How do I have to write that?

Many thanks


attachment.html (2.33 KB)

Just create a new NestedBlockState (or, equivalently, copy the from the
old one):

   state = NestedBlockState(g, bs=y)


   state = state.copy(bs=y)