You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cell 8 in SheafBuildingExample.ipynb breaks. The problem seems to be a change in ComputeConsistency() and the default for an attribute of the Cell class.
In an older version of the code, Cell in pysheaf.py had the attribute mExtendedAssignmentConsistancyWeightDivisor that was defaulted to 2.0. In the new version, it's replaced with mExtendedAssignmentConsistancyWeight that's defaulted to None. As a result, the code tries compute a norm on an empty array on Line 181 of pysheaf.py in ComputeConsistency()
if self.mExtendedAssignmentConsistancyWeight is not None:
for current_assignment_index in range(len(tmp_assignments)):
for test_assignment_index in range(len(tmp_assignments)):
if current_assignment_index != test_assignment_index:
assignment_comparisions.append(self.Compare(tmp_assignments[current_assignment_index].mValue,tmp_assignments[test_assignment_index].mValue)*self.mExtendedAssignmentConsistancyWeight)
return np.linalg.norm(np.array(assignment_comparisions,dtype='float'),ord=numpyNormType) # ComputeConsistency
But that's probably not enough. The criteria to compute consistencies should also probably change (see last line):
def AbleToComputeConsistency(self):
multiple_extended_assignments = (len(self.mExtendedAssignments) > 1)
data_and_extended_assignments = self.mDataAssignmentPresent and (len(self.mExtendedAssignments) != 0)
return (multiple_extended_assignments and self.mExtendedAssignmentConsistancyWeight!=None) or data_and_extended_assignments # AbleToComputeConsistency
The code also should probably check that a norm isn't computed on an empty list:
def ComputeLocalConsistencyRadius(self,cellIndices=None):
"""
This method will call compute consistency on all cells (default) or those specified by cellIndices in the sheaf.
The default behavior is to then return the max error. This can be changed by setting mNumpyNormType
:returns: consistency radius of the sheaf assignment
"""
if cellIndices is None:
cell_index_list = self.nodes()
else:
cell_index_list = cellIndices
cell_consistancies_list = []
for cell_index in cell_index_list:
if self.GetCell(cell_index).AbleToComputeConsistency() == True:
if cellIndices is None:
cell_consistancies_list.append(self.GetCell(cell_index).ComputeConsistency(self.mNumpyNormType))
else:
cell_consistancies_list.append(self.GetCell(cell_index).ComputeConsistency(self.mNumpyNormType, cellStartIndices=cellIndices))
if len(cell_consistancies_list)>0:
return np.linalg.norm(cell_consistancies_list,ord=self.mNumpyNormType) # ComputeConsistencyRadius
else:
return None
The text was updated successfully, but these errors were encountered:
Cell 8 in
SheafBuildingExample.ipynb
breaks. The problem seems to be a change inComputeConsistency()
and the default for an attribute of theCell
class.In an older version of the code,
Cell
inpysheaf.py
had the attributemExtendedAssignmentConsistancyWeightDivisor
that was defaulted to 2.0. In the new version, it's replaced withmExtendedAssignmentConsistancyWeight
that's defaulted toNone
. As a result, the code tries compute a norm on an empty array on Line 181 ofpysheaf.py
inComputeConsistency()
One fix is to add this to Cell 8:
But that's probably not enough. The criteria to compute consistencies should also probably change (see last line):
The code also should probably check that a norm isn't computed on an empty list:
The text was updated successfully, but these errors were encountered: