|
217 | 217 | from pathlib import PurePosixPath as PurePath |
218 | 218 |
|
219 | 219 | import h5py as h5 |
| 220 | +from matplotlib.rcsetup import validate_color_or_auto |
220 | 221 | import numpy as np |
221 | 222 |
|
222 | 223 | from .. import __version__ as nxversion |
@@ -4033,7 +4034,8 @@ def nxunits(self, value): |
4033 | 4034 |
|
4034 | 4035 | @property |
4035 | 4036 | def mask(self): |
4036 | | - """NXfield's mask as an array. |
| 4037 | + """ |
| 4038 | + NXfield's mask as an array. |
4037 | 4039 |
|
4038 | 4040 | Only works if the NXfield is in a group and has the 'mask' |
4039 | 4041 | attribute set or if the NXfield array is defined as a masked |
@@ -4074,6 +4076,25 @@ def mask(self, value): |
4074 | 4076 | else: |
4075 | 4077 | self._value = np.ma.array(self._value, mask=value) |
4076 | 4078 |
|
| 4079 | + @property |
| 4080 | + def nxinterpretation(self): |
| 4081 | + """ |
| 4082 | + Interpretation attribute |
| 4083 | +
|
| 4084 | + This attribute provides guidance on how to plot the field. |
| 4085 | + """ |
| 4086 | + if 'interpretation' in self.attrs: |
| 4087 | + return self.attrs['interpretation'] |
| 4088 | + else: |
| 4089 | + return None |
| 4090 | + |
| 4091 | + @nxinterpretation.setter |
| 4092 | + def nxinterpretation(self, value): |
| 4093 | + if is_text(value): |
| 4094 | + self.attrs['interpretation'] = value |
| 4095 | + else: |
| 4096 | + raise NeXusError('Invalid value for the interpretation attribute') |
| 4097 | + |
4077 | 4098 | def valid_attributes(self, group=None, definitions=None, deprecated=False): |
4078 | 4099 | """ |
4079 | 4100 | Return a list of valid attribute names for the NeXus field. |
|
0 commit comments