Add new API for getting Jacobian information about model.#41
Add new API for getting Jacobian information about model.#41hsorby merged 8 commits intoABI-Software:mainfrom
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.
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
|
|
||
| return None, None | ||
|
|
||
| def getModelWorstElementJacobianInfo(self, mesh_group=None): |
There was a problem hiding this comment.
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.
ChangeManager is redundant here.
src/scaffoldfitter/fitter.py
Outdated
|
|
||
| return report | ||
|
|
||
| def getModelWorstElementJacobianInfoForGroup(self, group_name): |
There was a problem hiding this comment.
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.
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.
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.finiteelement import evaluate_field_nodeset_range, findNodeWithName, getMaximumNodeIdentifier | ||
| from cmlibs.utils.zinc.finiteelement import evaluate_field_nodeset_range, findNodeWithName | ||
| 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.
Might be some changes to name and locations of these cmlibs.utils.
| :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.
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.