pedarProbe.node.PedarNode#
- class pedarProbe.node.PedarNode[source]#
Bases:
DynamicNodeDerived from
DynamicNodeto provide pedar data analysis feature.In this project,
pedarProbe.analyseprovides functionalities for data analysis andpedarProbe.exportprovides functionalities for result export.PedarNodeconveys a bunch of short-cut functions to facilitate the usability.Note
Class Attributes
- self.attributes
dict Dictionary of the analysed attributes, for example:
self.attributes['sensor_peak'] # peak pressure self.attributes['pti'] # pressure-time integral
Warning
The specific attribute is only available after calling the corresponding analysis method.
Attention
In the returned node tree of restructuring (
restructure()), all nodes’self.attributeswill be erased. This design is based on the fact that different layer layouts usually leads to different analysis results, therefore there is no reason for keeping old analysis results.- __init__(*args, **kwargs)#
Methods
__init__(*args, **kwargs)add_branch(branch_node)Add branch to the node.
branch_names()Return a list of branch nodes' names.
branches()Return a list of branch nodes objects.
change_loc_map(start_level, layout)Change
loc_mapwith a restructured layer layout representation.clean_copy()Create and return a deep copy of the node only with its major attributes, including
name,loc, andlevel.clear()collect_layer(layer, nodes)In the node tree starting from this node, recursively collect all nodes of a specific layer.
collect_leaf(nodes)Recursively collect all leaf nodes starting from this node.
copy()fromkeys([value])Create a new dictionary with keys from iterable and values set to value.
get(key[, default])Return the value for key if key is in the dictionary, else default.
heatmap([attr_name, range, is_export, ...])Generate, plot, and export the heatmap for an attribute.
is_layer(layer)Judgment of whether the node belongs to a specific layer.
is_leaf()Judgment of whether the node is a leaf node or not.
items()keys()layer_layout()Get the layer layout representation of the node tree starting from this node.
pop(k[,d])If key is not found, d is returned if given, otherwise KeyError is raised
popitem()2-tuple; but raise KeyError if D is empty.
print()Recursively print the structure of the node tree starting from this node.
restructure([layout])Return the restructured the node tree from this node.
sensor_peak([is_export, export_layer, ...])Analyse the peak pressure of each sensor in the leaf node level, and then average up layer by layer up to the this node.
sensor_pti([is_export, export_layer, ...])Analyse the pressure-time integral (PTI) of each sensor in the leaf node level, and then average up layer by layer up to the this node.
set_source(source_node)Set the source node of the node.
setdefault(key[, default])Insert key with a value of default if key is not in the dictionary.
setup(*args, **kwargs)Compared with
setup()of the base classDynamicNode, initialisation of theself.attributesis added.update([E, ]**F)If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
values()- setup(*args, **kwargs)[source]#
Compared with
setup()of the base classDynamicNode, initialisation of theself.attributesis added.
- sensor_peak(is_export=False, export_layer: str = 'root', export_folder='output', save_suffix: str = '')[source]#
Analyse the peak pressure of each sensor in the leaf node level, and then average up layer by layer up to the this node. Then for each node under this node, the peak pressure analysis result can be accessed with
self.attributes['sensor_peak'].- Parameters:
is_export – export the analysed result as a local file or not.
export_layer – if export as local file, the name of the layer to export.
export_folder – the folder of the exported file.
save_suffix –
the suffix added to the default export file name
sensor_peak.Tip
A specific suffix can avoid exported file be override by future export.
Example
n1.sensor_peak( is_export=True, export_layer='condition', export_folder='output', save_suffix='_1213' # export file name: sensor_peak_1213.xlsx )
- sensor_pti(is_export=False, export_layer: str = 'root', export_folder='output', save_suffix: str = '')[source]#
Analyse the pressure-time integral (PTI) of each sensor in the leaf node level, and then average up layer by layer up to the this node. Then for each node under this node, the PTI analysis result can be accessed with
self.attributes['sensor_pti'].- Parameters:
is_export – export the analysed result as a local file or not.
export_layer – if export as local file, the name of the layer to export.
export_folder – the folder of the exported file.
save_suffix –
the suffix added to the default export file name
sensor_pti.Tip
A specific suffix can avoid exported file be override by future export.
Example
n1.sensor_pti( is_export=True, export_layer='condition', export_folder='output', save_suffix='_1213' # export file name: sensor_pti_1213.xlsx )
- heatmap(attr_name: str = 'sensor_peak', range: Union[str, tuple] = 'static', is_export: bool = False, export_folder: str = 'output', save_suffix: str = '') FootHeatmap[source]#
Generate, plot, and export the heatmap for an attribute.
- Parameters:
attr_name – name of the attribute, same as its keyword in
self.attributes.is_export – export the analysed result as a local file or not.
export_layer – if export as local file, the name of the layer to export.
export_folder – the folder of the exported file.
save_suffix –
the suffix added to the default export file name
foot_heatmap.Tip
A specific suffix can avoid exported file be override by future export.
- Returns:
heatmap object that can be further used or manipulated.
- Return type:
Example
n1.heatmap( is_export=True, export_folder='output', save_suffix='_1213' # export file name: foot_heatmap_1213.png )
- self.attributes