opswrapper
Python wrappers and helpers for (Tcl) OpenSees analyses.
Installation
Conda:
conda install -c otaithleigh opswrapper
Usage
The objects provided in this package largely line up with their OpenSees Tcl counterparts. The general workflow is to create a list of objects, and then call str on them while printing to a file. Each entry in the list will become a line in the Tcl script, allowing for mixing of raw Tcl code and opswrapper objects.
Simple Example
import opswrapper as ops
model = []
model.append(ops.Model(ndm=2, ndf=3))
model.append(ops.Node(1, 0, 0))
model.append(ops.Node(2, 0, 10))
model.append(ops.material.Elastic(1, 29000))
model.append(ops.element.Truss(1, 1, 2, mat=1, A=10))
print(*model, sep='\n')
Output:
model basic -ndm 2 -ndf 3 node 1 0 0 node 2 0 10 uniaxialMaterial Elastic 1 29000 element truss 1 1 2 10 1
Formatting
Objects can be formatted via multiple ways. The simplest is to convert them to str:
>>> str(Elastic(1, 29000.))
'uniaxialMaterial 1 29000'
A float format specifier may be specified when used with the built-in format commands:
>>> format(Elastic(1, 29000.), 'e')
'uniaxialMaterial 1 2.900000e+4'
>>> f'{Elastic(1, 29000.):.2e}'
'uniaxialMaterial 1 2.90e+04'
Specifiers for other types may be passed using the tcl_code method:
>>> Elastic(1, 29000.).tcl_code({int: '4d'})
'uniaxialMaterial Elastic 1 29000'
Defaults can be set on a global basis using base.set_global_format_spec, on a per-class basis using cls.set_class_format_spec, or on a per-object basis using self.set_format_spec:
>>> set_global_format_spec({float: '#.3g'})
>>> section.Elastic2D.set_class_format_spec({float: '#.3g'})
>>> s = section.Elastic2D(...)
>>> s.set_format_spec({float: '#.3g'})
Each of these methods return the previously-set modifiers if you wish to restore them later.
Metadata
Release files for opswrapper 6.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| opswrapper-6.0.0.tar.gz | 34.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opswrapper-6.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 71.5 kB
Release files / opswrapper-6.0.0.tar.gz
| Download URL | opswrapper-6.0.0.tar.gz |
|---|---|
| Size | 34.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6290d1b8cc8ac36400e81d37ca64ee8ccb662bfd1a961f057d3b7ac7963b4b21
|
|
BLAKE2b-256 checksum How to use checksums |
2de76d88e75f6ddc7830a467f7cca5f9bc3d8e4404779dc84d8564238d507e4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / opswrapper-6.0.0-py3-none-any.whl
| Download URL | opswrapper-6.0.0-py3-none-any.whl |
|---|---|
| Size | 36.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c27ad33574dfb5f6d14e405b1cf1bc3f8c4e94af2649f360183d139740fb009d
|
|
BLAKE2b-256 checksum How to use checksums |
590b06772aca4e215ef47e276984924d6182b38b7242355f58d9391fd5384103
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|