Skip to content

Commit 3f90605

Browse files
committed
make doctests work... mostly.
two failures, but output looks the same!
1 parent 6f4f186 commit 3f90605

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

vibration_toolbox/ema.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,19 @@ def frf(x, f, dt):
3636
>>> import vibration_toolbox as vt
3737
>>> import scipy.io as sio
3838
>>> import os
39-
>>> print(os.getcwd())
40-
>>> print(os.listdir('vibration_toolbox/data'))
39+
>>> #print(os.getcwd())
40+
>>> #print(os.listdir('vibration_toolbox/data'))
4141
>>> data = sio.loadmat('vibration_toolbox/data/frf_data1.mat')
42-
>>> print(data)
42+
>>> #print(data)
4343
>>> # Data is imported as arrays. We need to modify then to fit our function
4444
>>> x = data['x']
4545
>>> x = x.reshape(len(x))
46-
>>> print(x)
4746
>>> f = data['f']
4847
>>> f = f.reshape(len(f))
49-
>>> print(f)
5048
>>> dt = data['dt']
5149
>>> dt = float(dt)
52-
>>> print(dt)
5350
>>> # Now we are able to call the function
5451
>>> freq, mag, ang, coh = vt.frf(x, f, dt)
55-
>>> print(freq)
56-
>>> print(mag)
5752
>>> mag[10] # doctest: +ELLIPSIS
5853
1.018394853080...
5954
"""

vibration_toolbox/sdof.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ def free_response(m=10, c=1, k=100, x0=1, v0=-1, max_time=10):
3737
9.99199680e+00, 9.99599840e+00, 1.00000000e+01]), array([[ 1. ],
3838
[ 0.99591926],
3939
[ 0.9916807 ],
40-
...,
40+
...,
4141
[ 0.56502396],
4242
[ 0.56123989],
4343
[ 0.55736747]]), array([[-1. ],
4444
[-1.03952678],
4545
[-1.07887136],
46-
...,
46+
...,
4747
[-0.93454914],
4848
[-0.95670532],
4949
[-0.97869947]]), 0.015811388300841896, 3.1622776601683795, 3.1618823507524758, 1.0441611791969838)
50-
"""
50+
"""
5151

5252
omega = sp.sqrt(k / m)
5353
zeta = c / 2 / omega / m
@@ -284,7 +284,7 @@ def euler_beam_modes(n=10, bctype=2, beamparams=sp.array((7.31e10, 1 / 12 * 0.03
284284
"""
285285
%VTB6_3 Natural frequencies and mass normalized mode shape for an Euler-
286286
% Bernoulli beam with a chosen boundary condition.
287-
% [w,x,U]=VTB6_3(n,bctype,bmpar,npoints) will return the nth natural
287+
% [w,x,U]=VTB6_3(n,bctype,bmpar,npoints) will return the nth natural
288288
% frequency (w) and mode shape (U) of an Euler-Bernoulli beam.
289289
% If n is a vector, return the coresponding mode shapes and natural
290290
% frequencies.
@@ -302,7 +302,7 @@ def euler_beam_modes(n=10, bctype=2, beamparams=sp.array((7.31e10, 1 / 12 * 0.03
302302
%
303303
% The beam parameters are input through the vector bmpar:
304304
% bmpar = [E I rho A L];
305-
% where the variable names are consistent with Section 6.5 of the
305+
% where the variable names are consistent with Section 6.5 of the
306306
% text.
307307
%
308308
%% Example: 20 cm long aluminum beam with h=1.5 cm, b=3 cm
@@ -614,13 +614,13 @@ def response(xdd, f, t, x0, v0):
614614
9.99199680e+00, 9.99599840e+00, 1.00000000e+01]), array([[ 1. ],
615615
[ 0.99591926],
616616
[ 0.9916807 ],
617-
...,
617+
...,
618618
[ 0.56502396],
619619
[ 0.56123989],
620620
[ 0.55736747]]), array([[-1. ],
621621
[-1.03952678],
622622
[-1.07887136],
623-
...,
623+
...,
624624
[-0.93454914],
625625
[-0.95670532],
626626
[-0.97869947]]), 0.015811388300841896, 3.1622776601683795, 3.1618823507524758, 1.0441611791969838)
@@ -1212,13 +1212,13 @@ def fourier_approximation(a0, aodd, aeven, bodd, beven, N, T):
12121212

12131213
if __name__ == "__main__":
12141214
import doctest
1215-
doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS)
1216-
#import vtoolbox as vtb
1215+
doctest.testmod(verbose=False, optionflags=doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE)
1216+
#import vibration_toolbox as vtb
12171217

12181218

12191219
# doctest.run_docstring_examples(frfest,globals(),optionflags=doctest.ELLIPSIS)
12201220
# doctest.run_docstring_examples(asd,globals(),optionflags=doctest.ELLIPSIS)
1221-
""" What this does.
1221+
""" What this does.
12221222
python (name of this file) -v
12231223
will test all of the examples in the help.
12241224

0 commit comments

Comments
 (0)