1. Set up a notebook running py-fatigue#
Important
If we are in a development environment, we must set up a notebook that is able to recognize the development path as a project.
To do so, we have to create a new notebook in the py-fatigue/notebooks folder and add the following code block in the first cell.
Therefore, if you are working in a package template development enviromment, each of the following examples in
Jupyter Notebooks and use the following as cell #1:
1# Standard imports
2import sys
3import os
4# Non-standard imports
5import matplotlib.pyplot as plt
6import numpy as np
7import plotly.graph_objs as go
8
9PROJECT_PATH = os.path.dirname(os.getcwd())
10print(f'PROJECT_PATH = {PROJECT_PATH}')
11
12if not PROJECT_PATH in sys.path:
13 sys.path.append(PROJECT_PATH)
14
15# Use the package
16import py_fatigue.sn_curve as sn
17from py_fatigue.version import parse_version, __version__
18v = parse_version(__version__)
Optionally, we can add some matplotlib tweaking:
1plt.rcParams['figure.figsize'] = (10.5/2.514/0.7, 4.5/2.514/0.7)
2plt.rcParams["font.family"] = "Serif"
3plt.rcParams["font.size"] = 10.5
4plt.rcParams["axes.grid"] = True
5plt.rcParams['grid.color'] = "#DDDDDD"
6plt.rcParams['grid.linestyle'] = "-"
7plt.rcParams['axes.spines.right'] = False
8plt.rcParams['axes.spines.top'] = False
9plt.rcParams['lines.markersize'] = 3
10plt.rcParams['xtick.bottom'] = False
11plt.rcParams['xtick.labelbottom'] = True
12plt.rcParams['ytick.left'] = False
13plt.rcParams['ytick.labelleft'] = True