ottermatics package
Submodules
ottermatics.analysis module
- class ottermatics.analysis.Analysis(*, name: str = 'default', system: System, table_reporters: list = _Nothing.NOTHING, plot_reporters: list = _Nothing.NOTHING, stored_plots: dict = _Nothing.NOTHING, show_plots: bool = True)
Bases:
TabulationMixin
,PlottingMixin
Analysis takes a system and many reporters, runs the system, adds its own system properties to the dataframe and post processes the results
post_process() typically creates plots, but can be overriden
- plot_reporters: list
- post_process(*args, **kwargs)
A user customizeable function
- report_results()
- run(*args, **kwargs)
- show_plots: bool
- system: System
- table_reporters: list
- property uploaded
- ottermatics.analysis.make_reporter_check(type_to_check)
ottermatics.common module
A set of common values and functions that are globaly available.
- class ottermatics.common.OtterLog(name='')
Bases:
LoggingMixin
- ottermatics.common.chunks(lst, n)
Yield successive n-sized chunks from lst.
- ottermatics.common.get_size(obj, seen=None)
Recursively finds size of objects
- class ottermatics.common.inst_vectorize(pyfunc, otypes=None, doc=None, excluded=None, cache=False, signature=None)
Bases:
vectorize
- ottermatics.common.is_ec2_instance()
Check if an instance is running on AWS.
ottermatics.components module
- class ottermatics.components.Component(*, name: str = 'default')
Bases:
TabulationMixin
Component is an Evaluatable configuration with tabulation and reporting functionality
- classmethod subclasses(out=None)
return all subclasses of components, including their subclasses :param out: out is to pass when the middle of a recursive operation, do not use it!
- update(system)
override with custom system interaction
ottermatics.component_collections module
define a collection of components that will propigate to its parents dataframe
When wide is set each component’s references are reported to the system’s table, otherwise only one component’s references are reported, however the system will iterate over the components by calling system.iterable_components
Define a Iterable Component slot in a system by calling SLOT.define_iterable(…,wide=True/False)
Types: 1. ComponentList, ordered by index 2. ComponentDict, ordered by key 3. ComponentGraph, ?#TODO:
- class ottermatics.component_collections.ComponentDict(*, name: str = 'default', current_item: iter_tkn = _Nothing.NOTHING, component_type: type)
Bases:
ComponentIter
,UserDict
Stores components by name, and allows tabulation of them
- component_type: type
- class ottermatics.component_collections.ComponentIter(*, name: str = 'default', current_item: iter_tkn = _Nothing.NOTHING)
Bases:
Component
Iterable components are designed to evaluate a large selection of components either one-by-one or all at once at the system level depending on if wide property is set.
- comp_references
A property that caches a result to an instance the first call then returns that each successive call
- property current
returns all data in wide format and the active key in _current_item
- data: iter
- property internal_references
lists the this_name.comp_key.<attr/prop key>: Ref format to override data_dict
- reset()
- wide: bool = True
- class ottermatics.component_collections.ComponentIterator(*, name: str = 'default', current_item: iter_tkn = _Nothing.NOTHING, component_type: type)
Bases:
ComponentIter
,UserList
Stores components by name, and allows tabulation of them
- component_type: type
- ottermatics.component_collections.check_comp_type(instance, attr, value)
ensures the input component type is a Component
- class ottermatics.component_collections.iter_tkn
Bases:
object
ambigious type to keep track of iterable position form system reference
ottermatics.configuration module
- class ottermatics.configuration.ConfigLog(name='')
Bases:
LoggingMixin
- class ottermatics.configuration.Configuration(*, name: str = 'default')
Bases:
LoggingMixin
Configuration is a pattern for storing attributes that might change frequently, and proivdes the core functionality for a host of different applications.
Configuration is able to go through itself and its objects and map all included Configurations, just to a specific level.
Common functionality includes an __on_init__ wrapper for attrs post-init method
- property as_dict
- property attrs_fields: set
- property classname
Shorthand for the classname
- 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 evaluate, 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
- property displayname
- property filename
A nice to have, good to override
- go_through_configurations(level=0, levels_to_descend=-1, parent_level=0)
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
- property identity
A customizeable property that will be in the log by default
- property input_as_dict
- classmethod input_attrs()
- classmethod input_fields()
- property internal_configurations
go through all attributes determining which are configuration objects we skip any configuration that start with an underscore (private variable)
- log_fmt = '[%(name)-24s]%(message)s'
- log_silo = True
- name: str
- property numeric_as_dict
- classmethod numeric_fields()
- property numeric_hash
- classmethod plot_attributes() Dict[str, Attribute]
Lists all plot attributes for class
- classmethod pre_compile()
- classmethod signals_attributes() Dict[str, Attribute]
Lists all signals attributes for class
- classmethod slots_attributes() Dict[str, Attribute]
Lists all slots attributes for class
- classmethod solvers_attributes() Dict[str, Attribute]
Lists all signals attributes for class
- classmethod table_fields()
- classmethod trace_attributes() Dict[str, Attribute]
Lists all trace attributes for class
- classmethod transients_attributes() Dict[str, Attribute]
Lists all signals attributes for class
- property unique_hash
- classmethod validate_class()
A customizeable validator at the end of class creation in otterize
- ottermatics.configuration.comp_transform(c, f)
- ottermatics.configuration.meta(title, desc=None, **kwargs)
a convienience wrapper to add metadata to attr.ib :param title: a title that gets formatted for column headers :param desc: a description of the property
- ottermatics.configuration.otterize(cls=None, **kwargs)
Wrap all Configurations with this decorator with the following behavior 1) we use the callback when any property changes 2) repr is default 3) hash is by object identity
- ottermatics.configuration.property_changed(instance, variable, value)
- ottermatics.configuration.signals_slots_handler(cls, fields, slots=True, signals=True, solvers=True, sys=True, plots=True)
creates attributes as per the attrs.define field_transformer use case.
Customize initalization with slots,signals,solvers and sys flags.
ottermatics.datastores.data module
- class ottermatics.datastores.data.DBConnection(*args, **kwargs)
Bases:
LoggingMixin
A database singleton that is thread safe and pickleable (serializable) to get the active instance use DBConnection.instance(**non_default_connection_args)
- Session = None
- cleanup_sessions()
- configure()
A boilerplate configure method
- connect_args = {'connect_timeout': 5}
- connection_string = None
- dbname = None
- echo = False
- engine = None
- ensure_database_exists(create_meta=True)
Check if database exists, if not create it and tables
- host = None
- property identity
- max_overflow = 0
- passd = None
- pool_size = 20
- port = 5432
- rebuild_database(confirm=True)
Rebuild database on confirmation, create the database if nessicary
- scopefunc = None
- session_factory = None
- session_scope()
Provide a transactional scope around a series of operations.
- user = None
- class ottermatics.datastores.data.DiskCacheStore(*args, **kwargs)
Bases:
LoggingMixin
A singleton object with safe methods for file access, Aims to prevent large number of file pointers open
These should be subclassed for each cache location you want
- alt_path = None
- property cache
- cache_class
alias of
Cache
- cache_init_kwargs = None
- property cache_root
- property current_keys
- expire()
wrapper for diskcache expire method that only permits expiration on a certain interval :return: bool, True if expired called
- expire_threshold = 60.0
- get(key=None, on_missing=None, retry=True, ttl=None)
Helper method to get an item, return None it doesn’t exist and warn. :param on_missing: a callback to use if the data is missing, which will set the data at the key, and return it
- property identity
- last_expire = None
- retries = 3
- set(key=None, data=None, retry=True, ttl=None, **kwargs)
Passes default arguments to set the key:data relationship :param expire: time in seconds to expire the data
- size_limit = 10000000000.0
- sleep_time = 0.1
- timeout = 1.0
- ottermatics.datastores.data.addapt_numpy_array(numpy_array)
- ottermatics.datastores.data.addapt_numpy_float32(numpy_float32)
- ottermatics.datastores.data.addapt_numpy_float64(numpy_float64)
- ottermatics.datastores.data.addapt_numpy_int32(numpy_int32)
- ottermatics.datastores.data.addapt_numpy_int64(numpy_int64)
- ottermatics.datastores.data.autocorrelation_direct(x)
- ottermatics.datastores.data.autocorrelation_fft(x)
- ottermatics.datastores.data.autocorrelation_numpy(x)
- ottermatics.datastores.data.nan_to_null(f)
ottermatics.datastores.gdocs module
ottermatics.eng.geometry module
ottermatics.locations module
- ottermatics.locations.client_path(alternate_path=None, **kw)
ottermatics.logging module
- class ottermatics.logging.Log(name='')
Bases:
LoggingMixin
- class ottermatics.logging.LoggingMixin(name='')
Bases:
Filter
Class to include easy formatting in subclasses
- add_fields(record)
Overwrite this to modify logging fields
- change_all_log_lvl(*a, **kw)
- 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
- error(error, msg='')
Writes to log as a error
- extract_message(args)
- filter(record)
This acts as the interface for logging.Filter Don’t overwrite this, use add_fields instead.
- property identity
- info(*args)
Writes to log but with info category, these are important typically and inform about progress of process in general
- installSTDLogger()
We only want std logging to start
- log_fmt = '[%(name)-24s]%(message)s'
- log_level = 20
- log_on = True
- property logger
- message_with_identiy(message: str, color=None)
converts to color and string via the termcolor library :param message: a string convertable entity :param color: a color in [grey,red,green,yellow,blue,magenta,cyan,white]
- msg(*args)
Writes to log… this should be for raw data or something… least priorty
- resetLog()
reset log
- resetSystemLogs(reseted=None)
resets log on all internal instance LoggingMixins
- slack_notification(category, message)
- slack_webhook_url = <ottermatics.env_var.EnvVariable object>
- warning(*args)
Writes to log as a warning
- ottermatics.logging.change_all_log_levels(new_log_level: int, check_function=None)
Changes All Log Levels With pyee broadcast before reactor is running :param new_log_level: int - changes unit level log level (10-msg,20-debug,30-info,40-warning,50-error,60-crit) :param check_function: callable -> bool - (optional) if provided if check_function(unit) is true then the new_log_level is applied
ottermatics.patterns module
- class ottermatics.patterns.InputSingletonMeta
Bases:
type
Metaclass for singletons. Any instantiation of a Singleton class yields the exact same object, for the same given input, e.g.:
>>> class MyClass(metaclass=Singleton): pass >>> a = MyClass(input='same') >>> b = MyClass(input='diff') >>> a is b False
- class ottermatics.patterns.Singleton(decorated)
Bases:
object
A non-thread-safe helper class to ease implementing singletons. This should be used as a decorator – not a metaclass – to the class that should be a singleton.
The decorated class can define one __init__ function that takes only the self argument. Also, the decorated class cannot be inherited from. Other than that, there are no restrictions that apply to the decorated class.
To get the singleton instance, use the instance method. Trying to use __call__ will result in a TypeError being raised.
- instance(*args, **kwargs)
Returns the singleton instance. Upon its first call, it creates a new instance of the decorated class and calls its __init__ method. On all subsequent calls, the already created instance is returned.
- class ottermatics.patterns.SingletonMeta
Bases:
type
Metaclass for singletons. Any instantiation of a Singleton class yields the exact same object, e.g.:
>>> class MyClass(metaclass=Singleton): pass >>> a = MyClass() >>> b = MyClass() >>> a is b True
- ottermatics.patterns.chunks(lst, n)
Yield successive n-sized chunks from lst.
- ottermatics.patterns.flat2gen(alist)
- ottermatics.patterns.flatten(alist)
- class ottermatics.patterns.inst_vectorize(pyfunc, otypes=None, doc=None, excluded=None, cache=False, signature=None)
Bases:
vectorize
- ottermatics.patterns.singleton_meta_object(cls)
Class decorator that transforms (and replaces) a class definition (which must have a Singleton metaclass) with the actual singleton object. Ensures that the resulting object can still be “instantiated” (i.e., called), returning the same object. Also ensures the object can be pickled, is hashable, and has the correct string representation (the name of the singleton)
ottermatics.eng.pipes module
We’ll use the QP formulation to develop a fluid analysis system for fluids start with single phase and move to others
Pumps Power = C x Q x P
Compressor = C x (QP) x (PR^C2 - 1)
Pipes = dP = C x fXL/D x V^2 / 2g
Pipe Fittings / Valves = dP = C x V^2 (fXL/D +K) | K is a constant, for valves it can be interpolated between closed and opened
Splitters & Joins: Handle fluid mixing
Phase Separation (This one is gonna be hard)
Heat Exchanger dP = f(V,T) - phase change issues
Filtration dP = k x Vxc x (Afrontal/Asurface) “linear”
- class ottermatics.eng.pipes.FlowInput(*, name: str = 'default', x: float, y: float, z: float, flow_in: float = 0.0)
Bases:
FlowNode
- flow_in: float
- sum_of_flows
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- class ottermatics.eng.pipes.FlowNode(*, name: str = 'default', x: float, y: float, z: float)
Bases:
PipeNode
Base For Boundary Condition Nodes of
- dP_f
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- dP_p
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- dP_tot
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- x: float
- y: float
- z: float
- class ottermatics.eng.pipes.Pipe(*, name: str = 'default', node_s: SLOT_82bdb7285a554bb5 | None = None, node_e: SLOT_94b4b9c75d33492e | None = None, material: SLOT_bf94bf5c57f14071 = _Nothing.NOTHING, D: float, v: float = 0, roughness: float = 0.0, bend_radius: float | None = None)
-
- Kpipe
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- L
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- Lhz
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- Lx
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- Ly
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- Lz
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- bend_radius: float
- dP_f
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- dP_p
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- dP_tot
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- friction_factor
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- inclination
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- laminar_method = 'Schmidt laminar'
- roughness: float
- sign
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- straight_method = 'Clamond'
- turbulent_method = 'Schmidt turbulent'
- class ottermatics.eng.pipes.PipeFitting(*, name: str = 'default', x: float, y: float, z: float, material: SLOT_bf94bf5c57f14071 = _Nothing.NOTHING, D: float, v: float = 0, Kfitting: float = 0.1)
-
- dP_f
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- dP_p
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- dP_tot
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- name: str
- x: float
- y: float
- z: float
- class ottermatics.eng.pipes.PipeFlow(*, name: str = 'default', material: SLOT_bf94bf5c57f14071 = _Nothing.NOTHING, D: float, v: float = 0)
Bases:
Component
- A
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- C
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- D: float
- property Fvec
returns the fluidized vector for 1D CFD for continuity:0, and momentum:1
- Mf
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- P
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- Q
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- T
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- property dP_f
The loss of pressure in the pipe due to pressure
- property dP_p
The loss of pressure in the pipe due to potential
- property dP_tot
- density
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- enthalpy
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- reynoldsNumber
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- set_flow(flow)
- v: float
- viscosity
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- class ottermatics.eng.pipes.PipeLog(name='')
Bases:
LoggingMixin
- class ottermatics.eng.pipes.PipeNode(*, name: str = 'default', x: float, y: float, z: float)
Bases:
Component
- property segments
- sum_of_flows
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- x: float
- y: float
- z: float
- class ottermatics.eng.pipes.PipeSystem(*, name: str = 'default', in_node: SLOT_8a52401f9a844ecd = _Nothing.NOTHING)
Bases:
System
- F_keyword_order
A property that caches a result to an instance the first call then returns that each successive call
- add_to_graph(graph, node_or_pipe) str
recursively add node or pipe elements
- assemble_solvers()
- create_graph_from_pipe_or_node(node_or_pipe) Graph
Creates a networkx graph from a pipe or node
- draw()
- graph: Graph
- items: dict
- property nodes
- property pipes
- class ottermatics.eng.pipes.Pump(*, name: str = 'default', max_flow: float, max_pressure: float)
Bases:
Component
Simulates a pump with power input, max flow, and max pressure by assuming a flow characteristic
- dPressure(current_flow)
The pressure the pump generates
- property design_flow_curve
- Returns:
a tuple output of flow vector, and pressure vector
- max_flow: float
- max_pressure: float
- power(current_flow)
The power used considering in watts
ottermatics.plotting module
This module defines PLOT and TRACE methods that allow the plotting of Statistical & Transient relationships of data in each system
- class ottermatics.plotting.PLOT(name, default, validator, repr, cmp, hash, init, inherited, metadata=None, type=None, converter=None, kw_only=False, eq=None, eq_key=None, order=None, order_key=None, on_setattr=None, alias=None)
Bases:
PLOT_ATTR
Plot is a conveinence method
- alias
- col: str
- converter
- default
- classmethod define(x, y, _type='relplot', kind='scatterplot', row=None, col=None, hue=None, **kwargs)
Defines a plot that will be rendered in seaborn, with validation happening as much as possible in the define method
#Plot Choice :param _type: the type of seaborn plot (relplot,displot,catplot) :param kind: specify the kind of type of plot (ie. scatterplot of relplot)
# Dependents & Independents: :param x: the x parameter for each plot :param y: the y parameter for each plot
# Additional Parameters: :param row: create a grid of data with row parameter :param col: create a grid of data with column parameter :param hue: provide an additional dimension of color based on this parameter :param title: this title will be applied to the figure.suptitle()
- eq
- eq_key
- hash
- hue: str
- inherited
- init
- kind: str
- kw_only
- metadata
- name: str
- on_setattr
- order
- order_key
- plot_args: dict
- plot_func: None
- classmethod plot_parms() dict
gathers seaborn plot parms that will scope from system.dataframe
- repr
- row: str
- std_fields: tuple = ('x', 'y', 'col', 'hue', 'row')
- type: str
- type_parm_options = {'catplot': (), 'displot': (), 'relplot': ('style', 'shape')}
- types: tuple = ('displot', 'relplot', 'catplot')
- validator
- x: str
- y: str
- class ottermatics.plotting.PLOT_ATTR(name, default, validator, repr, cmp, hash, init, inherited, metadata=None, type=None, converter=None, kw_only=False, eq=None, eq_key=None, order=None, order_key=None, on_setattr=None, alias=None)
Bases:
Attribute
base class for plot attributes
- alias
- cls_parms = {'x', 'y'}
- classmethod configure_for_system(name, system)
add the system class, and check the dependent and independent values
- converter
- classmethod create_instance(system: System) PlotInstance
- default
- eq
- eq_key
- hash
- inherited
- init
- kind: str
- kw_only
- classmethod make_plot_factory()
- metadata
- name: str
- on_setattr
- on_system: System
- order
- order_key
- classmethod plot_extra()
- classmethod plot_parms() dict
gathers seaborn plot parms that will scope from system.dataframe
- repr
- title: str = None
- type
- classmethod validate_plot_args(system: System)
Checks system.system_references that cls.plot_parms exists
- validator
- class ottermatics.plotting.PlotInstance(system: System, plot_cls: PLOT)
Bases:
object
combine plotclass parms with system info
- property identity: str
- plot(**kwargs)
applies the system dataframe to the plot
- process_fig(fig, title)
- refs = None
- system: System
- class ottermatics.plotting.PlotLog(name='')
Bases:
LoggingMixin
- class ottermatics.plotting.PlottingMixin
Bases:
object
Inherited by Systems and Analyses to provide common interface for plotting
- make_plots(analysis: Analysis = None, store_figures: bool = True, pre=None)
makes plots and traces of all on this instance, and if a system is subsystems. Analysis should call make plots however it can be called on a system as well :param analysis: the analysis that has triggered this plot :param store_figure: a boolean or dict, if neither a dictionary will be created and returend from this function :returns: the dictionary from store_figures logic
- plots
A property that caches a result to an instance the first call then returns that each successive call
- property stored_plots
- traces
A property that caches a result to an instance the first call then returns that each successive call
- class ottermatics.plotting.TRACE(name, default, validator, repr, cmp, hash, init, inherited, metadata=None, type=None, converter=None, kw_only=False, eq=None, eq_key=None, order=None, order_key=None, on_setattr=None, alias=None)
Bases:
PLOT_ATTR
trace is a plot for transients, with y and y2 axes which can have multiple parameters each
- alias
- all_options = ('xlabel', 'ylabel', 'y2label', 'title', 'xticks', 'yticks', 'alpha')
- always = ('x', 'y', 'y2')
- converter
- classmethod create_instance(system: System) TraceInstance
- default
- classmethod define(x='time', y: str | list | None = None, y2=None, kind='line', **kwargs)
Defines a plot that will be matplotlib, with validation happening as much as possible in the define method
#Plot Choice :param kind: specify the kind of type of plot scatter or line, with the default being line
# Dependents & Independents: :param x: the x parameter for each plot, by default ‘time’ :param y: the y parameter for each plot, required :param y2: the y2 parameter for each plot, optional
# Additional Parameters: :param title: this title will be applied to the figure.suptitle() :param xlabel: the x label, by default the capitalized parameter :param ylabel: the x label, by default the capitalized parameter :param y2label: the x label, by default the capitalized parameter
- eq
- eq_key
- extra_args: dict
- hash
- inherited
- init
- kw_only
- metadata
- name: str
- on_setattr
- order
- order_key
- plot_args: dict
- classmethod plot_parms() set
gathers seaborn plot parms that will scope from system.dataframe
- repr
- type
- type_options = {'line': ('linewidth',), 'scatter': ('vmax', 'vmin', 'marker', 'alpha', 'cmap')}
- type_parm_options = {'line': ('color', 'marker', 'linestyle'), 'scatter': ('size', 'color')}
- types = ['scatter', 'line']
- classmethod valid_non_parms(type) set
- classmethod valid_parms_options(type) set
- validator
- x: str
- y: str | list
- y2: str | list
- class ottermatics.plotting.TraceInstance(system: System, plot_cls: PLOT)
Bases:
PlotInstance
- classmethod plot_extra() dict
- system: System
- ottermatics.plotting.conv_ctx(ctx)
- ottermatics.plotting.conv_maps(map)
- ottermatics.plotting.conv_theme(theme)
- ottermatics.plotting.install_seaborn(rc_override=None, **kwargs)
ottermatics.process module
ottermatics.reporting module
The set of reporters define an interface to report plots or tables
- class ottermatics.reporting.CSVReporter(path: str | None = None, report_mode: str = 'single', name: str = 'CSV')
Bases:
TableReporter
,DiskReporterMixin
- name: str
- class ottermatics.reporting.DiskPlotReporter(path: str | None = None, report_mode: str = 'single', name: str = 'SQL')
Bases:
PlotReporter
,DiskReporterMixin
- name: str
- class ottermatics.reporting.DiskReporterMixin(name: str = 'reporter', path: str | None = None, report_mode: str = 'single')
Bases:
TemporalReporterMixin
- ensure_exists()
- ensure_path(file_path)
- path: str
- report_mode
- property report_root
define your keys!
- class ottermatics.reporting.ExcelReporter(path: str | None = None, report_mode: str = 'single', name: str = 'EXCEL')
Bases:
TableReporter
,DiskReporterMixin
- name: str
- class ottermatics.reporting.GdriveReporter(name: str = 'Gdrive', share_drive: str | None = None)
Bases:
PlotReporter
,TemporalReporterMixin
- name: str
- class ottermatics.reporting.GsheetsReporter(name: str = 'GSHEETS')
Bases:
TableReporter
,TemporalReporterMixin
- name: str
- class ottermatics.reporting.PlotReporter(name: str = 'plot_reporter')
Bases:
Reporter
A reporter to upload plots to a file store
- ext = 'png'
- name: str
- upload(analysis)
- class ottermatics.reporting.Reporter(name: str = 'reporter')
Bases:
LoggingMixin
A mixin intended
- check_config()
a test to see if the reporter should be used
- name: str
- classmethod subclasses(out=None)
get all reporters of this type
- class ottermatics.reporting.TableReporter(name: str = 'table_reporter')
Bases:
Reporter
A reporter to upload dataframes to a table store
- name: str
- class ottermatics.reporting.TemporalReporterMixin(name: str = 'reporter')
Bases:
Reporter
Provide single or periodic keys
- property date_key
- property month_key
- property report_root
define your keys!
- ottermatics.reporting.path_exist_validator(inst, attr, value)
ottermatics.env_var module
Defines a class called EnvVariable that defines an interface for env variables with an option to obscure and convert variables, as well as provide a default option.
A global record of variables is kept for informational purposes in keeping track of progam variables
To prevent storage of env vars in program memory, access to the os env variables is provided on access of the secret variable. It is advisable to use the result of this as directly as possible when dealing with actual secrets.
For example add: `db_driver(DB_HOST.secret,DB_PASSWORD.secret,…)
- class ottermatics.env_var.EnvVariable(secret_var_name, type_conv=None, default=None, obscure=False, fail_on_missing=False, desc: str | None = None)
Bases:
LoggingMixin
A method to wrap SECRETS and in application with a way to get the value using self.secret Do not store values from self.secret to ensure security
You can override the secret with _override
- default: Any = None
- desc: str = None
- fail_on_missing: bool
- property in_env
- classmethod load_env_vars()
- obscure: bool = True
- property obscured_name: str
- classmethod print_env_vars()
prints env vars in memory
- remove()
removes this secret from the record
- property secret
- type_conv: Any = None
- var_name: str = None
ottermatics.eng.solid_materials module
- class ottermatics.eng.solid_materials.ANSI_4130(*, name: str = 'steel 4130', color: float = _Nothing.NOTHING, in_shear_modulus: float | None = None, hardness: float = 10, izod: float = 100, factor_of_saftey: float = 1.5, density: float = 7872.0, elastic_modulus: float = 205000000000.0, yield_strength: float = 460000000.0, tensile_strength_ultimate: float = 560000000.0, poissons_ratio: float = 0.28, melting_point: float = 1705, maxium_service_temp: float = 1143, thermal_conductivity: float = 42.7, specific_heat: float = 477, thermal_expansion: float = 1.12e-05, electrical_resistitivity: float = 2.23e-07, cost_per_kg: float = 2.92)
Bases:
SolidMaterial
- cost_per_kg: float
- density: float
- elastic_modulus: float
- electrical_resistitivity: float
- maxium_service_temp: float
- melting_point: float
- name: str
- poissons_ratio: float
- specific_heat: float
- tensile_strength_ultimate: float
- thermal_conductivity: float
- thermal_expansion: float
- yield_strength: float
- class ottermatics.eng.solid_materials.ANSI_4340(*, name: str = 'steel 4340', color: float = _Nothing.NOTHING, in_shear_modulus: float | None = None, hardness: float = 10, izod: float = 100, factor_of_saftey: float = 1.5, density: float = 7872.0, elastic_modulus: float = 192000000000.0, yield_strength: float = 470000000.0, tensile_strength_ultimate: float = 745000000.0, poissons_ratio: float = 0.28, melting_point: float = 1700, maxium_service_temp: float = 1103, thermal_conductivity: float = 44.5, specific_heat: float = 475, thermal_expansion: float = 1.37e-05, electrical_resistitivity: float = 2.48e-07, cost_per_kg: float = 2.23)
Bases:
SolidMaterial
- cost_per_kg: float
- density: float
- elastic_modulus: float
- electrical_resistitivity: float
- maxium_service_temp: float
- melting_point: float
- name: str
- poissons_ratio: float
- specific_heat: float
- tensile_strength_ultimate: float
- thermal_conductivity: float
- thermal_expansion: float
- yield_strength: float
- class ottermatics.eng.solid_materials.Aluminum(*, name: str = 'aluminum generic', color: float = _Nothing.NOTHING, in_shear_modulus: float | None = None, hardness: float = 10, izod: float = 100, factor_of_saftey: float = 1.5, density: float = 2680.0, elastic_modulus: float = 70300000000.0, yield_strength: float = 240000000.0, tensile_strength_ultimate: float = 290000000.0, poissons_ratio: float = 0.33, melting_point: float = 880, maxium_service_temp: float = 616, thermal_conductivity: float = 138, specific_heat: float = 880, thermal_expansion: float = 2.21e-05, electrical_resistitivity: float = 4.99e-07, cost_per_kg: float = 1.9)
Bases:
SolidMaterial
- cost_per_kg: float
- density: float
- elastic_modulus: float
- electrical_resistitivity: float
- maxium_service_temp: float
- melting_point: float
- name: str
- poissons_ratio: float
- specific_heat: float
- tensile_strength_ultimate: float
- thermal_conductivity: float
- thermal_expansion: float
- yield_strength: float
- class ottermatics.eng.solid_materials.CarbonFiber(*, name: str = 'carbon fiber', color: float = _Nothing.NOTHING, in_shear_modulus: float | None = None, hardness: float = 10, izod: float = 100, factor_of_saftey: float = 1.5, density: float = 1600.0, elastic_modulus: float = 140000000000.0, yield_strength: float = 686000000.0, tensile_strength_ultimate: float = 919000000.0, poissons_ratio: float = 0.33, melting_point: float = 573, maxium_service_temp: float = 423, thermal_conductivity: float = 250, specific_heat: float = 1100, thermal_expansion: float = 1.41e-05, electrical_resistitivity: float = 10000, cost_per_kg: float = 1.9)
Bases:
SolidMaterial
- cost_per_kg: float
- density: float
- elastic_modulus: float
- electrical_resistitivity: float
- maxium_service_temp: float
- melting_point: float
- name: str
- poissons_ratio: float
- specific_heat: float
- tensile_strength_ultimate: float
- thermal_conductivity: float
- thermal_expansion: float
- yield_strength: float
- class ottermatics.eng.solid_materials.Concrete(*, name: str = 'concrete', color: float = _Nothing.NOTHING, in_shear_modulus: float | None = None, hardness: float = 10, izod: float = 100, factor_of_saftey: float = 1.5, density: float = 2000.0, elastic_modulus: float = 2920000000.0, yield_strength: float = 57900000.0, tensile_strength_ultimate: float = 910000.0, poissons_ratio: float = 0.26, melting_point: float = 3273, maxium_service_temp: float = 3273, thermal_conductivity: float = 0.5, specific_heat: float = 736, thermal_expansion: float = 1.641e-05, electrical_resistitivity: float = 1000000.0, cost_per_kg: float = 0.09544)
Bases:
SolidMaterial
- cost_per_kg: float
- density: float
- elastic_modulus: float
- electrical_resistitivity: float
- maxium_service_temp: float
- melting_point: float
- name: str
- poissons_ratio: float
- specific_heat: float
- tensile_strength_ultimate: float
- thermal_conductivity: float
- thermal_expansion: float
- yield_strength: float
- class ottermatics.eng.solid_materials.DrySoil(*, name: str = 'dry soil', color: float = _Nothing.NOTHING, in_shear_modulus: float | None = None, hardness: float = 10, izod: float = 100, factor_of_saftey: float = 1.5, density: float = 1600.0, elastic_modulus: float = 70300000000.0, yield_strength: float = 0.0, tensile_strength_ultimate: float = 0.0, poissons_ratio: float = 0.33, melting_point: float = 1823, maxium_service_temp: float = 1723, thermal_conductivity: float = 0.25, specific_heat: float = 800, thermal_expansion: float = 1.641e-05, electrical_resistitivity: float = 1000000.0, cost_per_kg: float = 0.04478)
Bases:
SolidMaterial
- cost_per_kg: float
- density: float
- elastic_modulus: float
- electrical_resistitivity: float
- maxium_service_temp: float
- melting_point: float
- name: str
- poissons_ratio: float
- specific_heat: float
- tensile_strength_ultimate: float
- thermal_conductivity: float
- thermal_expansion: float
- yield_strength: float
- class ottermatics.eng.solid_materials.Rock(*, name: str = 'wet soil', color: float = _Nothing.NOTHING, in_shear_modulus: float | None = None, hardness: float = 10, izod: float = 100, factor_of_saftey: float = 1.5, density: float = 2600.0, elastic_modulus: float = 67000000000.0, yield_strength: float = 13000000.0, tensile_strength_ultimate: float = 13000000.0, poissons_ratio: float = 0.26, melting_point: float = 3000, maxium_service_temp: float = 3000, thermal_conductivity: float = 1.0, specific_heat: float = 2000, thermal_expansion: float = 1.641e-05, electrical_resistitivity: float = 1000000.0, cost_per_kg: float = 0.09544)
Bases:
SolidMaterial
- cost_per_kg: float
- density: float
- elastic_modulus: float
- electrical_resistitivity: float
- maxium_service_temp: float
- melting_point: float
- name: str
- poissons_ratio: float
- specific_heat: float
- tensile_strength_ultimate: float
- thermal_conductivity: float
- thermal_expansion: float
- yield_strength: float
- class ottermatics.eng.solid_materials.Rubber(*, name: str = 'rubber', color: float = _Nothing.NOTHING, in_shear_modulus: float | None = None, hardness: float = 10, izod: float = 100, factor_of_saftey: float = 1.5, density: float = 1100.0, elastic_modulus: float = 100000000.0, yield_strength: float = 248000.0, tensile_strength_ultimate: float = 500000.0, poissons_ratio: float = 0.33, melting_point: float = 873, maxium_service_temp: float = 573, thermal_conductivity: float = 0.108, specific_heat: float = 2005, thermal_expansion: float = 0.0001, electrical_resistitivity: float = 10000000000000.0, cost_per_kg: float = 0.04)
Bases:
SolidMaterial
- cost_per_kg: float
- density: float
- elastic_modulus: float
- electrical_resistitivity: float
- maxium_service_temp: float
- melting_point: float
- name: str
- poissons_ratio: float
- specific_heat: float
- tensile_strength_ultimate: float
- thermal_conductivity: float
- thermal_expansion: float
- yield_strength: float
- class ottermatics.eng.solid_materials.SS_316(*, name: str = 'stainless steel 316', color: float = _Nothing.NOTHING, in_shear_modulus: float | None = None, hardness: float = 10, izod: float = 100, factor_of_saftey: float = 1.5, density: float = 8000.0, elastic_modulus: float = 193000000000.0, yield_strength: float = 240000000.0, tensile_strength_ultimate: float = 550000000.0, poissons_ratio: float = 0.3, melting_point: float = 1643, maxium_service_temp: float = 1143, thermal_conductivity: float = 16.3, specific_heat: float = 500, thermal_expansion: float = 1.6e-05, electrical_resistitivity: float = 7.4e-07, cost_per_kg: float = 3.26)
Bases:
SolidMaterial
- cost_per_kg: float
- density: float
- elastic_modulus: float
- electrical_resistitivity: float
- maxium_service_temp: float
- melting_point: float
- name: str
- poissons_ratio: float
- specific_heat: float
- tensile_strength_ultimate: float
- thermal_conductivity: float
- thermal_expansion: float
- yield_strength: float
- class ottermatics.eng.solid_materials.SolidMaterial(*, name: str = 'solid material', color: float = _Nothing.NOTHING, density: float = 1.0, elastic_modulus: float = 100000000.0, in_shear_modulus: float | None = None, yield_strength: float = 1000000.0, tensile_strength_ultimate: float = 2000000.0, hardness: float = 10, izod: float = 100, poissons_ratio: float = 0.3, melting_point: float = 1273, maxium_service_temp: float = 773, thermal_conductivity: float = 10, specific_heat: float = 1000, thermal_expansion: float = 1e-05, electrical_resistitivity: float = 1e-08, cost_per_kg: float = 1.0, factor_of_saftey: float = 1.5)
Bases:
Material
,Material
,Configuration
A class to hold physical properties of solid structural materials and act as both a section property material and a pynite material
- property E: float
- property G: float
- property allowable_stress: float
- color: float
- cost_per_kg: float
- density: float
- elastic_modulus: float
- electrical_resistitivity: float
- factor_of_saftey: float
- hardness: float
- in_shear_modulus: float
- izod: float
- maxium_service_temp: float
- melting_point: float
- name: str
- property nu: float
- poissons_ratio: float
- property rho: float
- property shear_modulus: float
Shear Modulus
- specific_heat: float
- tensile_strength_ultimate: float
- thermal_conductivity: float
- thermal_expansion: float
- property ultimate_stress: float
- property unique_id
- von_mises_stress_max(**kwargs)
Return arrays with the results of pyfunc broadcast (vectorized) over args and kwargs not in excluded.
- yield_strength: float
- property yield_stress: float
- class ottermatics.eng.solid_materials.WetSoil(*, name: str = 'wet soil', color: float = _Nothing.NOTHING, in_shear_modulus: float | None = None, hardness: float = 10, izod: float = 100, factor_of_saftey: float = 1.5, density: float = 2080.0, elastic_modulus: float = 70300000000.0, yield_strength: float = 0.0, tensile_strength_ultimate: float = 0.0, poissons_ratio: float = 0.33, melting_point: float = 1823, maxium_service_temp: float = 1723, thermal_conductivity: float = 2.75, specific_heat: float = 1632, thermal_expansion: float = 1.641e-05, electrical_resistitivity: float = 940.0, cost_per_kg: float = 0.03444)
Bases:
SolidMaterial
- cost_per_kg: float
- density: float
- elastic_modulus: float
- electrical_resistitivity: float
- maxium_service_temp: float
- melting_point: float
- name: str
- poissons_ratio: float
- specific_heat: float
- tensile_strength_ultimate: float
- thermal_conductivity: float
- thermal_expansion: float
- yield_strength: float
- ottermatics.eng.solid_materials.random_color()
ottermatics.eng.structure module
- exception ottermatics.eng.structure.StopAnalysis
Bases:
Exception
- class ottermatics.eng.structure.Structure(*, name: str = 'default', default_material: SolidMaterial | None = None, add_gravity_force: bool = True, gravity_dir: str = 'FZ', gravity_mag: float = 9.81, gravity_scalar: float = -1, gravity_cases: list = ['gravity'], default_case: str = 'gravity', default_combo: str = 'gravity', current_combo: str = 'gravity', beams: ComponentDict = _Nothing.NOTHING)
Bases:
System
A integration between sectionproperties and PyNite, with a focus on ease of use
Right now we just need an integration between Sections+Materials and Members, to find, CG, and inertial components
Possible Future Additions: 1) Structure Motion (free body ie vehicle , multi-strucutre ie robots)
- property Fg
force of gravity
- property INERTIA
Combines all the mass moments of inerita from the internal beams (and other future items!) into one for the sturcture with the parallel axis theorm
- add_eng_material(material: SolidMaterial)
- add_gravity_force: bool
- add_member(name, node1, node2, section, material=None, **kwargs)
- add_member_with(name, node1, node2, E, G, Iy, Ix, J, A, material_rho=0, **kwargs)
a way to add specific beam properties to calculate stress, This way will currently not caluclate resulatant beam load. #TOOD: Add in a mock section_properties for our own stress calcs
- add_mesh(meshtype, *args, **kwargs)
maps to appropriate PyNite mesh generator but also applies loads
Currently these types are supported [‘rect’,’annulus’,’cylinder’,’triangle’]
- apply_gravity_to_mesh(meshname)
- beam_dataframe(univ_parms: dict | None = None)
creates a dataframe entry for each beam and combo :param univ_parms: keys represent the dataframe parm, and the values represent the lookup value
- beams: ComponentDict
- check_est_failures(*args, **kwargs) bool
exposes check_est_failures
- check_failures(*args, **kwargs) bool
exposes check_failures
- check_mesh_failures(combo, run_full=False, SF=1.0)
Returns the von-mises stress / allowable (failure fraction) stresses for each quad in each mesh. :param run_full: if false will exit early on first failure :returns: a dictinary of quad names and their failure fraction
- property cog
- cost
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- costs() dict
return a dictionary of beam & quad costs
- current_combo: str
- default_case: str
- default_combo: str
- default_material: SolidMaterial
- estimated_failures(concentrationFactor=10, methodFactor=2.5, fail_frac=0.9, combos: list | None = None) dict
uses the beam estimated stresses with specific adders to account for beam 2D stress concentrations and general inaccuracy as well as a fail_fraction to analyze. The estimated loads are very pessimistic with a 250x overestimate
- failure_load_combos(report_info: dict, run_full=False, remote_sync=None, **kw)
returns or yields a set of load combo names to check failure for. You’re encouraged to override this for your specific cases :param report_info: the report that is generated in run_failure_analysis which will dynamically change with :yields: the combo name :returns: None when done
- failure_load_exithandler(combo, res, report_info, run_full)
a callback that is passed the structural combo, the case results
Override this function to provide custom exit capability :param combo: the load combo analyzed :param res: the combo failure results :param report_info: the report dictionary :run_full: option to run everything
- frame: FEModel3D = None
- full_failures
A property that updates a first time and then anytime time the input data changed, as signaled by attrs.on_setattr callback
- gravity_cases: list
- gravity_dir: str
- gravity_mag: float
- gravity_scalar: float
- initalize_structure()
- mass
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- masses() dict
return a dictionary of beam & quad mass
- property members
- merge_displacement_results(combo, D)
adds a remotely calculated displacement vector and applies to nodes ala pynite convention
- mesh_extents() dict
- mesh_stress_dataframe()
returns a dataframe of each quad, its x,y,z coords, vonmises stress and other mass/cost properties in a dataframe
- property node_dataframes
- property nodes
- post_execute(combo)
yours to override dataframe
- pre_execute(combo)
yours to override to prep solver or dataframe
- prep_remote_analysis()
copies PyNite analysis pre-functions
- property quad_info: dict
return a dictonary of quads with their mass properties like cog, mass, area and volume
- run(combos: list | None = None, *args, **kwargs)
wrapper allowing saving of data by load combo
- run_combo_failure_analysis(combo, run_full: bool = False, SF: float = 1.0, run_section_failure=None)
runs a single load combo and adds 2d section failures
- run_failure_analysis(SF=1.0, run_full=False, **kwargs)
Failure Determination: Beam Stress Estiates are used to determine if a 2D FEA beam/combo analysis should be run. The maximum beam vonmises stress is compared the the beam material allowable stress / saftey factor.
Override: Depending on number of load cases, this analysis could take a while. Its encouraged to use a similar pattern of check and exit to reduce load combo size in an effort to fail early. Override this function if nessicary.
Case / Beam Ordering: runs the gravity case first and checks for failure to exit early, then all other combos are run :returns: a dictionary with 2D fea failures and estimated failures as well for each beam
- run_failure_sections(failures, run_full: bool = False, SF: float = 1.0, fail_fast=True)
takes estimated failures and runs 2D section FEA on those cases
- visulize(**kwargs)
- class ottermatics.eng.structure.StructureLog(name='')
Bases:
LoggingMixin
- ottermatics.eng.structure.beam_collection()
- ottermatics.eng.structure.calculate_quad_vonmises(quad, combo) dict
looks at 9 points over a quad to determine its von mises stresses :returns: a dictinary of
- ottermatics.eng.structure.calculate_von_mises_stress(stress_tensor)
- ottermatics.eng.structure.check_est_failures(failures: dict, top=True) bool
check if any failures exist in the nested dictonary and return True if there are
- ottermatics.eng.structure.check_failures(failures: dict) bool
check if any failures exist in the nested dictonary and return True if there are
- ottermatics.eng.structure.node_info(quad, material)
- ottermatics.eng.structure.node_pt(node)
- ottermatics.eng.structure.parallel_run_failure_analysis(struct, SF=1.0, run_full=False, **kw)
Failure Determination: Beam Stress Estiates are used to determine if a 2D FEA beam/combo analysis should be run. The maximum beam vonmises stress is compared the the beam material allowable stress / saftey factor.
Override: Depending on number of load cases, this analysis could take a while. Its encouraged to use a similar pattern of check and exit to reduce load combo size in an effort to fail early. Override this function if nessicary.
Case / Beam Ordering: runs the gravity case first and checks for failure to exit early, then all other combos are run :returns: a dictionary with 2D fea failures and esimated failures as well for each beam
- ottermatics.eng.structure.quad_stress_tensor(quad, r=0, s=0, combo='gravity')
determines stresses from a plate or quad
- ottermatics.eng.structure.remote_combo_failure_analysis(ref_structure, combo, run_full: bool = False, SF: float = 1.0)
runs a single load combo and adds 2d section failures
- ottermatics.eng.structure.remote_failure_sections(sync, failures, run_full: bool = False, SF: float = 1.0, fail_fast=True, group_size=12)
takes estimated failures and runs 2D section FEA on those cases
- ottermatics.eng.structure.run_combo_failure_analysis(inst, combo, run_full: bool = False, SF: float = 1.0)
runs a single load combo and adds 2d section failures
- ottermatics.eng.structure.run_failure_sections(struct, failures, run_full: bool = False, SF: float = 1.0, fail_fast=True, group_size=12)
takes estimated failures and runs 2D section FEA on those cases
- ottermatics.eng.structure.sort_max_estimated_failures(failures)
a generator to iterated through (beam,combo,x) as they return the highest fail_fraction for structures
ottermatics.tabulation module
Tabulation Module:
Incrementally records attrs input values and system_properties per save_data() call.
save_data() is called after item.evaluate() is called.
- class ottermatics.tabulation.Ref(component, key, use_call=True)
Bases:
object
A way to create portable references to system’s and their component’s properties, ref can also take a key to a zero argument function which will be evaluated
- comp: TabulationMixin
- key: str
- set_value(val)
- use_call: bool
- value()
- class ottermatics.tabulation.TableLog(name='')
Bases:
LoggingMixin
- class ottermatics.tabulation.TabulationMixin(*, name: str = 'default')
Bases:
Configuration
In which we define a class that can enable tabulation
- property TABLE
this should seem significant
- always_save_data
A property that caches a result to an instance the first call then returns that each successive call
- property anything_changed
use the on_setattr method to determine if anything changed, also assume that stat_tab could change without input changes
- attr_labels
A property that caches a result to an instance the first call then returns that each successive call
- attr_raw_keys
A property that caches a result to an instance the first call then returns that each successive call
- attr_row
A property that updates a first time and then anytime time the input data changed, as signaled by attrs.on_setattr callback
- class_system_properties
A property that updates a first time and then anytime time the input data changed, as signaled by attrs.on_setattr callback
- classmethod classmethod_system_properties()
Combine other classes table properties into this one, in the case of subclassed system_properties
- classmethod cls_all_attrs_fields()
- classmethod cls_all_property_keys()
- classmethod cls_all_property_labels()
- property data_dict
this is what is captured and used in each row of the dataframe / table
- dataframe
A property that updates a first time and then anytime time the input data changed, as signaled by attrs.on_setattr callback
- format_label(label)
- format_label_attr(k, attr_prop)
- index = 0
- internal_components
A property that caches a result to an instance the first call then returns that each successive call
- internal_references
A property that caches a result to an instance the first call then returns that each successive call
- iterable_components
A property that caches a result to an instance the first call then returns that each successive call
- classmethod locate(key, fail=True) type
- Returns:
the class or attribute by key if its in this system class or a subcomponent. If nothing is found raise an error
- locate_ref(key, fail=True)
- Returns:
the instance assigned to this system. If the key has a . in it the comp the lowest level component will be returned
- classmethod pre_compile()
- print_info()
- reset_table()
Resets the table, and attrs label stores
- save_data(index=None, saved=None, force=False, subforce=False, save_internal=False)
We’ll save data for this object and any other internal configuration if anything changed or if the table is empty This should result in at least one row of data, or minimal number of rows to track changes This should capture all changes but save data
- set_attr(**kwargs)
- skip_attr
A property that caches a result to an instance the first call then returns that each successive call
- skip_parms = None
- property system_id: str
returns an instance unique id based on id(self)
- system_properties
A property that updates a first time and then anytime time the input data changed, as signaled by attrs.on_setattr callback
- system_properties_description
A property that caches a result to an instance the first call then returns that each successive call
- system_properties_keys
A property that caches a result to an instance the first call then returns that each successive call
- system_properties_labels
A property that caches a result to an instance the first call then returns that each successive call
- system_properties_types
A property that caches a result to an instance the first call then returns that each successive call
- property table
alias for TABLE
- table_dict
A property that updates a first time and then anytime time the input data changed, as signaled by attrs.on_setattr callback
ottermatics.eng.thermodynamics module
- class ottermatics.eng.thermodynamics.SimpleCompressor(*, name='Compressor', pressure_ratio, Tin, mdot, Cp, gamma=1.4, efficiency=0.75)
Bases:
Component
- Tout
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- name: str
- power_input
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- pressure_out(pressure_in)
- temperature_ratio
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- class ottermatics.eng.thermodynamics.SimpleHeatExchanger(*, name='HeatExchanger', Thi, mdot_h, Cp_h, Tci, mdot_c, Cp_c, efficiency=0.8)
Bases:
Component
- CmatC
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- CmatH
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- Qdot
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- Qdot_ideal
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- Tc_out
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- Th_out
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- Tout_ideal
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- name: str
- class ottermatics.eng.thermodynamics.SimplePump(*, name='pump', MFin, pressure_ratio, Tin=293, Pin=101325.0, efficiency=0.75, fluid=_Nothing.NOTHING)
Bases:
Component
- Pout
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- Tout
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- cost
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- evaluate()
- name: str
- power_input
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- pressure_delta
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- temperature_delta
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- volumetric_flow
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- class ottermatics.eng.thermodynamics.SimpleTurbine(*, name='Turbine', Pout, Pin, Tin, mdot, Cp, gamma=1.4, efficiency=0.8)
Bases:
Component
- Tout
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- name: str
- power_output
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- pressure_ratio
this property notifies the system this is a property to be tabulated in the dataframe output.
@system_property def function(…): < this uses __init__ to assign function
@system_property(desc=’really nice’,label=’funky function’) def function(…): < this uses __call__ to assign function
When the underlying data has some random element, set stochastic=True and this will flag the component to always save data.
Functions wrapped with table type must have an return annotion of (int,float,str)… ex def func() -> int:
- ottermatics.eng.thermodynamics.dp_he_core(G, f, L, rho, Dh)
Losses due to friction :param f: fanning friction factor :param G: mass flux (massflow / Area) :param L: length of heat exchanger :param rho: intermediate density :param Dh: diameter of heat exchanger
- ottermatics.eng.thermodynamics.dp_he_entrance(sigma, G, rho)
Heat Exchanger Entrance Pressure Loss :param sigma: contraction-ratio - ratio of minimum flow area to frontal area :param G: mass flux of fluid :param rho: density of fluid
- ottermatics.eng.thermodynamics.dp_he_exit(sigma, G, rho)
Heat Exchanger Exit Pressure Loss :param sigma: contraction-ratio - ratio of minimum flow area to frontal area :param G: mass flux of fluid :param rho: density of fluid
- ottermatics.eng.thermodynamics.dp_he_gas_losses(G, rhoe, rhoi)
Measures the pressure loss or gain due to density changes in the HE :param G: mass flux :param rhoe: exit density :param rhoi: entrance density
- ottermatics.eng.thermodynamics.fanning_friction_factor(Re, method='turbulent')