Skip to main content
Testing Status PyPi version https://coveralls.io/repos/github/eng-tools/sfsimodels/badge.svg License https://zenodo.org/badge/DOI/10.5281/zenodo.2596721.svg https://pepy.tech/badge/sfsimodels

sfsimodels

A set of python objects to represent physical objects for assessing structural and geotechnical problems

Attempting to solve the Liskov Substitution Principle problem for combining independently developed source code in the fields of structural and geotechnical engineering.

Models represent states of physical objects, currently can not represent dynamic/changing states.

Model inheritance system

Every object contains a type, a base_type and a list of ancestor_types.

  • type is the current type of the class or instance of the class

  • base_type is what class should be considered as for standard operations such as saving and loading.

  • ancestor_types is a list of the type of the ancestors of the class

Generation of new custom models

It is easiest to create a new object by inheriting from sm.CustomObject, as this contains the default parameters needed for loading and saving the model.

If you chose not to use the default custom object, you must set the object base_type parameter to "custom_object".

Loading a custom object

pass a dictionary to the custom_object parameter in the sm.load_json function, where the dictionary contains: custom={“<base_type>-<type>”: Object}.

Installation

pip install sfsimodels

Citing

Please use the following citation:

Millen M. D. L. (2019) Sfsimodels <version-number> - A set of standard models for assessing structural and geotechnical problems, https://pypi.org/project/sfsimodels/, doi: 10.5281/zenodo.2596721

Saving and loading models

Check out a full set of examples [on github](https://github.com/eng-tools/sfsimodels/blob/master/examples/saving_and_loading_objects.ipynb)

structure = models.Structure()  # Create a structure object
structure.id = 1  # Assign it an id
structure.name = "sample building"  # Assign it a name and other parameters
structure.h_eff = 10.0
structure.t_fixed = 1.0
structure.mass_eff = 80000.
structure.mass_ratio = 1.0  # Set vertical and horizontal masses are equal

ecp_output = files.Output()  # Create an output object
ecp_output.add_to_dict(structure)  # Add the structure to the output object
ecp_output.name = "test data"
ecp_output.units = "N, kg, m, s"  # Set the units
ecp_output.comments = ""

p_str = json.dumps(ecp_output.to_dict(), skipkeys=["__repr__"], indent=4)  # Assign it to a json string
objs = files.loads_json(p_str)  # Load a json string and convert to a dictionary of objects
assert ct.isclose(structure.mass_eff, objs['buildings'][1].mass_eff)  # Access the object

How do I get set up?

  1. Run pip install -r requirements.txt

Testing

Tests are run with pytest

  • Locally run: pytest on the command line.

  • Tests are run on every push using travis, see the .travis.yml file

Deployment

To deploy the package to pypi.com you need to:

  1. Push to the pypi branch. This executes the tests on circleci.com

  2. Create a git tag and push to github, run: trigger_deploy.py or manually:

git tag 0.5.2 -m "version 0.5.2"
git push --tags origin pypi

Contributing

  • All properties that require exterior parameters should be named get_<property>,

  • Parameters that vary with depth in the soil profile should be named get_<property>_at_depth

  • Properties in the stress dependent soil should use get_<property>_at_v_eff_stress to obtain the property

  • Functions that set properties on objects should start with ‘set’ then the property the citation, i.e. set_<property>_<author-year>

  • Methods that generate properties on the object should have the prefix gen_ then property i.e. gen_<property e.g. soil_profile.gen_split()

Documentation

At http://sfsimodels.readthedocs.io/en/latest/

Known bugs

Metadata

Release files for sfsimodels 0.9.46

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for sfsimodels 0.9.46
File Interpreter ABI Platform
sfsimodels-0.9.46-py3-none-any.whl Python 3 none any Details

Release files / sfsimodels-0.9.46-py3-none-any.whl

Download URL sfsimodels-0.9.46-py3-none-any.whl
Size 78.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9b742e9c180393bc078b7bd53775151ef996f0112b073810cf20bd44988ee23
BLAKE2b-256 checksum
How to use checksums
c2d193018ece40348d8f87325b664ba085fe087543d8ee13d4458b85efc1c4ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.10.0 requests/2.27.1 setuptools/40.6.2 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/3.6.15

Security for sfsimodels 0.9.46

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.9.46 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page