-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Partial Fix: Change order of arguments for adding auxiliary data for 3.0 release (Issue #3811) #4532
base: develop
Are you sure you want to change the base?
Partial Fix: Change order of arguments for adding auxiliary data for 3.0 release (Issue #3811) #4532
Changes from all commits
2c2396c
fa5d964
d1f666a
1820d12
e65771f
87c63bd
87a0da2
57bf0f4
6dbb284
5d4ed18
d7147e6
ddd0ebd
1c6315c
6ad9ba0
8224244
0da1436
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1073,10 +1073,9 @@ def timeseries(self, asel: Optional['AtomGroup']=None, | |
raise ValueError(errmsg) | ||
return coordinates | ||
|
||
# TODO: Change order of aux_spec and auxdata for 3.0 release, cf. Issue #3811 | ||
def add_auxiliary(self, | ||
auxdata: Union[str, AuxReader], | ||
aux_spec: Union[str, Dict[str, str]] = None, | ||
auxdata: Union[str, AuxReader] = None, | ||
format: str = None, | ||
**kwargs) -> None: | ||
"""Add auxiliary data to be read alongside trajectory. | ||
|
@@ -1101,7 +1100,7 @@ def add_auxiliary(self, | |
pull-force.xvg:: | ||
|
||
u = MDAnalysis.Universe(PDB, XTC) | ||
u.trajectory.add_auxiliary('pull', 'pull-force.xvg') | ||
u.trajectory.add_auxiliary('pull-force.xvg', 'pull') | ||
|
||
The representative value for the current timestep may then be accessed | ||
as ``u.trajectory.ts.aux.pull`` or ``u.trajectory.ts.aux['pull']``. | ||
|
@@ -1120,7 +1119,7 @@ def add_auxiliary(self, | |
added as identified by a :attr:`data_selector`:: | ||
|
||
term_dict = {"temp": "Temperature", "epot": "Potential"} | ||
u.trajectory.add_auxiliary(term_dict, "ener.edr") | ||
u.trajectory.add_auxiliary("ener.edr", term_dict) | ||
|
||
Adding this data can be useful, for example, to filter trajectory | ||
frames based on non-coordinate data like the potential energy of each | ||
|
@@ -1140,9 +1139,6 @@ def add_auxiliary(self, | |
Auxiliary data is assumed to be time-ordered, with no duplicates. See | ||
the :ref:`Auxiliary API`. | ||
""" | ||
if auxdata is None: | ||
raise ValueError("No input `auxdata` specified, but it needs " | ||
"to be provided.") | ||
if type(auxdata) not in list(_AUXREADERS.values()): | ||
# i.e. if auxdata is a file, not an instance of an AuxReader | ||
reader_type = get_auxreader_for(auxdata) | ||
|
@@ -1523,7 +1519,7 @@ def copy(self): | |
# been modified since initial load | ||
new.ts = self.ts.copy() | ||
for auxname, auxread in self._auxs.items(): | ||
new.add_auxiliary(auxname, auxread.copy()) | ||
new.add_auxiliary(auxread.copy(), auxname) | ||
return new | ||
|
||
def __del__(self): | ||
|
@@ -1701,7 +1697,7 @@ def copy(self): | |
|
||
new.ts = self.ts.copy() | ||
for auxname, auxread in self._auxs.items(): | ||
new.add_auxiliary(auxname, auxread.copy()) | ||
new.add_auxiliary(auxread.copy(), auxname) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll eventually want this covered by tests. Not sure why it wasn't originally covered. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yes, from what i've seen in the tests there is |
||
# since the transformations have already been applied to the frame | ||
# simply copy the property | ||
new.transformations = self.transformations | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -451,7 +451,7 @@ def copy(self): | |
new[self.ts.frame] | ||
|
||
for auxname, auxread in self._auxs.items(): | ||
new.add_auxiliary(auxname, auxread.copy()) | ||
new.add_auxiliary(auxread.copy(), auxname) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tests... not your fault, though |
||
# since transformations are already applied to the whole trajectory | ||
# simply copy the property | ||
new.transformations = self.transformations | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a Change so it should go there.
Additionally, it's a breaking change (see @IAlibay 's comments) so it won't go into 2.8.0, which is unfortunate.
I'd suggest to make this clear, start a new section