Added tutorial_init.py and moved rainflow_example to tutorial scripts

master
Per A Brodtkorb 9 years ago
parent 796a5e6d8b
commit bd4265bc18

@ -1,7 +1,4 @@
#from tutor_init import * from tutor_init import *
import numpy as np
import logging
import matplotlib.pyplot as plt
import itertools import itertools
# import sys # import sys
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -10,10 +7,6 @@ log.setLevel(logging.DEBUG)
MARKERS = ('o', 'x', '+', '.', '<', '>', '^', 'v') MARKERS = ('o', 'x', '+', '.', '<', '>', '^', 'v')
def set_windows_title(title='', log=None):
pass
def plot_varying_symbols(x, y, color='red', size=5): def plot_varying_symbols(x, y, color='red', size=5):
""" """
Create a plot with varying symbols Create a plot with varying symbols
@ -163,7 +156,9 @@ if sig_cp is not None:
plt.semilogy plt.semilogy
set_windows_title(title) set_windows_title(title)
hist, bin_edges = np.histogram(sig_cp[:, 0], bins=n_bins, range=stress_range) hist, bin_edges = np.histogram(
sig_cp[
:, 0], bins=n_bins, range=stress_range)
plt.figure() plt.figure()
title = "my_bins" title = "my_bins"

@ -0,0 +1,27 @@
import logging
import scipy as sp
import numpy as np
from numpy import pi, reshape
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('Qt4Agg')
from matplotlib import rcParams
rcParams.update({"font.size": 10})
try:
from win32api import LoadResource
except ImportError:
pass
log = logging.basicConfig(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
level=logging.DEBUG)
def set_windows_title(title, log=None):
if log is not None:
log.info("Set windows title {}".format(title))
fig = plt.gcf()
fig.canvas.set_window_title(title)
plt.show()
Loading…
Cancel
Save