class documentation

class Model:

View In Hierarchy

Model class.

The model maintains a strict hierarchy of dependencies: parameters > metric > field > sampling volume > wire When a lower module's data changed, all higher modules are invalidated (i.e. have their calculation results reset).

Method __init__ Initializes the model.
Method calculate_field Calculates the field.
Method calculate_metric Calculates the metric.
Method calculate_parameters Calculates the parameters.
Method calculate_sampling_volume Calculates the sampling volume.
Method calculate_wire Calculates the wire.
Method field_type_select.setter Sets the currently selected field type.
Method get_valid_field Gets a field by type if the field is valid.
Method invalidate Invalidates multiple hierarchy levels at once, in descending order of hierarchy.
Method on_field_invalid Gets called when the field was invalidated.
Method on_field_valid Gets called when the field was successfully calculated.
Method on_metric_invalid Gets called when the metric was invalidated.
Method on_metric_valid Gets called when the metric was successfully calculated.
Method on_parameters_invalid Gets called when the parameters were invalidated.
Method on_parameters_valid Gets called when the parameters were successfully calculated.
Method on_sampling_volume_invalid Gets called when the sampling volume was invalidated.
Method on_sampling_volume_valid Gets called when the sampling volume was successfully calculated.
Method on_wire_invalid Gets called when the wire was invalidated.
Method on_wire_valid Gets called when the wire was successfully calculated.
Method set_field Sets the field.
Method set_metric Sets the metric.
Method set_parameters Sets the parameters.
Method set_sampling_volume Sets the sampling volume.
Method set_wire Sets the wire.
Class Variable DebugInvalidate Undocumented
Instance Variable field_type_select Currently selected field type
Instance Variable gui Undocumented
Instance Variable metric Undocumented
Instance Variable parameters Undocumented
Instance Variable sampling_volume Undocumented
Instance Variable wire Undocumented
Property field Currently selected field
Property valid True if model is valid, False otherwise
Instance Variable _field_cache Undocumented
Instance Variable _field_type_select Undocumented
def __init__(self, gui):
Initializes the model.
Parameters
gui:GUIGUI
def calculate_field(self, progress_callback, num_cores, backend_type):
Calculates the field.
Parameters
progress_callback:CallableProgress callback
num_cores:intNumber of CPU cores to use
backend_type:intBackend type
Returns
boolTrue if successful, False if interrupted
def calculate_metric(self, progress_callback):
Calculates the metric.
Parameters
progress_callback:CallableProgress callback
Returns
boolTrue (currently non-interruptable)
def calculate_parameters(self, progress_callback):
Calculates the parameters.
Parameters
progress_callback:CallableProgress callback
Returns
boolTrue (currently non-interruptable)
def calculate_sampling_volume(self, progress_callback):
Calculates the sampling volume.
Parameters
progress_callback:CallableProgress callback
Returns
boolTrue if successful, False if interrupted
def calculate_wire(self, progress_callback):
Calculates the wire.
Parameters
progress_callback:CallableProgress callback
Returns
True if successful, False if interrupted
@field_type_select.setter
def field_type_select(self, field_type):
Sets the currently selected field type.
Parameters
field_type:intField type
def get_valid_field(self, field_type):
Gets a field by type if the field is valid.
Parameters
field_type:intField type
Returns
Optional[Field]Field if valid, None otherwise
def invalidate(self, do_wire=False, do_sampling_volume=False, do_field=False, do_metric=False, do_parameters=False, do_all=False):
Invalidates multiple hierarchy levels at once, in descending order of hierarchy.
Parameters
do_wire:boolEnable to invalidate wire
do_sampling_volume:boolEnable to invalidate sampling volume
do_field:boolEnable to invalidate all fields
do_metric:boolEnable to invalidate metric
do_parameters:boolEnable to invalidate parameters
do_all:boolEnable to invalidate all hierarchy levels
def on_field_invalid(self):
Gets called when the field was invalidated.
def on_field_valid(self):
Gets called when the field was successfully calculated.
def on_metric_invalid(self):
Gets called when the metric was invalidated.
def on_metric_valid(self):

Gets called when the metric was successfully calculated.

Note: Field label creation is triggered on-demand inside VisPyCanvas.redraw(), not here.

def on_parameters_invalid(self):
Gets called when the parameters were invalidated.
def on_parameters_valid(self):
Gets called when the parameters were successfully calculated.
def on_sampling_volume_invalid(self):
Gets called when the sampling volume was invalidated.
def on_sampling_volume_valid(self):
Gets called when the sampling volume was successfully calculated.
def on_wire_invalid(self):
Gets called when the wire was invalidated.
def on_wire_valid(self):
Gets called when the wire was successfully calculated.
def set_field(self, invalidate, field_type, *args, **kwargs):
Sets the field.
Parameters
invalidate:boolEnable to invalidate this model hierarchy level
field_type:intField type
*argsUndocumented
**kwargsUndocumented
def set_metric(self, invalidate, *args, **kwargs):
Sets the metric.
Parameters
invalidate:boolEnable to invalidate this model hierarchy level
*argsUndocumented
**kwargsUndocumented
def set_parameters(self, invalidate, *args, **kwargs):
Sets the parameters.
Parameters
invalidate:boolEnable to invalidate this model hierarchy level
*argsUndocumented
**kwargsUndocumented
def set_sampling_volume(self, invalidate, *args, **kwargs):
Sets the sampling volume.
Parameters
invalidate:boolEnable to invalidate this model hierarchy level
*argsUndocumented
**kwargsUndocumented
def set_wire(self, invalidate, *args, **kwargs):
Sets the wire.
Parameters
invalidate:boolEnable to invalidate this model hierarchy level
*argsUndocumented
**kwargsUndocumented
DebugInvalidate: bool =

Undocumented

@property
field_type_select =
Currently selected field type
gui =

Undocumented

metric =

Undocumented

parameters =

Undocumented

sampling_volume =

Undocumented

wire =

Undocumented

@property
field: Field =
Currently selected field
@property
valid: bool =
True if model is valid, False otherwise
_field_cache: Dict[int, Field] =

Undocumented

_field_type_select =

Undocumented