33
33
34
34
35
35
def complex_to_polar (complex_values ):
36
- """Complex value to polar coordinates.
36
+ r """Complex value to polar coordinates.
37
37
38
38
Parameters
39
39
----------
@@ -239,7 +239,7 @@ def Rz(psi):
239
239
240
240
241
241
def Rzyx (eta ):
242
- """Full roation matrix.
242
+ r """Full roation matrix.
243
243
244
244
.. math::
245
245
R_{zyx} = R_z(\psi)R_y(\\theta)R_x(\phi)
@@ -262,7 +262,7 @@ def Rzyx(eta):
262
262
263
263
264
264
def Tzyx (eta ):
265
- """Transformation matrix.
265
+ r """Transformation matrix.
266
266
267
267
Parameters
268
268
----------
@@ -292,7 +292,7 @@ def Tzyx(eta):
292
292
293
293
294
294
def J (eta ):
295
- """6 DOF rotation matrix.
295
+ r """6 DOF rotation matrix.
296
296
297
297
.. math::
298
298
J(\eta) = \left[\\begin{array}{cc}R_{zyx}(\eta) & O_{3\\times 3} \\\ O_{3\\times 3} & T_{zyx}(\eta)\end{array} \\right]
@@ -316,7 +316,7 @@ def J(eta):
316
316
317
317
318
318
def Smat (x ):
319
- """
319
+ r """
320
320
Skew-symmetric cross-product operator matrix.
321
321
322
322
Parameters
@@ -331,7 +331,7 @@ def Smat(x):
331
331
332
332
333
333
def three2sixDOF (v ):
334
- """3 to 6 DOF conversion.
334
+ r """3 to 6 DOF conversion.
335
335
336
336
Converts a vector a matrix from 3DOF
337
337
to 6DOF.
@@ -368,7 +368,7 @@ def three2sixDOF(v):
368
368
369
369
370
370
def six2threeDOF (v ):
371
- """6 to 3 DOF conversion.
371
+ r """6 to 3 DOF conversion.
372
372
373
373
Convert a 6DOF vecor or matrix to 3DOF.
374
374
@@ -392,7 +392,7 @@ def six2threeDOF(v):
392
392
393
393
394
394
def timeit (func ):
395
- """
395
+ r """
396
396
Decorator for measuring execution time of function.
397
397
398
398
Print the execution time of a function. (Mainly for
@@ -433,7 +433,7 @@ def wrapper(*args, **kwargs):
433
433
434
434
435
435
def rigid_body_transform (r , eta , in_ned = True ):
436
- """Calculate the relative motion of a point r different from the COG.
436
+ r """Calculate the relative motion of a point r different from the COG.
437
437
438
438
The calculation assumes small angles (s.t. cos(theta)=0 and sin(theta)=theta)
439
439
and is computed as:
@@ -466,7 +466,7 @@ def rigid_body_transform(r, eta, in_ned=True):
466
466
467
467
468
468
def power_spectral_density (timeseries , fs , freq_hz = False , nperseg = 2 ** 11 ):
469
- """Compute the Power Spectral Density (PSD) of a timeseries.
469
+ r """Compute the Power Spectral Density (PSD) of a timeseries.
470
470
471
471
The PSD is calculated using scipy.signals.welch
472
472
@@ -495,9 +495,9 @@ def power_spectral_density(timeseries, fs, freq_hz=False, nperseg=2**11):
495
495
496
496
497
497
# --------- READ DATA UTILITY FUNCTIONS -------------------
498
- re_science = "\s{1,}-?\d\.?\d*[Ee][+\-]?\d+"
499
- re_int = "\s{1,}[0-9]{1,}"
500
- re_float = "\s{1,}[0-9]{1,}\.[0-9]{1,}"
498
+ re_science = r "\s{1,}-?\d\.?\d*[Ee][+\-]?\d+"
499
+ re_int = r "\s{1,}[0-9]{1,}"
500
+ re_float = r "\s{1,}[0-9]{1,}\.[0-9]{1,}"
501
501
502
502
503
503
def data2num (line ):
@@ -513,7 +513,7 @@ def data2float(line):
513
513
514
514
515
515
def read_tf (file_path , tf_type = "motion" ):
516
- """Read VERES transfer function output.
516
+ r """Read VERES transfer function output.
517
517
518
518
The function reads data from veres input files.
519
519
- Motion RAOs are found in '.re1'
@@ -637,7 +637,7 @@ def read_tf(file_path, tf_type="motion"):
637
637
638
638
639
639
def read_hydrod (filepath ):
640
- """Read hydrodynamic coefficients from Veres output file.
640
+ r """Read hydrodynamic coefficients from Veres output file.
641
641
642
642
The function reads the hydrodynamic coefficients from a Veres output file.
643
643
The coefficients are transformed from the CG to CO and from the Veres
@@ -775,7 +775,7 @@ def read_hydrod(filepath):
775
775
776
776
777
777
def read_wave_drift (filepath ):
778
- """Read wave drift data from Veres output file.
778
+ r """Read wave drift data from Veres output file.
779
779
780
780
The function reads the wave drift data from a Veres output file. The data
781
781
is transformed from the Veres axis system to the mclsimpy axis system. The
@@ -852,7 +852,7 @@ def read_wave_drift(filepath):
852
852
def plot_raos (
853
853
raos , freqs , plot_polar = True , rao_type = "motion" , wave_angle = 0 , figsize = (16 , 8 )
854
854
):
855
- """Plot the force or motion RAOs.
855
+ r """Plot the force or motion RAOs.
856
856
857
857
The RAOs should be complex.
858
858
@@ -892,13 +892,13 @@ def plot_raos(
892
892
np .angle (raos [i , 0 , wave_angle , 0 ]),
893
893
np .abs (raos [i , 0 , wave_angle , 0 ]),
894
894
"ro" ,
895
- label = "$\omega_{min}$" ,
895
+ label = r "$\omega_{min}$" ,
896
896
)
897
897
plt .plot (
898
898
np .angle (raos [i , - 1 , wave_angle , 0 ]),
899
899
np .abs (raos [i , - 1 , wave_angle , 0 ]),
900
900
"go" ,
901
- label = "$\omega_{max}$" ,
901
+ label = r "$\omega_{max}$" ,
902
902
)
903
903
if (i < 3 ) and (rao_type == "motion" ):
904
904
plt .gca ().set_rmax (1 )
@@ -910,7 +910,7 @@ def plot_raos(
910
910
for i in range (6 ):
911
911
plt .sca (axs [i // 3 , i % 3 ])
912
912
plt .plot (freqs , np .abs (raos [i , :, wave_angle , 0 ]))
913
- plt .xlabel ("$\omega \; [rad/s]$" )
913
+ plt .xlabel (r "$\omega \; [rad/s]$" )
914
914
if i < 3 :
915
915
plt .ylabel (r"$\frac{\eta}{\zeta_a} \; [\frac{m}{m}]$" )
916
916
else :
@@ -920,8 +920,8 @@ def plot_raos(
920
920
for i in range (6 ):
921
921
plt .sca (axs [i // 3 , i % 3 ])
922
922
plt .plot (freqs , np .angle (raos [i , :, wave_angle , 0 ]))
923
- plt .xlabel ("$\omega \; [rad/s]$" )
924
- plt .ylabel ("$\phi \; [rad]$" )
923
+ plt .xlabel (r "$\omega \; [rad/s]$" )
924
+ plt .ylabel (r "$\phi \; [rad]$" )
925
925
926
926
plt .show ()
927
927
@@ -995,7 +995,7 @@ def _complete_sector_coeffs(vessel_config: dict):
995
995
996
996
997
997
def generate_config_file (input_files_paths : list = None , input_file_dir : str = None ):
998
- """Generate a .json configuration file for a vessel. The function can take
998
+ r """Generate a .json configuration file for a vessel. The function can take
999
999
either a list of file locations, or the path to the directory containing the
1000
1000
result files.
1001
1001
@@ -1135,7 +1135,7 @@ def generate_config_file(input_files_paths: list = None, input_file_dir: str = N
1135
1135
1136
1136
1137
1137
def invfreqs (h , w , nb , na , weights = None , method = 0 , maxiter = 40 ):
1138
- """
1138
+ r """
1139
1139
Estimate the numerator and denominator coefficients of a transfer function from
1140
1140
frequency response data using complex function curve fitting with quasi-linear least squares.
1141
1141
@@ -1241,7 +1241,7 @@ def _invfreqs_alt(g, worN, nB, nA, wf=None, nk=0):
1241
1241
1242
1242
1243
1243
def _stabilize (a ):
1244
- """Stabilize the denominator polynomial by switching sign of real part for roots with real part > 1.
1244
+ r """Stabilize the denominator polynomial by switching sign of real part for roots with real part > 1.
1245
1245
1246
1246
Parameters
1247
1247
----------
@@ -1264,7 +1264,7 @@ def _stabilize(a):
1264
1264
1265
1265
1266
1266
def joint_identification (w , A , B , order , plot_estimate = False , method = 0 ):
1267
- """Joint identification of infinity added mass and radiation forces.
1267
+ r """Joint identification of infinity added mass and radiation forces.
1268
1268
1269
1269
Parameters
1270
1270
----------
@@ -1366,7 +1366,7 @@ def joint_identification(w, A, B, order, plot_estimate=False, method=0):
1366
1366
1367
1367
1368
1368
def system_identification (w , A , B , max_order = 10 , method = 0 , plot_estimate = False ):
1369
- """Identify the system matrices of a linear time-invariant system.
1369
+ r """Identify the system matrices of a linear time-invariant system.
1370
1370
1371
1371
Parameters
1372
1372
----------
@@ -1582,7 +1582,7 @@ def system_identification(w, A, B, max_order=10, method=0, plot_estimate=False):
1582
1582
1583
1583
1584
1584
def quat2eul (w , x , y , z ):
1585
- """
1585
+ r """
1586
1586
Returns the ZYX roll-pitch-yaw angles from a quaternion.
1587
1587
"""
1588
1588
q = np .array ((w , x , y , z ))
@@ -1607,7 +1607,7 @@ def quat2eul(w, x, y, z):
1607
1607
1608
1608
1609
1609
def quat2eul (w , x , y , z ):
1610
- """
1610
+ r """
1611
1611
Returns the ZYX roll-pitch-yaw angles from a quaternion.
1612
1612
"""
1613
1613
q = np .array ((w , x , y , z ))
0 commit comments