engforge.eng.geometry.Triangle

class Triangle(*, name='rectangular section', b, h)[source]

Bases: Profile2D

models a triangle with base, b and height h

Method generated by attrs for class Triangle.

Methods

add_fields

Overwrite this to modify logging fields

add_prediction_record

adds a record to the prediction records, and calcultes the average and variance of the data :type record: :param record: a dict of the record :type extra_add: :param extra_add: if true, the record is added to the prediction records even if the data is inbounds :returns: a boolean indicating if the record was out of bounds of current data (therefor should be added)

calculate_stress

change_all_log_lvl

check_and_retrain

Checks if more data than threshold to train or if error is sufficiently low to ignore retraining, or if more data already exists than window size (no training)

check_out_of_domain

checks if the record is in bounds of the current data

check_ref_slot_type

recursively checks class slots for the key, and returns the slot type

cls_compile

compiles this class, override this to compile functionality for this class

collect_all_attributes

collects all the attributes for a system

collect_inst_attributes

collects all the attributes for a system

compile_classes

compiles all subclass functionality

copy_config_at_state

copy the system at the current state recrusively to a certain level, by default copying everything :type levels_deep: int :param levels_deep: how many levels deep to copy, -1 is all :type level: :param level: the current level, defaults to 0 if not set

critical

A routine to communicate to the root of the server network that there is an issue

debug

Writes at a low level to the log file.

difference

a context manager that will allow you to dynamically change any information, then will change it back in a fail safe way.

display_results

error

Writes to log as a error

estimate_stress

extract_message

filter

This acts as the interface for logging.Filter Don't overwrite this, use add_fields instead.

go_through_configurations

A generator that will go through all internal configurations up to a certain level if levels_to_descend is less than 0 ie(-1) it will go down, if it 0, None, or False it will only go through this configuration

hash

hash by parm or by input_kw, only input can be hashed by lookup as system properties can create a recursive loop and should be deterministic from input

hash_numeric_with

hash_with

Generates a hash for the object's dictionary representation, updated with additional keyword arguments.

info

Writes to log but with info category, these are important typically and inform about progress of process in general

input_attrs

Lists all input attributes for class

input_fields

no attr base types, no tuples, no lists, no dicts

installSTDLogger

We only want std logging to start

internal_configurations

go through all attributes determining which are configuration objects additionally this skip any configuration that start with an underscore (private variable)

message_with_identiy

converts to color and string via the termcolor library :type message: str :param message: a string convertable entity :type color: :param color: a color in [grey,red,green,yellow,blue,magenta,cyan,white]

msg

Writes to log.

numeric_fields

no tuples,lists, dicts, strings, or attr base types

observe_and_predict

uses the existing models to predict the row and measure the error

parent_configurations_cls

returns all subclasses that are a Configuration

plot_attributes

Lists all plot attributes for class

plot_mesh

pre_compile

an overrideable classmethod that executes when compiled, however will not execute as a subclass

prediction_dataframe

prediction_weights

resetLog

reset log

resetSystemLogs

resets log on all internal instance LoggingMixins

score_data

scores a dataframe

setattrs

sets attributes from a dictionary

signals_attributes

Lists all signals attributes for class

slack_notification

slot_refs

returns all slot references in this configuration

slots_attributes

Lists all slots attributes for class

solvers_attributes

Lists all signals attributes for class

subclasses

return all subclasses of components, including their subclasses :type out: :param out: out is to pass when the middle of a recursive operation, do not use it!

subcls_compile

reliably compiles this method even for subclasses, override this to compile functionality for subclass interfaces & mixins

table_fields

the table attributes corresponding to

trace_attributes

Lists all trace attributes for class

train_compare

Use the dataframe to train the models, and compare the results to the current models using train_frac to divide total samples into training and testing sets, unless train_full is set.

training_callback

override to provide a callback when training is complete, such as saving the models

transients_attributes

Lists all signals attributes for class

validate_class

A customizeable validator at the end of class creation in forge

warning

Writes to log as a warning

Attributes

A

Ao

outside area, over ride for hallow sections

Ixx

Iyy

J

as_dict

returns values as they are in the class instance

attrs_fields

basis

classname

Shorthand for the classname

displayname

filename

A nice to have, good to override

identity

A customizeable property that will be in the log by default

input_as_dict

returns values as they are in the class instance, but converts classes inputs to their input_as_dict

input_hash

log_fmt

log_level

log_on

log_silo

logger

numeric_as_dict

recursively gets internal components numeric_as_dict as well as its own numeric values

numeric_hash

prediction_goal_error

prediction_records

slack_webhook_url

table_hash

table_row_dict

returns values as they would be put in a table row from this instance ignoring any sub components

train_window

trained

unique_hash

x_bounds

y_bounds

b

h

name

Parameters:
  • name (str)

  • b (float)

  • h (float)

property Ao

outside area, over ride for hallow sections

add_fields(record)

Overwrite this to modify logging fields

add_prediction_record(record, extra_add=True, mult_sigma=1, target_items=1000)

adds a record to the prediction records, and calcultes the average and variance of the data :type record: :param record: a dict of the record :type extra_add: :param extra_add: if true, the record is added to the prediction records even if the data is inbounds :returns: a boolean indicating if the record was out of bounds of current data (therefor should be added)

property as_dict

returns values as they are in the class instance

check_and_retrain(records, min_rec=None)

Checks if more data than threshold to train or if error is sufficiently low to ignore retraining, or if more data already exists than window size (no training)

check_out_of_domain(record, extra_margin=1, target_items=1000)

checks if the record is in bounds of the current data

classmethod check_ref_slot_type(sys_key)

recursively checks class slots for the key, and returns the slot type

Return type:

list

Parameters:

sys_key (str)

property classname

Shorthand for the classname

classmethod cls_compile()

compiles this class, override this to compile functionality for this class

classmethod collect_all_attributes()

collects all the attributes for a system

collect_inst_attributes(**kw)

collects all the attributes for a system

classmethod compile_classes()

compiles all subclass functionality

copy_config_at_state(level=None, levels_deep=-1, changed=None, **kw)

copy the system at the current state recrusively to a certain level, by default copying everything :type levels_deep: int :param levels_deep: how many levels deep to copy, -1 is all :type level: :param level: the current level, defaults to 0 if not set

Parameters:
  • levels_deep (int)

  • changed (dict | None)

critical(*args)

A routine to communicate to the root of the server network that there is an issue

debug(*args)

Writes at a low level to the log file… usually this should be detailed messages about what exactly is going on

difference(**kwargs)

a context manager that will allow you to dynamically change any information, then will change it back in a fail safe way.

with self.difference(name=’new_name’, value = new_value) as new_config:

#do stuff with config, ok to fail

you may not access any “private” variable that starts with an _ as in _whatever

difference is useful for saving slight differences in configuration in conjunction with solve you might create wrappers for eval, or implement a strategy pattern.

only attributes may be changed.

#TODO: allow recursive operation with sub comps or systems. #TODO: make a full system copy so the system can be reverted later

error(error, msg='')

Writes to log as a error

property filename

A nice to have, good to override

filter(record)

This acts as the interface for logging.Filter Don’t overwrite this, use add_fields instead.

go_through_configurations(level=0, levels_to_descend=-1, parent_level=0, only_inst=True, **kw)

A generator that will go through all internal configurations up to a certain level if levels_to_descend is less than 0 ie(-1) it will go down, if it 0, None, or False it will only go through this configuration

Returns:

level,config

hash(*args, **input_kw)

hash by parm or by input_kw, only input can be hashed by lookup as system properties can create a recursive loop and should be deterministic from input

hash_with(**input_kw)

Generates a hash for the object’s dictionary representation, updated with additional keyword arguments. :type **input_kw: :param **input_kw: Arbitrary keyword arguments to update the object’s dictionary representation.

Returns:

The hash value of the updated dictionary.

Raises:

Any exceptions raised by deepdiff.DeepHash if hashing fails.

property identity

A customizeable property that will be in the log by default

info(*args)

Writes to log but with info category, these are important typically and inform about progress of process in general

property input_as_dict

returns values as they are in the class instance, but converts classes inputs to their input_as_dict

classmethod input_attrs()

Lists all input attributes for class

classmethod input_fields(add_ign_types=None)

no attr base types, no tuples, no lists, no dicts

Parameters:

add_ign_types (list | None)

installSTDLogger()

We only want std logging to start

internal_configurations(check_config=True, use_dict=True, none_ok=False)

go through all attributes determining which are configuration objects additionally this skip any configuration that start with an underscore (private variable)

Return type:

dict

message_with_identiy(message, color=None)

converts to color and string via the termcolor library :type message: str :param message: a string convertable entity :type color: :param color: a color in [grey,red,green,yellow,blue,magenta,cyan,white]

Parameters:

message (str)

msg(*args, lvl=5)

Writes to log… this should be for raw data or something… least priorty

property numeric_as_dict

recursively gets internal components numeric_as_dict as well as its own numeric values

classmethod numeric_fields()

no tuples,lists, dicts, strings, or attr base types

observe_and_predict(row)

uses the existing models to predict the row and measure the error

classmethod parent_configurations_cls()

returns all subclasses that are a Configuration

Return type:

list

classmethod plot_attributes()

Lists all plot attributes for class

Return type:

Dict[str, Attribute]

classmethod pre_compile()

an overrideable classmethod that executes when compiled, however will not execute as a subclass

resetLog()

reset log

resetSystemLogs(reseted=None)

resets log on all internal instance LoggingMixins

score_data(df)

scores a dataframe

setattrs(dict)

sets attributes from a dictionary

classmethod signals_attributes()

Lists all signals attributes for class

Return type:

Dict[str, Attribute]

classmethod slot_refs(recache=False)

returns all slot references in this configuration

classmethod slots_attributes(attr_type=False)

Lists all slots attributes for class

Return type:

Dict[str, Attribute]

classmethod solvers_attributes()

Lists all signals attributes for class

Return type:

Dict[str, Attribute]

classmethod subclasses(out=None)

return all subclasses of components, including their subclasses :type out: :param out: out is to pass when the middle of a recursive operation, do not use it!

classmethod subcls_compile()

reliably compiles this method even for subclasses, override this to compile functionality for subclass interfaces & mixins

classmethod table_fields()

the table attributes corresponding to

property table_row_dict

returns values as they would be put in a table row from this instance ignoring any sub components

classmethod trace_attributes()

Lists all trace attributes for class

Return type:

Dict[str, Attribute]

train_compare(df, test_frac=2, train_full=False, min_rec=250)

Use the dataframe to train the models, and compare the results to the current models using train_frac to divide total samples into training and testing sets, unless train_full is set.

Parameters:
  • df – dataframe to train with

  • test_frac – N/train_frac will be size of the training window

  • train_full – boolean to use full training data

Returns:

trained models

training_callback(models)

override to provide a callback when training is complete, such as saving the models

classmethod transients_attributes()

Lists all signals attributes for class

Return type:

Dict[str, Attribute]

classmethod validate_class()

A customizeable validator at the end of class creation in forge

warning(*args)

Writes to log as a warning