[file_handler] add unit and label to descriptors
This commit is contained in:
parent
87ce01cbe1
commit
b9af87d6b6
@ -201,6 +201,8 @@ class FileHandler(metaclass=Singleton):
|
|||||||
itd.value = "%s %s entries" % (str(e.shape), e.dtype)
|
itd.value = "%s %s entries" % (str(e.shape), e.dtype)
|
||||||
itd.best_xdim = self.guess_best_xdim(e)
|
itd.best_xdim = self.guess_best_xdim(e)
|
||||||
itd.suggested_plotter = self.suggested_plotter(e)
|
itd.suggested_plotter = self.suggested_plotter(e)
|
||||||
|
itd.unit = e.unit
|
||||||
|
itd.label = e.label
|
||||||
elif entity_type == NodeType.Tag:
|
elif entity_type == NodeType.Tag:
|
||||||
point_or_segment = "segment" if e.extent else "point"
|
point_or_segment = "segment" if e.extent else "point"
|
||||||
start = str(e.position)
|
start = str(e.position)
|
||||||
@ -261,9 +263,19 @@ class FileHandler(metaclass=Singleton):
|
|||||||
for i, d in enumerate(da.dimensions):
|
for i, d in enumerate(da.dimensions):
|
||||||
dim_name = "%i. dim: %s" % (i+1, d.label if hasattr(d, "label") else "")
|
dim_name = "%i. dim: %s" % (i+1, d.label if hasattr(d, "label") else "")
|
||||||
dim_type= "%s %s" % (d.dimension_type, "dimension")
|
dim_type= "%s %s" % (d.dimension_type, "dimension")
|
||||||
dimensions.append(ItemDescriptor(dim_name, type=dim_type, entity_type=NodeType.Dimension, block_id=block_id))
|
unit = d.unit if hasattr(d, "unit") else None
|
||||||
|
label = d.label if hasattr(d, "label") else None
|
||||||
|
dimensions.append(ItemDescriptor(dim_name, type=dim_type, entity_type=NodeType.Dimension, block_id=block_id, unit=unit, label=label))
|
||||||
return dimensions
|
return dimensions
|
||||||
|
|
||||||
|
def request_axis(self, block_id, array_id, index, count, start=0):
|
||||||
|
da = self._entity_buffer.get(array_id)
|
||||||
|
if da is None:
|
||||||
|
b = self.get_block(block_id)
|
||||||
|
da = b.data_arrays[array_id]
|
||||||
|
dim = da.dimensions[index]
|
||||||
|
return np.asarray(dim.axis(count, start))
|
||||||
|
|
||||||
def request_data_frames(self, block_id):
|
def request_data_frames(self, block_id):
|
||||||
if self._nix_file.version[1] >= 2:
|
if self._nix_file.version[1] >= 2:
|
||||||
b = self.get_block(block_id)
|
b = self.get_block(block_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user