-
Notifications
You must be signed in to change notification settings - Fork 51
Improve grain boundary docstr + check on query fields #992
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
Changes from 1 commit
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 |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ def search( | |
| gb_plane: list[str] | None = None, | ||
| gb_energy: tuple[float, float] | None = None, | ||
| pretty_formula: str | None = None, | ||
| rotation_axis: list[str] | None = None, | ||
| rotation_axis: tuple[str | float, str | float, str | float] | None = None, | ||
| rotation_angle: tuple[float, float] | None = None, | ||
| separation_energy: tuple[float, float] | None = None, | ||
| sigma: int | None = None, | ||
|
|
@@ -40,8 +40,10 @@ def search( | |
| material_ids (List[str]): List of Materials Project IDs to query with. | ||
| pretty_formula (str): Formula of the material. | ||
| rotation_angle (Tuple[float,float]): Minimum and maximum rotation angle in degrees to consider. | ||
| rotation_axis(List[str]): The Miller index of rotation axis. e.g., [1, 0, 0], [1, 1, 0], and [1, 1, 1] | ||
| sigma (int): Sigma value of grain boundary. | ||
| rotation_axis(List[str]): The Miller index of rotation axis. | ||
| A three-tuple of either int or str: e.g., | ||
| [1, 0, 0], [1, 1, 0], ["1", "1", "1"] | ||
| sigma (int): Sigma value of grain boundary. | ||
| separation_energy (Tuple[float,float]): Minimum and maximum work of separation energy in J/m³ to consider. | ||
| sigma (int): Sigma value of the boundary. | ||
| type (GBTypeEnum): Grain boundary type. | ||
|
|
@@ -84,6 +86,10 @@ def search( | |
| ) | ||
|
|
||
| if rotation_axis: | ||
| if len(rotation_axis) != 3: | ||
|
||
| raise ValueError( | ||
| '`rotation_axis` should be a three-tuple of either int or str, ex: (1,1,0), ("0","0","1")' | ||
| ) | ||
| query_params.update( | ||
| {"rotation_axis": ",".join([str(n) for n in rotation_axis])} | ||
| ) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
Does this really work as a union?and also why is the union str | float? The data types in the db are all int:
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.
obviously if this all "just works" since later on everything is cast to str and joined as a comma separated string then it's fine
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.
The
stris a holdover from before, thefloatis wrong, I'll change that toint. To make the API request, it just needs to format into astrlike you said, so it's OK