-
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
Conversation
| 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, |
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:
db.grain_boundaries.aggregate([
{
$project: {
_id: 0,
init_axis: "$initial_structure.rotation_axis",
final_axis: "$final_structure.rotation_axis",
},
},
{
$facet: {
init_axis: [
{ $unwind: "$init_axis" },
{ $group: { _id: { $type: "$init_axis" }, count: { $sum: 1 } } },
],
final_axis: [
{ $unwind: "$final_axis" },
{ $group: { _id: { $type: "$final_axis" }, count: { $sum: 1 } } },
],
},
},
]);
-----
[
{
init_axis: [ { _id: 'int', count: 1008 } ],
final_axis: [ { _id: 'int', count: 1009 } ]
}
]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 str is a holdover from before, the float is wrong, I'll change that to int. To make the API request, it just needs to format into a str like you said, so it's OK
| ) | ||
|
|
||
| if rotation_axis: | ||
| if len(rotation_axis) != 3: |
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.
there are also instances of rotation_axis = [ 0, 0, 0, 1 ]
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.
You're right - changed this overall just to use tuple[ int * 3] or tuple[int * 4] as the type hint and for the value check
|
@esoteric-ephemera Is this ok to merge or does it need additional changes? |
|
@tschaume ready to merge! |
Related to #991, the type hinting and docstr for
rotation_axisinGrainBoundaryResterwere misleading