class documentation

class Model:

Constructor: Model(gui)

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: GUI):

Initializes the model.

Parameters
gui:GUIGUI
def calculate_field(self, progress_callback: Callable, num_cores: int, backend_type: int) -> bool:

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: Callable) -> bool:

Calculates the metric.

Parameters
progress_callback:CallableProgress callback
Returns
boolTrue (currently non-interruptable)
def calculate_parameters(self, progress_callback: Callable) -> bool:

Calculates the parameters.

Parameters
progress_callback:CallableProgress callback
Returns
boolTrue (currently non-interruptable)
def calculate_sampling_volume(self, progress_callback: Callable) -> bool:

Calculates the sampling volume.

Parameters
progress_callback:CallableProgress callback
Returns
boolTrue if successful, False if interrupted
def calculate_wire(self, progress_callback: Callable):

Calculates the wire.

Parameters
progress_callback:CallableProgress callback
Returns
True if successful, False if interrupted
def field_type_select(self, field_type: int):

Sets the currently selected field type.

Parameters
field_type:intField type
def get_valid_field(self, field_type: int) -> Field | None:

Gets a field by type if the field is valid.

Parameters
field_type:intField type
Returns
Field | NoneField if valid, None otherwise
def invalidate(self, do_wire: bool = False, do_sampling_volume: bool = False, do_field: bool = False, do_metric: bool = False, do_parameters: bool = False, do_all: bool = 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: bool, field_type: int, *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: bool, *args, **kwargs):

Sets the metric.

Parameters
invalidate:boolEnable to invalidate this model hierarchy level
*argsUndocumented
**kwargsUndocumented
def set_parameters(self, invalidate: bool, *args, **kwargs):

Sets the parameters.

Parameters
invalidate:boolEnable to invalidate this model hierarchy level
*argsUndocumented
**kwargsUndocumented
def set_sampling_volume(self, invalidate: bool, *args, **kwargs):

Sets the sampling volume.

Parameters
invalidate:boolEnable to invalidate this model hierarchy level
*argsUndocumented
**kwargsUndocumented
def set_wire(self, invalidate: bool, *args, **kwargs):

Sets the wire.

Parameters
invalidate:boolEnable to invalidate this model hierarchy level
*argsUndocumented
**kwargsUndocumented
DebugInvalidate: bool =

Undocumented

@property
field_type_select: int =

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: int =

Undocumented