Skip to content
Snippets Groups Projects
Commit 2f5c5701 authored by valentin.emiya's avatar valentin.emiya
Browse files

fix issue #3: display x for partial and full missing values

parent 23482ea5
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -704,18 +704,26 @@ class MadArray(np.ndarray):
arr[self.unknown_mask] = np.nan
arr_str = np.ndarray.__str__(arr)
if np.isrealobj(arr):
arr_str = arr_str.replace('nan', ' x')
else:
arr_str = arr_str.replace('nan+0.j', ' x ')
if np.issubdtype(self.dtype, np.integer):
arr_str = arr_str.replace('.', '')
if self._complex_masking:
n_all_unknown = np.count_nonzero(self.all_unknown_mask)
string = 'MadArray, dtype={0}, ' \
'{1[0]} missing magnitudes ({2[0]:.1%}) ' \
'and {1[1]} missing phases ({2[1]:.1%})\n{3}'
'and {1[1]} missing phases ({2[1]:.1%}), ' \
' including {3} missing magnitudes and phases jointly ' \
'({4:.1%})\n{5}'
return string.format(self.dtype,
self.n_missing_data,
self.ratio_missing_data,
n_all_unknown,
n_all_unknown/self.size,
arr_str)
else:
string = 'MadArray, dtype={}, {} missing entries ({:.1%})\n{}'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment