-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add new API for getting Jacobian information about model. #41
Conversation
src/scaffoldfitter/fitter.py
Outdated
""" | ||
with ChangeManager(self._fieldmodule): | ||
jacobian = calculate_jacobian(self._modelCoordinatesField) | ||
report = report_on_lowest_value(jacobian, mesh_group if mesh_group else 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.
Add following line within context manager:
del jacobian
so no notification about field ever existing.
Note I'd also prefer mesh_3d to be discovered here and a mesh or mesh_group passed to the function creating the jacobian field.
src/scaffoldfitter/fitter.py
Outdated
@@ -852,6 +853,37 @@ def getDataRMSAndMaximumProjectionErrorForGroup(self, groupName): | |||
|
|||
return None, None | |||
|
|||
def getModelWorstElementJacobianInfo(self, mesh_group=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.
getLowestElementJacobian(self, mesh_group=None)
Add comment that a value <= 0.0 is bad, either zero or negative volume / left-handed coordinates.
src/scaffoldfitter/fitter.py
Outdated
:param group_name: Name of group to make calculation over. | ||
:return: Element identifier, minimum jacobian value. | ||
""" | ||
with ChangeManager(self._fieldmodule): |
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.
ChangeManager is redundant here.
src/scaffoldfitter/fitter.py
Outdated
|
||
return report | ||
|
||
def getModelWorstElementJacobianInfoForGroup(self, group_name): |
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.
getLowestElementJacobianForGroupName
src/scaffoldfitter/fitter.py
Outdated
If the group_name is not a valid group name then None, None is returned. | ||
|
||
:param group_name: Name of group to make calculation over. | ||
:return: Element identifier, minimum jacobian value. |
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.
Need to note returns -1, inf if failed to evaluate, but this is at odds with returning None, None below.
src/scaffoldfitter/fitter.py
Outdated
""" | ||
group = self._fieldmodule.findFieldByName(group_name).castGroup() | ||
if group.isValid(): | ||
return self.getLowestElementJacobian(group) |
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.
Need to get mesh group for highest dimension mesh and pass it here; it doesn't a group field.
src/scaffoldfitter/fitter.py
Outdated
from cmlibs.utils.zinc.general import ChangeManager | ||
from cmlibs.utils.zinc.field import get_element_jacobian_field, get_scalar_field_minimum_in_mesh |
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.
Might be some changes to name and locations of these cmlibs.utils.
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.
Looks good.
:return: Element identifier, minimum jacobian value. Values are -1, inf if there is no data or bad fields. | ||
""" | ||
with ChangeManager(self._fieldmodule): | ||
jacobian = create_xi_reference_jacobian_determinant_field(self._modelCoordinatesField) |
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.
needs reference coordinate field argument:
jacobian = create_jacobian_determinant_field(self._modelCoordinatesField, self._modelReferenceCoordinatesField)
also do a test evaluation in any test. in test_fitcube.py test_alignMarkersFitRegularData
No description provided.