rs-station / reciprocalspaceship

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

rs.utils.asu.in_asu() does not use the 'anomalous ASU' for stacked anomalous data. #194

Closed DHekstra closed 11 months ago

DHekstra commented 1 year ago

Not sure if this is an "issue" or not, but

this works:

`mtz="thermolysin_0.mtz" ds =rs.read_mtz(mtz_path+mtz)

ds.compute_dHKL(inplace=True) ds=ds.loc[(ds.dHKL>=custom_range[0]) & (ds.dHKL< custom_range[1]),ds.columns] ds, labels = ds.assign_resolution_bins(nbins) # adds resolution bins

completeness=rs.stats.completeness.compute_completeness(ds.hkl_to_asu(inplace=False,anomalous=True),\ bins=nbins, anomalous=True) completeness.head(nbins)`

but this fails:

`mtz="thermolysin_0.mtz" ds =rs.read_mtz(mtz_path+mtz)

ds.compute_dHKL(inplace=True) ds=ds.loc[(ds.dHKL>=custom_range[0]) & (ds.dHKL< custom_range[1]),ds.columns] ds, labels = ds.assign_resolution_bins(nbins) # adds resolution bins

ds=ds.stack_anomalous() completeness=rs.stats.completeness.compute_completeness(ds.hkl_to_asu(inplace=False,anomalous=True),\ bins=nbins, anomalous=True) completeness.head(nbins)`

The problem seems to be that the assumption is baked in that the user provides unstacked data such that in_asu, called on line 107 of compute_completenes() (see https://github.com/Hekstra-Lab/reciprocalspaceship/blob/98409cc8552d22d03d6100c6c1dd01cc369e9647/reciprocalspaceship/stats/completeness.py#L107) can use the +ASU, after which the data are stacked.

This is probably perfectly fine behavior. The main thing to do would be to add a comment to the doc string that the output should not be stacked.

JBGreisman commented 1 year ago

yep I agree with you that it should at least be clarified in the docstring that merged DataSet objects should be provided in two-column anomalous format.

I will have to think a bit harder about whether one-column anomalous data should be supported.