Package: sfsimodels
sfsimodelsA set of python objects to represent physical objects for assessing structural and geotechnical problemsAttempting to solve theLiskov Substitution Principleproblem 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 systemEvery object contains atype, abase_typeand a list ofancestor_types.typeis the current type of the class or instance of the classbase_typeis what class should be considered as for standard operations such as saving and loading.ancestor_typesis a list of thetypeof the ancestors of the classGeneration of new custom modelsIt is easiest to create a new object by inheriting fromsm.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 objectbase_typeparameter to"custom_object".Loading a custom objectpass a dictionary to thecustom_objectparameter in thesm.load_jsonfunction, where the dictionary contains:custom={“<base_type>-<type>”: Object}.InstallationpipinstallsfsimodelsCitingPlease 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.2596721Saving and loading modelsCheck 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 objectstructure.id=1# Assign it an idstructure.name="sample building"# Assign it a name and other parametersstructure.h_eff=10.0structure.t_fixed=1.0structure.mass_eff=80000.structure.mass_ratio=1.0# Set vertical and horizontal masses are equalecp_output=files.Output()# Create an output objectecp_output.add_to_dict(structure)# Add the structure to the output objectecp_output.name="test data"ecp_output.units="N, kg, m, s"# Set the unitsecp_output.comments=""p_str=json.dumps(ecp_output.to_dict(),skipkeys=["__repr__"],indent=4)# Assign it to a json stringobjs=files.loads_json(p_str)# Load a json string and convert to a dictionary of objectsassertct.isclose(structure.mass_eff,objs['buildings'][1].mass_eff)# Access the objectHow do I get set up?Runpip install-rrequirements.txtTestingTests are run with pytestLocally run:pyteston the command line.Tests are run on every push using travis, see the.travis.ymlfileDeploymentTo deploy the package to pypi.com you need to:Push to thepypibranch. This executes the tests on circleci.comCreate a git tag and push to github, run:trigger_deploy.pyor manually:gittag0.5.2-m"version 0.5.2"gitpush--tagsoriginpypiContributingAll properties that require exterior parameters should be namedget_<property>,Parameters that vary with depth in the soil profile should be namedget_<property>_at_depthProperties in the stress dependent soil should useget_<property>_at_v_eff_stressto obtain the propertyFunctions 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 prefixgen_then property i.e.gen_<propertye.g.soil_profile.gen_split()DocumentationAthttp://sfsimodels.readthedocs.io/en/latest/Known bugs