MDAnalysis / mdanalysis

MDAnalysis is a Python library to analyze molecular dynamics simulations.
https://mdanalysis.org
Other
1.32k stars 652 forks source link

**kwargs in AnalysisBase does not trigger errors #3431

Open lilyminium opened 3 years ago

lilyminium commented 3 years ago

Expected behavior

When I pass in keywords that don't exist to analysis classes, it fails.

Actual behavior

**kwargs in classes like RMSD get passed to AnalysisBase, which then silently ignores them.

Code to reproduce the behavior

R = rms.RMSD(ligand, ref_frame=0, superposition=False, center=False).run(start=0, step=25, stop=-1)

This is a very reasonable set of arguments to use, given that superposition and center are keywords in rms.rmsd. However, RMSD actually functions as rms.rmsd(superposition=True, center=True).

Additional context here: https://groups.google.com/d/msgid/mdnalysis-discussion/a0b0d7db-079b-4a7d-8125-81bb5c90e8d5n%40googlegroups.com?utm_medium=email&utm_source=footer

IMO we could just remove **kwargs from the AnalysisBase function signature for an indirect trigger.

Current version of MDAnalysis

orbeckst commented 3 years ago

Note that in #1463 we decided that verbose would be a kwarg for both __init__ and run(). So if we remove **kwargs (which sounds sensible) then we have to pass through verbose=None (or whatever the default ought to be) explicitly.

If we want to remove verbose from __init__ then we can only do it for 3.0 because it would be a breaking API change.