Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pCrunch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .crunch import Crunch
from .fatigue import FatigueParams
from .openfast_readers import OpenFASTAscii, OpenFASTBinary, load_FAST_out, read
from .openfast_readers import OpenFASTAscii, OpenFASTBinary, load_FAST_out, read, read_parallel
from .aeroelastic_output import AeroelasticOutput
2 changes: 1 addition & 1 deletion pCrunch/fatigue.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def get_rainflow_counts(self, chan, bins, S_ult=None, goodman=False):
"""

try:
S, Mrf = fatpack.find_rainflow_ranges(chan, k=128, return_means=True)
S, Mrf = fatpack.find_rainflow_ranges(chan, k=256, return_means=True)
except Exception:
S = Mrf = np.zeros(1)

Expand Down
23 changes: 23 additions & 0 deletions pCrunch/openfast_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,29 @@ def read(filename, **kwargs):
return fastout
else:
return fastout[0]

def read_parallel(filenames, n_cores=1, **kwargs):
"""
Read OpenFAST files in parallel.

Parameters
----------
filenames : list of str
List of OpenFAST file paths.
n_cores : int, optional
Number of cores to use for parallel reading. Default is 1.

Returns
-------
list of OpenFASTOutput
List of OpenFASTOutput instances.
"""

import multiprocessing
with multiprocessing.Pool(n_cores) as pool:
outputs = pool.map(read, filenames, **kwargs)

return outputs


def load_FAST_out(filenames, tmin=0, tmax=float('inf'), **kwargs):
Expand Down
Loading