rs-station / reciprocalspaceship

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

Added convenience function to remove systematic absences #76

Closed kmdalton closed 3 years ago

kmdalton commented 3 years ago

I added a method to rs.DataSet which just drops systematically absent rows. This saves the user having to do something like

ds = ds[~ds.label_absences().ABSENT]

which can now by done by

ds = ds.remove_absences()

. This method supports the inplace argument, and by using pd.DataFrame.drop and operating at the ds.index level, I think it avoids using extra memory unnecessarily. This will be helpful for large, unmerged datasets. The recipe was a tad tricky to work out, so I figured we should just put it in a method. (Admittedly this part is a premature optimization, but I do think the method makes code cleaner at the user level).

@JBGreisman , let me know what you think

codecov-commenter commented 3 years ago

Codecov Report

Merging #76 (d6339d2) into main (6e0c932) will increase coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #76   +/-   ##
=======================================
  Coverage   98.92%   98.92%           
=======================================
  Files          40       40           
  Lines        1488     1494    +6     
=======================================
+ Hits         1472     1478    +6     
  Misses         16       16           
Flag Coverage Δ
unittests 98.92% <100.00%> (+<0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
reciprocalspaceship/dataset.py 99.07% <100.00%> (+0.01%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 712a6bb...d6339d2. Read the comment docs.