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 Dec 9, 2024
2 parents 671fc55 + b8a60e5 commit 323a666
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 10 deletions.
8 changes: 4 additions & 4 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on how to do that. The newly created environment must be activated.

The following command lines should do it
```
conda create -n pylife-env python=3.11 --yes
conda create -n pylife-env python=3.12 --yes
conda activate pylife-env
```

Expand All @@ -41,7 +41,7 @@ That's not recommended. If you really want to do that, you probably know how to
do it.


### pip install
### Install the pyLife package

The simplest way to install pyLife is just using the pip package
```
Expand Down Expand Up @@ -75,7 +75,7 @@ Create an environment – usually a good idea to use a prefixed environment in
your pyLife working directory and activate it.

```
conda create -p .venv python=3.11 pip --yes
conda create -p .venv python=3.12 pip --yes
conda activate ./.venv
```

Expand All @@ -94,7 +94,7 @@ pytest

If it creates an output ending like below, the installation was successful.
```
================ 228 passed, 1 deselected, 13 warnings in 30.45s ===============
================ 1171 passed, 7 skipped, 6 deselected, 3 warnings in 23.06s ===============
```

There might be some `DeprecationWarning`s. Ignore them for now.
45 changes: 39 additions & 6 deletions demos/load_collective.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"source": [
"# Load Collectives and Load Histograms\n",
"\n",
"From the load (stress) side pyLife provides the classes `LoadCollective` and `LoadHistogram` to deal with load collectives. `LoadCollective` contains individal hysteresis loops whereas `LoadHistogram` contains a 2D-histogram of classes of hysteresis loops and the number of cycles with which they occur."
"From the load (stress) side pyLife provides the classes [`LoadCollective`](https://pylife.readthedocs.io/en/stable/stress/load_collective.html) and [`LoadHistogram`](https://pylife.readthedocs.io/en/stable/stress/load_histogram.html) to deal with load collectives. `LoadCollective` contains individal hysteresis loops whereas `LoadHistogram` contains a 2D-histogram of classes of hysteresis loops and the number of cycles with which they occur."
]
},
{
Expand Down Expand Up @@ -93,7 +93,7 @@
"id": "31b400a3",
"metadata": {},
"source": [
"As you can see, the rainflow analysis found five histresis loops, three from 1.0 to -1.0 and two from -2.0 to 2.0. Alternatively you can ask the recorder for a load histogram:"
"As you can see, the rainflow analysis found five hystresis loops, three from 1.0 to -1.0 and two from -2.0 to 2.0. Alternatively you can ask the recorder for a load histogram:"
]
},
{
Expand Down Expand Up @@ -293,12 +293,36 @@
"plt.pcolormesh(X, Y, numpy_hist)"
]
},
{
"cell_type": "markdown",
"id": "cf99a42b-3075-42e5-87c3-2d99ab55a681",
"metadata": {},
"source": [
"In order to use this load histogram for a damage calculation we can perform a mean stress transformation to transorm all the hysteresis loops to one given R-value."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a0d06dfd-2dd9-4689-b230-67c102220e31",
"metadata": {},
"outputs": [],
"source": [
"meanstress_sensitivity = pd.Series({\n",
" 'M': 0.3,\n",
" 'M2': 0.2\n",
"})\n",
"\n",
"transformed_histogram = histogram.meanstress_transform.fkm_goodman(meanstress_sensitivity, R_goal=-1)\n",
"transformed_histogram.to_pandas()"
]
},
{
"cell_type": "markdown",
"id": "0f505f1a",
"metadata": {},
"source": [
"We can also plot the cumulated version of the histogram. Therefor we put the amplitude and the cycles into a dataframe."
"We can also plot the cumulated version of the histogram. Therefore we put the amplitude and the cycles into a dataframe."
]
},
{
Expand All @@ -309,8 +333,8 @@
"outputs": [],
"source": [
"df = pd.DataFrame({\n",
" 'cycles': histogram.load_collective.cycles, \n",
" 'amplitude': histogram.load_collective.amplitude, \n",
" 'cycles': transformed_histogram.cycles, \n",
" 'amplitude': transformed_histogram.amplitude, \n",
"}).sort_values('amplitude', ascending=False)"
]
},
Expand All @@ -332,6 +356,14 @@
"plt.plot(np.cumsum(df.cycles), df.amplitude)\n",
"plt.loglog()"
]
},
{
"cell_type": "markdown",
"id": "7d3e056d-7579-4fca-bc40-5687f3779eb1",
"metadata": {},
"source": [
" "
]
}
],
"metadata": {
Expand All @@ -349,7 +381,8 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3"
"pygments_lexer": "ipython3",
"version": "3.12.4"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 323a666

Please sign in to comment.