sfsimodels


Namesfsimodels JSON
Version 0.9.46 PyPI version JSON
download
home_pagehttps://github.com/eng-tools/sfsimodels
SummaryA set of standard models for assessing structural and geotechnical problems
upload_time2024-06-19 21:47:06
maintainerNone
docs_urlNone
authorMaxim Millen
requires_python>=3.3
licenseMIT
keywords geotechnical structural soil
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            .. image:: https://travis-ci.org/eng-tools/sfsimodels.svg?branch=master
   :target: https://travis-ci.org/eng-tools/sfsimodels
   :alt: Testing Status

.. image:: https://img.shields.io/pypi/v/sfsimodels.svg
   :target: https://pypi.python.org/pypi/sfsimodels
   :alt: PyPi version
   
.. image:: https://coveralls.io/repos/github/eng-tools/sfsimodels/badge.svg
   :target: https://coveralls.io/github/eng-tools/sfsimodels

.. image:: https://img.shields.io/badge/license-MIT-blue.svg
    :target: https://github.com/eng-tools/sfsimodels/blob/master/LICENSE
    :alt: License

.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.2596721.svg
    :target: https://doi.org/10.5281/zenodo.2596721

.. image:: https://pepy.tech/badge/sfsimodels
    :target: https://pepy.tech/project/sfsimodels


**********
sfsimodels
**********

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

Attempting to solve the `Liskov Substitution Principle <https://en.wikipedia.org/wiki/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
============

.. code:: bash

    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)

.. code-block:: python

    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:

 .. code:: bash

    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
==========




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/eng-tools/sfsimodels",
    "name": "sfsimodels",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.3",
    "maintainer_email": null,
    "keywords": "geotechnical structural soil",
    "author": "Maxim Millen",
    "author_email": "mmi46@uclive.ac.nz",
    "download_url": null,
    "platform": null,
    "description": ".. image:: https://travis-ci.org/eng-tools/sfsimodels.svg?branch=master\n   :target: https://travis-ci.org/eng-tools/sfsimodels\n   :alt: Testing Status\n\n.. image:: https://img.shields.io/pypi/v/sfsimodels.svg\n   :target: https://pypi.python.org/pypi/sfsimodels\n   :alt: PyPi version\n   \n.. image:: https://coveralls.io/repos/github/eng-tools/sfsimodels/badge.svg\n   :target: https://coveralls.io/github/eng-tools/sfsimodels\n\n.. image:: https://img.shields.io/badge/license-MIT-blue.svg\n    :target: https://github.com/eng-tools/sfsimodels/blob/master/LICENSE\n    :alt: License\n\n.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.2596721.svg\n    :target: https://doi.org/10.5281/zenodo.2596721\n\n.. image:: https://pepy.tech/badge/sfsimodels\n    :target: https://pepy.tech/project/sfsimodels\n\n\n**********\nsfsimodels\n**********\n\nA set of python objects to represent physical objects for assessing structural and geotechnical problems\n\nAttempting to solve the `Liskov Substitution Principle <https://en.wikipedia.org/wiki/Liskov_substitution_principle>`_\nproblem for combining independently developed source\ncode in the fields of structural and geotechnical engineering.\n\nModels represent states of physical objects, currently can not represent dynamic/changing states.\n\nModel inheritance system\n========================\n\nEvery object contains a ``type``, a ``base_type`` and a list of ``ancestor_types``.\n\n - ``type`` is the current type of the class or instance of the class\n - ``base_type`` is what class should be considered as for standard operations such as saving and loading.\n - ``ancestor_types`` is a list of the ``type`` of the ancestors of the class\n\n\nGeneration of new custom models\n===============================\n\nIt is easiest to create a new object by inheriting from ``sm.CustomObject``, as this contains the default parameters\nneeded for loading and saving the model.\n\nIf you chose not to use the default custom object, you must set the object ``base_type`` parameter to ``\"custom_object\"``.\n\nLoading a custom object\n=======================\n\npass a dictionary to the ``custom_object`` parameter in the ``sm.load_json`` function, where the dictionary contains:\n`custom={\"<base_type>-<type>\": Object}`.\n\n\nInstallation\n============\n\n.. code:: bash\n\n    pip install sfsimodels\n\nCiting\n======\n\nPlease use the following citation:\n\nMillen M. D. L. (2019) Sfsimodels <version-number> - A set of standard models for assessing structural and geotechnical problems,\nhttps://pypi.org/project/sfsimodels/, doi: 10.5281/zenodo.2596721\n\nSaving and loading models\n=========================\n\nCheck out a full set of examples [on github](https://github.com/eng-tools/sfsimodels/blob/master/examples/saving_and_loading_objects.ipynb)\n\n.. code-block:: python\n\n    structure = models.Structure()  # Create a structure object\n    structure.id = 1  # Assign it an id\n    structure.name = \"sample building\"  # Assign it a name and other parameters\n    structure.h_eff = 10.0\n    structure.t_fixed = 1.0\n    structure.mass_eff = 80000.\n    structure.mass_ratio = 1.0  # Set vertical and horizontal masses are equal\n\n    ecp_output = files.Output()  # Create an output object\n    ecp_output.add_to_dict(structure)  # Add the structure to the output object\n    ecp_output.name = \"test data\"\n    ecp_output.units = \"N, kg, m, s\"  # Set the units\n    ecp_output.comments = \"\"\n\n    p_str = json.dumps(ecp_output.to_dict(), skipkeys=[\"__repr__\"], indent=4)  # Assign it to a json string\n    objs = files.loads_json(p_str)  # Load a json string and convert to a dictionary of objects\n    assert ct.isclose(structure.mass_eff, objs['buildings'][1].mass_eff)  # Access the object\n\n\nHow do I get set up?\n====================\n\n1. Run ``pip install -r requirements.txt``\n\nTesting\n=======\n\nTests are run with pytest\n\n* Locally run: ``pytest`` on the command line.\n\n* Tests are run on every push using travis, see the ``.travis.yml`` file\n\n\nDeployment\n==========\n\nTo deploy the package to pypi.com you need to:\n\n 1. Push to the *pypi* branch. This executes the tests on circleci.com\n\n 2. Create a git tag and push to github, run: ``trigger_deploy.py`` or manually:\n\n .. code:: bash\n\n    git tag 0.5.2 -m \"version 0.5.2\"\n    git push --tags origin pypi\n\nContributing\n============\n\n * All properties that require exterior parameters should be named ``get_<property>``,\n * Parameters that vary with depth in the soil profile should be named ``get_<property>_at_depth``\n * Properties in the stress dependent soil should use ``get_<property>_at_v_eff_stress`` to obtain the property\n * Functions that set properties on objects should start with 'set' then the property the citation, i.e. ``set_<property>_<author-year>``\n * Methods that generate properties on the object should have the prefix ``gen_`` then property i.e. ``gen_<property`` e.g. ``soil_profile.gen_split()``\n\n\n\nDocumentation\n=============\n\nAt http://sfsimodels.readthedocs.io/en/latest/\n\n\nKnown bugs\n==========\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A set of standard models for assessing structural and geotechnical problems",
    "version": "0.9.46",
    "project_urls": {
        "Homepage": "https://github.com/eng-tools/sfsimodels"
    },
    "split_keywords": [
        "geotechnical",
        "structural",
        "soil"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c2d193018ece40348d8f87325b664ba085fe087543d8ee13d4458b85efc1c4ce",
                "md5": "f16e143b494c6b6ae75d8648410c8f07",
                "sha256": "f9b742e9c180393bc078b7bd53775151ef996f0112b073810cf20bd44988ee23"
            },
            "downloads": -1,
            "filename": "sfsimodels-0.9.46-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f16e143b494c6b6ae75d8648410c8f07",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.3",
            "size": 78497,
            "upload_time": "2024-06-19T21:47:06",
            "upload_time_iso_8601": "2024-06-19T21:47:06.032918Z",
            "url": "https://files.pythonhosted.org/packages/c2/d1/93018ece40348d8f87325b664ba085fe087543d8ee13d4458b85efc1c4ce/sfsimodels-0.9.46-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-19 21:47:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "eng-tools",
    "github_project": "sfsimodels",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "circle": true,
    "requirements": [],
    "lcname": "sfsimodels"
}
        
Elapsed time: 4.26690s