OpenSees面向对象的原生Python版本
o3seesp的Python项目详细描述
o3seespy公司
OpenSees面向对象的原生python版本
特点
此软件包提供:
- A ‘pythonic’ version of OpenSees - all input parameters to create OpenSees objects are all lowercase key-value arguments - all class objects are CamelCase - static string variables defined in ALL_CAPS - Where possible the exact name used in the original TCL version has been kept
- Fully namespaced package allowing full auto-complete e.g. ‘o3.uniaxial_material.Steel01(…)’
- Replication of underlying object-oriented C++ source code using Python objects.
- Type checking of inputs before calling C++ OpenSees code, so that python debugging and errors can be viewed
- In code documentation using python docstrings - can view the documentation within your IDE
- Additional features for using OpenSees in python: - saving and loading data directly from OpenSees into numpy arrays - saving and loading data directly from OpenSees into json files - Save an entire model as a json file - allows efficient passing of models between servers
- All object numbering handled by objects - no need for number tags!
- Additional logic checking of optional inputs
如何使用
安装
pip install o3seespy
示例:动态非弹性单自由度分析
^{pr2}$有用材料
贡献
如何设置我?
- 运行pip install -r requirements.txt
包装惯例
- 所有名称都应与OpenSees tcl版本相同,除了:
- 对于参数或函数,名称应转换为snake_case
- 对象的名称应转换为CamelCase
- 对于静态变量,名称应转换为所有的\u CAPS
- 如果名称与python的特殊名称匹配(例如lambda,in),则应根据字典对其进行调整
- 对象应根据对象类型(例如元素、材质)命名
- 对于跨多个对象(例如大气压力)使用的参数,应使用标准名称
- OpenSees收集结果的函数名为“get”<;function name>;'
- OpenSees生成结果的函数名为“gen”<;function name>;'
- 杨氏模量应该如何命名?在
- 如果所有两个node元素都使用i\u node,j_node。或者让它们都以列表的形式输入节点?在
测试
使用pytest运行测试
- 在命令行本地运行:pytest。在
- 使用travis在每次推送时都会运行测试,请参见.travis.yml文件
部署
将包部署到pypi.com网站您需要:
- 推到pypi分支。这将在上执行测试circleci.com网站在
- 创建一个git标记并推送到github,运行:trigger_deploy.py或手动:
git tag 0.5.2 -m "version 0.5.2" git push --tags origin pypi
文档
通过狮身人面像建造如下:https://codeandchaos.wordpress.com/2012/07/30/sphinx-autodoc-tutorial-for-dummies/
发展模式
- cd to docs
- Run ^{tt5}$
Docstrings遵循numpy约定(正在进行):https://numpydoc.readthedocs.io/en/latest/format.html
在中修复long_描述设置.py:pip install collective.checkdocs,python setup.py checkdocs
- 项目
标签: