Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Mueller <[email protected]>
  • Loading branch information
johannes-mueller committed Oct 10, 2024
2 parents e971770 + 31c59b6 commit 9a57d55
Show file tree
Hide file tree
Showing 11 changed files with 488 additions and 111 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
In this file noteworthy changes of new releases of pyLife are documented since
2.0.0.

## unreleased
## pylife-2.1.2

### New features

* New method `LoadCollective.histogram()` (#107)

### Improvements

* Sanitize checks for Wöhler analysis (#108)
* Error messages when odbclient gets unsupported element types (#64)
* Improved documentation

### Bugfixes

Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ based on pyLife code.

## Status

pyLife-2.1.1 has been released. That means that for the time being we hope
that we will not introduce *breaking* changes. That does not mean that the
release is stable finished and perfect. We will do small improvements,
especially with respect to documentation in the upcoming months and release
them as 2.1.x releases. Once we have noticeable feature additions we will come
up with a 2.x.0 release. No ETA about that.
pyLife-2.1.x is the current release the you get by default. We are doing small
improvements, in the pyLife-2.1.x branch (`master`) while developing the more
vast features in the 2.2.x branch (`develop`).

The main new features of the 2.2.x branch is about FKM functionality. As that
is quite a comprehensive addition we would need some time to get it right
before we can release it as default release.

Once 2.2.x is released we will probably stick to a one branch development.

## Contents

Expand Down
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,18 @@ extras =
# Comment those flags to avoid this py.test issue.
addopts =
--cov src/pylife --cov-append -m "not slow_acceptance and not demos"
--doctest-modules
--ignore=src/pylife/materialdata/woehler/bayesian.py

norecursedirs =
dist
build
.tox
testpaths = tests
testpaths = tests src/pylife
markers =
slow_acceptance: long running acceptance test (not run by default)
demos: demo notebooks by testbook
doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL

[bdist_wheel]
# Use this option if your package is pure-python
Expand Down
11 changes: 6 additions & 5 deletions src/pylife/core/pylifesignal.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,11 @@ def __init__(self, obj):
def bar(df):
return pd.DataFrame({'baz': df['foo'] + df['bar']})
>>> df = pd.DataFrame({'foo': [1.0, 2.0], 'bar': [-1.0, -2.0]})
>>> df.foo.bar()
baz
0 0.0
1 0.0
df = pd.DataFrame({'foo': [1.0, 2.0], 'bar': [-1.0, -2.0]})
df.foo.bar()
baz
0 0.0
1 0.0
"""
return cls._register_method(method_name)
1 change: 1 addition & 0 deletions src/pylife/materialdata/woehler/bayesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
__author__ = "Mustapha Kassem"
__maintainer__ = "Johannes Mueller"


raise NotImplementedError(
"pyLife's Bayesian Wöhler analyzer has been shutdown. "
"See documentation for details."
Expand Down
46 changes: 30 additions & 16 deletions src/pylife/mesh/meshsignal.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,25 @@
--------
Read in a mesh from a vmap file:
>>> df = (vm = pylife.vmap.VMAPImport('demos/plate_with_hole.vmap')
.make_mesh('1', 'STATE-2')
.join_variable('STRESS_CAUCHY')
.join_variable('DISPLACEMENT')
.to_frame())
>>> from pylife.vmap import VMAPImport
>>> df = (
... VMAPImport('demos/plate_with_hole.vmap')
... .make_mesh('1', 'STATE-2')
... .join_coordinates()
... .join_variable('STRESS_CAUCHY')
... .join_variable('DISPLACEMENT')
... .to_frame()
... )
>>> df.head()
x y z S11 S22 S33 S12 S13 S23 dx dy dz
element_id node_id
1 1734 14.897208 5.269875 0.0 27.080811 6.927080 0.0 -13.687358 0.0 0.0 0.005345 0.000015 0.0
1582 14.555333 5.355806 0.0 28.319006 1.178649 0.0 -10.732705 0.0 0.0 0.005285 0.000003 0.0
1596 14.630658 4.908741 0.0 47.701195 5.512213 0.0 -17.866833 0.0 0.0 0.005376 0.000019 0.0
4923 14.726271 5.312840 0.0 27.699907 4.052865 0.0 -12.210032 0.0 0.0 0.005315 0.000009 0.0
4924 14.592996 5.132274 0.0 38.010101 3.345431 0.0 -14.299768 0.0 0.0 0.005326 0.000013 0.0
x y z ... dx dy dz
element_id node_id ...
1 1734 14.897208 5.269875 0.0 ... 0.005345 0.000015 0.0
1582 14.555333 5.355806 0.0 ... 0.005285 0.000003 0.0
1596 14.630658 4.908741 0.0 ... 0.005376 0.000019 0.0
4923 14.726271 5.312840 0.0 ... 0.005315 0.000009 0.0
4924 14.592996 5.132274 0.0 ... 0.005326 0.000013 0.0
<BLANKLINE>
[5 rows x 12 columns]
Get the coordinates of the mesh.
Expand Down Expand Up @@ -210,10 +215,19 @@ def vtk_data(self):
Example
-------
>>> import pyvista as pv
>>> grid = pv.UnstructuredGrid(*our_mesh.mesh.vtk_data())
>>> from pylife.vmap import VMAPImport
>>> df = (
... VMAPImport('demos/plate_with_hole.vmap')
... .make_mesh('1', 'STATE-2')
... .join_coordinates()
... .join_variable('STRESS_CAUCHY')
... .to_frame()
... )
>>> grid = pv.UnstructuredGrid(*df.mesh.vtk_data())
>>> plotter = pv.Plotter(window_size=[1920, 1080])
>>> plotter.add_mesh(grid, scalars=our_mesh.groupby('element_id')['val'].mean().to_numpy())
>>> plotter.show()
>>> plotter.add_mesh(grid, scalars=df.groupby('element_id')['S11'].mean().to_numpy()) # doctest: +SKIP
>>> plotter.show() # doctest: +SKIP
Note the `*` that needs to be added when calling ``pv.UnstructuredGrid()``.
"""
Expand Down
10 changes: 5 additions & 5 deletions src/pylife/strength/meanstress.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ def from_dict(cls, segments_dict):
Example
-------
>>> hd = MST.HaighDiagram.from_dict({
>>> (1.0, np.inf): 0.0,
>>> (-np.inf, 0.0): 0.5,
>>> (0.0, 1.0): 0.167
>>> })
>>> hd = HaighDiagram.from_dict({
... (1.0, np.inf): 0.0,
... (-np.inf, 0.0): 0.5,
... (0.0, 1.0): 0.167
... })
sets up a FKM Goodman like Haigh diagram.
"""
Expand Down
Loading

0 comments on commit 9a57d55

Please sign in to comment.