rs-station / reciprocalspaceship

Tools for exploring reciprocal space
https://rs-station.github.io/reciprocalspaceship/
MIT License
28 stars 12 forks source link

DataSet.stack_anomalous() and DataSet.unstack_anomalous() should not handle unmerged DataSets #26

Closed JBGreisman closed 3 years ago

JBGreisman commented 3 years ago

Currently, DataSet.unstack_anomalous() can be used with unmerged data to assign reflections to Friedel+ and Friedel- columns, and DataSet.stack_anomalous() can be used to undo the action. In the two-column anomalous format, each reflection is kept on its own row, and NaNs are used to pad the unused columns.

We should revisit this design decision, because it seems to be an uncommon action for unmerged data. The new anomalous flag for hkl_to_asu seems preferable for assigning reflections to Friedel "zones" of the ASU, and if its useful to explicitly assign observations to Friedel+ or Friedel-, I think that will be better handled by a DataSet.assign_friedel() helper function (This would be significantly less memory-intensive, as well).

My plan here is to make DataSet.unstack_anomalous() and DataSet.stack_anomalous() only applicable to DataSet objects with the merged=True attribute. A ValueError (orAttributeError?) would be raised if the functions are invoked with merged=False DataSet objects.

Any additional thoughts?