Skip to content

Commit fabb035

Browse files
committed
Update newest black formatting
1 parent a07ff41 commit fabb035

26 files changed

+152
-153
lines changed

mhkit/acoustics/__init__.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
"""
22
The passive acoustics module provides a set of functions
3-
for analyzing and visualizing passive acoustic monitoring
3+
for analyzing and visualizing passive acoustic monitoring
44
data deployed in water bodies. This package reads in raw
5-
*.wav* files and conducts basic acoustics analysis and
5+
*.wav* files and conducts basic acoustics analysis and
66
visualization.
77
88
To start using the module, import it directly from MHKiT:
99
``from mhkit import acoustics``. The analysis functions
10-
are available directly from the main import, while the
11-
I/O and graphics submodules are available from
10+
are available directly from the main import, while the
11+
I/O and graphics submodules are available from
1212
``acoustics.io`` and ``acoustics.graphics``, respectively.
13-
The base functions are intended to be used on top of the I/O submodule, and
14-
include functionality to calibrate data, create spectral densities, sound
13+
The base functions are intended to be used on top of the I/O submodule, and
14+
include functionality to calibrate data, create spectral densities, sound
1515
pressure levels, and time or band aggregate spectral data.
1616
"""
1717

mhkit/acoustics/analysis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def sound_pressure_spectral_density_level(spsd: xr.DataArray) -> xr.DataArray:
337337

338338

339339
def _validate_method(
340-
method: Union[str, Dict[str, Union[float, int]]]
340+
method: Union[str, Dict[str, Union[float, int]]],
341341
) -> Tuple[str, Optional[Union[float, int]]]:
342342
"""
343343
Validates the 'method' parameter and returns the method name and its argument (if any)

mhkit/acoustics/graphics.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
2-
This submodule provides essential plotting functions for visualizing passive acoustics
3-
data. The functions allow for customizable plotting of sound pressure spectral density
2+
This submodule provides essential plotting functions for visualizing passive acoustics
3+
data. The functions allow for customizable plotting of sound pressure spectral density
44
levels across time and frequency dimensions.
55
66
Each plotting function leverages the flexibility of Matplotlib, allowing for passthrough
@@ -11,12 +11,12 @@
1111
-------------
1212
1. **plot_spectrogram**:
1313
14-
- Generates a spectrogram plot from sound pressure spectral density level data,
14+
- Generates a spectrogram plot from sound pressure spectral density level data,
1515
with a logarithmic frequency scale by default for improved readability of acoustic data.
1616
1717
2. **plot_spectra**:
1818
19-
- Produces a spectral density plot with a log-transformed x-axis, allowing for clear
19+
- Produces a spectral density plot with a log-transformed x-axis, allowing for clear
2020
visualization of spectral density across frequency bands.
2121
"""
2222

mhkit/acoustics/io.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
This submodule provides input/output functions for passive acoustics data,
33
focusing on hydrophone recordings stored in WAV files. The main functionality
4-
includes reading and processing hydrophone data from various manufacturers
4+
includes reading and processing hydrophone data from various manufacturers
55
and exporting audio files for easy playback and analysis.
66
77
Supported Hydrophone Models
@@ -14,28 +14,28 @@
1414
1515
1. **Data Reading**:
1616
17-
- `read_hydrophone`: Main function to read a WAV file from a hydrophone and
18-
convert it to either a voltage or pressure time series, depending on the
17+
- `read_hydrophone`: Main function to read a WAV file from a hydrophone and
18+
convert it to either a voltage or pressure time series, depending on the
1919
availability of sensitivity data.
2020
21-
- `read_soundtrap`: Wrapper for reading Ocean Instruments SoundTrap hydrophone
21+
- `read_soundtrap`: Wrapper for reading Ocean Instruments SoundTrap hydrophone
2222
files, automatically using appropriate metadata.
2323
24-
- `read_iclisten`: Wrapper for reading Ocean Sonics icListen hydrophone files,
25-
including metadata processing to apply hydrophone sensitivity for direct
24+
- `read_iclisten`: Wrapper for reading Ocean Sonics icListen hydrophone files,
25+
including metadata processing to apply hydrophone sensitivity for direct
2626
sound pressure calculation.
2727
2828
2. **Audio Export**:
2929
30-
- `export_audio`: Converts processed sound pressure data back into a WAV file
30+
- `export_audio`: Converts processed sound pressure data back into a WAV file
3131
format, with optional gain adjustment to improve playback quality.
3232
3333
3. **Data Extraction**:
3434
35-
- `_read_wav_metadata`: Extracts metadata from a WAV file, including bit depth
35+
- `_read_wav_metadata`: Extracts metadata from a WAV file, including bit depth
3636
and other header information.
3737
38-
- `_calculate_voltage_and_time`: Converts raw WAV data into voltage values and
38+
- `_calculate_voltage_and_time`: Converts raw WAV data into voltage values and
3939
generates a time index based on the sampling frequency.
4040
"""
4141

mhkit/dolfyn/adv/clean.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Module containing functions to clean data
2-
"""
1+
"""Module containing functions to clean data"""
32

43
import warnings
54
import numpy as np

mhkit/loads/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
The `loads` package of the MHKiT (Marine and Hydrokinetic Toolkit) library
33
provides tools and functionalities for analyzing and visualizing loads data
4-
from marine and hydrokinetic (MHK) devices. This package is designed to
4+
from marine and hydrokinetic (MHK) devices. This package is designed to
55
assist engineers, researchers, and analysts in understanding the forces and
66
stresses applied to MHK devices under various operational and environmental
77
conditions.

mhkit/loads/extreme/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
and wave data statistics.
44
55
It includes methods for calculating peaks over threshold, estimating
6-
short-term extreme distributions,and performing wave amplitude
6+
short-term extreme distributions,and performing wave amplitude
77
normalization for most likely extreme response analysis.
88
"""
99

mhkit/loads/extreme/extremes.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
"""
22
This module provides functionality for estimating the short-term and
3-
long-term extreme distributions of responses in a time series. It
4-
includes methods for analyzing peaks, block maxima, and applying
5-
statistical distributions to model extreme events. The module supports
6-
various methods for short-term extreme estimation, including peaks
7-
fitting with Weibull, tail fitting, peaks over threshold, and block
8-
maxima methods with GEV (Generalized Extreme Value) and Gumbel
9-
distributions. Additionally, it offers functionality to approximate
10-
the long-term extreme distribution by weighting short-term extremes
3+
long-term extreme distributions of responses in a time series. It
4+
includes methods for analyzing peaks, block maxima, and applying
5+
statistical distributions to model extreme events. The module supports
6+
various methods for short-term extreme estimation, including peaks
7+
fitting with Weibull, tail fitting, peaks over threshold, and block
8+
maxima methods with GEV (Generalized Extreme Value) and Gumbel
9+
distributions. Additionally, it offers functionality to approximate
10+
the long-term extreme distribution by weighting short-term extremes
1111
across different sea states.
1212
1313
Functions:
14-
- ste_peaks: Estimates the short-term extreme distribution from peaks
14+
- ste_peaks: Estimates the short-term extreme distribution from peaks
1515
distribution using specified statistical methods.
1616
- block_maxima: Finds the block maxima in a time-series data to be used
1717
in block maxima methods.
18-
- ste_block_maxima_gev: Approximates the short-term extreme distribution
18+
- ste_block_maxima_gev: Approximates the short-term extreme distribution
1919
using the block maxima method with the GEV distribution.
20-
- ste_block_maxima_gumbel: Approximates the short-term extreme
20+
- ste_block_maxima_gumbel: Approximates the short-term extreme
2121
distribution using the block maxima method with the Gumbel distribution.
22-
- ste: Alias for `short_term_extreme`, facilitating easier access to the
22+
- ste: Alias for `short_term_extreme`, facilitating easier access to the
2323
primary functionality of estimating short-term extremes.
24-
- short_term_extreme: Core function to approximate the short-term extreme
24+
- short_term_extreme: Core function to approximate the short-term extreme
2525
distribution from a time series using chosen methods.
26-
- full_seastate_long_term_extreme: Combines short-term extreme
26+
- full_seastate_long_term_extreme: Combines short-term extreme
2727
distributions using weights to estimate the long-term extreme distribution.
2828
"""
2929

mhkit/loads/extreme/mler.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
"""
2-
This module provides functionalities to calculate and analyze Most
2+
This module provides functionalities to calculate and analyze Most
33
Likely Extreme Response (MLER) coefficients for wave energy converter
44
design and risk assessment. It includes functions to:
55
66
- Calculate MLER coefficients (`mler_coefficients`) from a sea state
77
spectrum and a response Amplitude Response Operator (ARO).
88
- Define and manipulate simulation parameters (`mler_simulation`) used
99
across various MLER analyses.
10-
- Renormalize the incoming amplitude of the MLER wave
10+
- Renormalize the incoming amplitude of the MLER wave
1111
(`mler_wave_amp_normalize`) to match the desired peak height for more
1212
accurate modeling and analysis.
13-
- Export the wave amplitude time series (`mler_export_time_series`)
13+
- Export the wave amplitude time series (`mler_export_time_series`)
1414
based on the calculated MLER coefficients for further analysis or
1515
visualization.
1616
"""

mhkit/loads/extreme/peaks.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
"""
22
This module provides utilities for analyzing wave data, specifically
33
for identifying significant wave heights and estimating wave peak
4-
distributions using statistical methods.
4+
distributions using statistical methods.
55
66
Functions:
7-
- _calculate_window_size: Calculates the window size for peak
7+
- _calculate_window_size: Calculates the window size for peak
88
independence using the auto-correlation function of wave peaks.
9-
- _peaks_over_threshold: Identifies peaks over a specified
9+
- _peaks_over_threshold: Identifies peaks over a specified
1010
threshold and returns independent storm peak values adjusted by
1111
the threshold.
12-
- global_peaks: Identifies global peaks in a zero-centered
12+
- global_peaks: Identifies global peaks in a zero-centered
1313
response time-series based on consecutive zero up-crossings.
1414
- number_of_short_term_peaks: Estimates the number of peaks within a
1515
specified short-term period.
@@ -20,13 +20,13 @@
2020
- automatic_hs_threshold: Determines the best significant wave height
2121
threshold for the peaks-over-threshold method.
2222
- peaks_distribution_peaks_over_threshold: Estimates the peaks
23-
distribution using the peaks over threshold method by fitting a
23+
distribution using the peaks over threshold method by fitting a
2424
generalized Pareto distribution.
2525
2626
References:
27-
- Neary, V. S., S. Ahn, B. E. Seng, M. N. Allahdadi, T. Wang, Z. Yang,
28-
and R. He (2020). "Characterization of Extreme Wave Conditions for
29-
Wave Energy Converter Design and Project Risk Assessment.” J. Mar.
27+
- Neary, V. S., S. Ahn, B. E. Seng, M. N. Allahdadi, T. Wang, Z. Yang,
28+
and R. He (2020). "Characterization of Extreme Wave Conditions for
29+
Wave Energy Converter Design and Project Risk Assessment.” J. Mar.
3030
Sci. Eng. 2020, 8(4), 289; https://doi.org/10.3390/jmse8040289.
3131
3232
"""

mhkit/loads/extreme/sample.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
This module provides statistical analysis tools for extreme value
33
analysis in environmental and engineering applications. It focuses on
44
estimating values corresponding to specific return periods based on
5-
the statistical distribution of observed or simulated data.
5+
the statistical distribution of observed or simulated data.
66
77
Functionality:
8-
- return_year_value: Calculates the value from a given distribution
8+
- return_year_value: Calculates the value from a given distribution
99
corresponding to a specified return year. This function is particularly
1010
useful for determining design values for engineering structures or for
1111
risk assessment in environmental studies.

mhkit/loads/general.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This module provides tools for analyzing and processing data signals
33
related to turbine blade performance and fatigue analysis. It implements
44
methodologies based on standards such as IEC TS 62600-3:2020 ED1,
5-
incorporating statistical binning, moment calculations, and fatigue
5+
incorporating statistical binning, moment calculations, and fatigue
66
damage estimation using the rainflow counting algorithm. Key
77
functionalities include:
88
@@ -11,8 +11,8 @@
1111
for each bin, following IEC TS 62600-3:2020 ED1 guidelines. It supports
1212
output in both pandas DataFrame and xarray Dataset formats.
1313
14-
- `blade_moments`: Calculates the flapwise and edgewise moments of turbine
15-
blades using derived calibration coefficients and raw strain signals.
14+
- `blade_moments`: Calculates the flapwise and edgewise moments of turbine
15+
blades using derived calibration coefficients and raw strain signals.
1616
This function is crucial for understanding the loading and performance
1717
characteristics of turbine blades.
1818

mhkit/loads/graphics.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
This module provides functionalities for plotting statistical data
3-
related to a given variable or dataset.
3+
related to a given variable or dataset.
44
55
- `plot_statistics` is designed to plot raw statistical measures
66
(mean, maximum, minimum, and optional standard deviation) of a
@@ -9,8 +9,8 @@
99
1010
- `plot_bin_statistics` extends these capabilities to binned data,
1111
offering a way to visualize binned statistics (mean, maximum, minimum)
12-
along with their respective standard deviations. This function also
13-
supports label and title customization, as well as saving the plot to
12+
along with their respective standard deviations. This function also
13+
supports label and title customization, as well as saving the plot to
1414
a specified path.
1515
"""
1616

mhkit/mooring/graphics.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
"""
2-
This module provides a function for creating animated visualizations of a
3-
MoorDyn node position dataset using the matplotlib animation API.
2+
This module provides a function for creating animated visualizations of a
3+
MoorDyn node position dataset using the matplotlib animation API.
44
5-
It includes the main function `animate`, which creates either 2D or 3D
6-
animations depending on the input parameters.
5+
It includes the main function `animate`, which creates either 2D or 3D
6+
animations depending on the input parameters.
77
8-
In the animations, the position of nodes in the MoorDyn dataset are plotted
9-
over time, allowing the user to visualize how these positions change.
8+
In the animations, the position of nodes in the MoorDyn dataset are plotted
9+
over time, allowing the user to visualize how these positions change.
1010
11-
This module also includes several helper functions that are used by
12-
`animate` to validate inputs, generate lists of nodes along each axis,
13-
calculate plot limits, and set labels and titles for plots.
11+
This module also includes several helper functions that are used by
12+
`animate` to validate inputs, generate lists of nodes along each axis,
13+
calculate plot limits, and set labels and titles for plots.
1414
15-
The user can specify various parameters for the animation such as the
16-
dimension (2D or 3D), the axes to plot along, the plot limits for each
17-
axis, the interval between frames, whether the animation repeats, and the
15+
The user can specify various parameters for the animation such as the
16+
dimension (2D or 3D), the axes to plot along, the plot limits for each
17+
axis, the interval between frames, whether the animation repeats, and the
1818
labels and title for the plot.
1919
2020
Requires:

mhkit/mooring/io.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
This module provides functions to read and parse MoorDyn output files.
33
44
The main function read_moordyn takes as input the path to a MoorDyn output file and optionally
5-
the path to a MoorDyn input file. It reads the data from the output file, stores it in an
6-
xarray dataset, and then if provided, parses the input file for additional metadata to store
5+
the path to a MoorDyn input file. It reads the data from the output file, stores it in an
6+
xarray dataset, and then if provided, parses the input file for additional metadata to store
77
as attributes in the dataset.
88
9-
The helper function _moordyn_input is used to parse the MoorDyn output file. It loops through
10-
each line in the output file, parses various sets of properties and parameters, and stores
9+
The helper function _moordyn_input is used to parse the MoorDyn output file. It loops through
10+
each line in the output file, parses various sets of properties and parameters, and stores
1111
them as attributes in the provided dataset.
1212
1313
Typical usage example:

mhkit/power/characteristics.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
"""
2-
This module contains functions for calculating electrical power metrics from
3-
measured voltage and current data. It supports both direct current (DC) and
4-
alternating current (AC) calculations, including instantaneous frequency
5-
analysis for AC signals and power calculations for three-phase AC systems.
6-
The calculations can accommodate both line-to-neutral and line-to-line voltage
7-
measurements and offer flexibility in output formats, allowing results to be
2+
This module contains functions for calculating electrical power metrics from
3+
measured voltage and current data. It supports both direct current (DC) and
4+
alternating current (AC) calculations, including instantaneous frequency
5+
analysis for AC signals and power calculations for three-phase AC systems.
6+
The calculations can accommodate both line-to-neutral and line-to-line voltage
7+
measurements and offer flexibility in output formats, allowing results to be
88
saved as either pandas DataFrames or xarray Datasets.
99
1010
Functions:
1111
instantaneous_frequency: Calculates the instantaneous frequency of a measured
1212
voltage signal over time.
13-
13+
1414
dc_power: Computes the DC power from voltage and current measurements, providing
1515
both individual channel outputs and a gross power calculation.
16-
16+
1717
ac_power_three_phase: Calculates the magnitude of active AC power for three-phase
18-
systems, considering the power factor and voltage measurement configuration
18+
systems, considering the power factor and voltage measurement configuration
1919
(line-to-neutral or line-to-line).
2020
"""
2121

0 commit comments

Comments
 (0)