-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from timbernat/dev
Polymerist omnibus improvements
- Loading branch information
Showing
251 changed files
with
3,878 additions
and
782 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,3 +107,6 @@ ENV/ | |
|
||
# In-tree generated files | ||
*/_version.py | ||
|
||
# Espaloma junk output | ||
**/.model.pt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
'''Utilities for calculating properties from MD configurations and trajectories''' | ||
'''Utilities for calculating properties from MD configurations and trajectories''' | ||
|
||
__author__ = 'Timotej Bernat' | ||
__email__ = 'timotej.bernat@colorado.edu' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
'''Additional data shipped along with polymerist source code''' | ||
'''Additional data shipped along with polymerist source code''' | ||
|
||
__author__ = 'Timotej Bernat' | ||
__email__ = 'timotej.bernat@colorado.edu' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
'''General-purpose utilities constructed only with Python builtins + numpy''' | ||
'''General-purpose utilities constructed only with Python builtins + numpy''' | ||
|
||
__author__ = 'Timotej Bernat' | ||
__email__ = 'timotej.bernat@colorado.edu' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'''For dynamically inspecting and modifying attributes of Python objects''' | ||
|
||
__author__ = 'Timotej Bernat' | ||
__email__ = 'timotej.bernat@colorado.edu' | ||
|
||
from typing import Any, Optional, Union | ||
import re | ||
|
||
|
||
def compile_argfree_getable_attrs(obj : Any, getter_re : Union[str, re.Pattern]='.*', repl_str : Optional[str]=None) -> dict[str, Any]: | ||
'''Compile the values of all methods of an object which require no arguments other than perhaps the object itself (this EXCLUDES properties) | ||
Returns a dict whose keys are the names of the methods called and whose values are the return values of those object methods | ||
Can optionally filter the names of returned method using a regular expression, passed to "getter_re" | ||
Can also optionally replace the chosen regex with an arbitrary string (including the empty string), passed to "repl_str" | ||
Parameters | ||
---------- | ||
obj : Any | ||
Any object instance | ||
getter_re : str or re.Pattern (optional), default ".*" | ||
Optional regular expression to use for filtering down returned methods | ||
Only methods whose names match the target regex are returns | ||
repl_str : str (optional) | ||
If provided, will replace the | ||
for example, repl_str="" can be used to delete the regex from returned method names | ||
Returns | ||
------- | ||
getable_dict : dict[str, Any] | ||
dict whose keys are the selected method names and whose values are the corresponding method returns | ||
''' | ||
getable_dict = {} | ||
for attr_name in dir(obj): | ||
if re.search(getter_re, attr_name): | ||
try: | ||
attr_key = attr_name if (repl_str is None) else re.sub(getter_re, repl_str, attr_name) | ||
getable_dict[attr_key] = getattr(obj, attr_name)() | ||
except (TypeError, Exception): # TODO : find way to selectively intercept the Boost C++ wrapper ArgumentError | ||
pass | ||
return getable_dict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
'''Decorators for modifying functions and classes. Supply useful behaviors and/or eliminate boilerplate''' | ||
'''Decorators for modifying functions and classes. Supply useful behaviors and/or eliminate boilerplate''' | ||
|
||
__author__ = 'Timotej Bernat' | ||
__email__ = 'timotej.bernat@colorado.edu' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.