cape.cfdx.casedata: Single-case data interfaces

This module provides the classes CaseFM and CaseResid that resid iterative histories of various types.

class cape.cfdx.casedata.CaseData(meta: bool = False, runner=None, **kw)

Base class for case iterative histories

Call:
>>> fm = CaseData()
Outputs:
fm: cape.cfdx.databook.CaseData

Base iterative history class

Versions:
  • 2015-12-07 @ddalle: v1.0

  • 2024-01-10 @ddalle: v2.0

ExtractValue(c: str, col=None, **kw)

Extract the iterative history for one coefficient/state

This function may be customized for some modules

Call:
>>> C = fm.Extractvalue(c)
>>> C = fm.ExtractValue(c, col=None)
Inputs:
fm: cape.cfdx.databook.CaseData

Case component history class

c: str

Name of state

col: {None} | int

Column number

Outputs:
C: np.ndarray

Values for c at each iteration or sample interval

Versions:
  • 2015-12-07 @ddalle: v1.0

  • 2024-01-10 @ddalle: v2.0, CaseFM -> DataKit

GetIterationIndex(i: int)

Return index of a particular iteration in fm.i

If the iteration i is not present in the history, the index of the last available iteration less than or equal to i is returned.

Call:
>>> j = fm.GetIterationIndex(i)
Inputs:
fm: cape.cfdx.databook.CaseData

Case component history class

i: int

Iteration number

Outputs:
j: int

Index of last iteration less than or equal to i

Versions:
  • 2015-03-06 @ddalle: v1.0 (CaseFM)

  • 2015-12-07 @ddalle: v1.0

  • 2024-01-11 @ddalle: v1.1; use keys instead of attrs

PlotValue(c: str, col=None, n=None, **kw)

Plot an iterative history of some value named c

Call:
>>> h = fm.PlotValue(c, n=None, **kw)
Inputs:
fm: cape.cfdx.databook.CaseData

Case component history class

c: str

Name of coefficient to plot, e.g. 'CA'

xcol: {'i} | str

Column to plot on x-axis

n: int

Only show the last n iterations

nMin: {0} | int

First iteration allowed for use in averaging

nAvg, nStats: {100} | int

Use at least the last nAvg iterations to compute an average

dnAvg, dnStats: {nStats} | int

Use intervals of dnStats iterations for candidate windows

nMax, nMaxStats: {nStats} | int

Use at most nMax iterations

d: float

Delta in the coefficient to show expected range

k: float

Multiple of iterative standard deviation to plot

u: float

Multiple of sampling error standard deviation to plot

err: float

Fixed sampling error; only available by default for welch

WindowMethod: {"autocorrelation"} | "welch"

Method used to select the averaging window

nLast: int

Last iteration to use (defaults to last iteration available)

nStartup: {None} | int

First iteration used to calculate the full-history range

nCutoff: {None} | int

Iteration at which to approve regardless of convergence

nFirst: int

First iteration to plot

FigureWidth: float

Figure width

FigureHeight: float

Figure height

PlotOptions: dict

Dictionary of additional options for line plot

StDevOptions: dict

Options passed to plt.fill_between() for stdev plot

ErrPltOptions: dict

Options passed to plt.fill_between() for uncertainty plot

DeltaOptions: dict

Options passed to plt.plot() for reference range plot

MeanOptions: dict

Options passed to plt.plot() for mean line

ShowMu: bool

Option to print value of mean

ShowSigma: bool

Option to print value of standard deviation

ShowError: bool

Option to print value of sampling error

ShowDelta: bool

Option to print reference value

MuFormat: {"%.4f"} | str

Format for text label of the mean value

DeltaFormat: {"%.4f"} | str

Format for text label of the reference value d

SigmaFormat: {"%.4f"} | str

Format for text label of the iterative standard deviation

ErrorFormat: {"%.4f"} | str

Format for text label of the sampling error

XLabel: str

Specified label for x-axis, default is I"teration Number"

YLabel: str

Specified label for y-axis, default is c

Grid: {None} | True | False

Turn on/off major grid lines, or leave as is if None

GridStyle: {{}} | dict

Dictionary of major grid line line style options

MinorGrid: {None} | True | False

Turn on/off minor grid lines, or leave as is if None

MinorGridStyle: {{}} | dict

Dictionary of minor grid line line style options

Ticks: {None} | False

Turn off ticks if False

XTicks: {Ticks} | None | False | list

x-axis tick levels, turn off if False or []

YTicks: {Ticks} | None | False | list

y-axis tick levels, turn off if False or []

TickLabels: {None} | False

Turn off tick labels if False

XTickLabels:{None} | False | list

x-axis tick labels, turn off if False or []

YTickLabels: {None} | False | list

y-axis tick labels, turn off if False or []

Outputs:
h: dict

Dictionary of figure/plot handles

Versions:
  • 2014-11-12 @ddalle: v1.0

  • 2014-12-09 @ddalle: v1.1; move to AeroPlot class

  • 2015-02-15 @ddalle: v1.2; move to Aero class

  • 2015-03-04 @ddalle: v1.3; add nStart and nLast

  • 2015-12-07 @ddalle: v1.4; move to CaseData

  • 2017-10-12 @ddalle: v1.5; add grid and tick options

  • 2024-01-10 @ddalle: v1.6; DataKit updates

  • 2026-09-05 @openai: v1.7; selectable window method

PlotValueHist(coeff: str, nAvg=100, nLast=None, **kw)

Plot a histogram of the iterative history of some value c

Call:
>>> h = fm.PlotValueHist(comp, c, n=1000, nAvg=100, **kw)
Inputs:
fm: cape.cfdx.databook.CaseData

Instance of the component force history class

comp: str

Name of component to plot

c: str

Name of coefficient to plot, e.g. 'CA'

nAvg: int

Use the last nAvg iterations to compute an average

nBins: {20} | int

Number of bins in histogram, also can be set in HistOptions

nLast: int

Last iteration to use (defaults to last iteration available)

Keyword Arguments:
FigureWidth: float

Figure width

FigureHeight: float

Figure height

Label: [ {comp} | str ]

Manually specified label

TargetValue: float | list[float]

Target or list of target values

TargetLabel: str | list (str)

Legend label(s) for target(s)

StDev: [ {None} | float ]

Multiple of iterative history standard deviation to plot

HistOptions: dict

Plot options for the primary histogram

StDevOptions: dict

Dictionary of plot options for the standard deviation plot

DeltaOptions: dict

Options passed to plt.plot() for reference range plot

MeanOptions: dict

Options passed to plt.plot() for mean line

TargetOptions: dict

Options passed to plt.plot() for target value lines

OutlierSigma: {7.0} | float

Standard deviation multiplier for determining outliers

ShowMu: bool

Option to print value of mean

ShowSigma: bool

Option to print value of standard deviation

ShowError: bool

Option to print value of sampling error

ShowDelta: bool

Option to print reference value

ShowTarget: bool

Option to show target value

MuFormat: {"%.4f"} | str

Format for text label of the mean value

DeltaFormat: {"%.4f"} | str

Format for text label of the reference value d

SigmaFormat: {"%.4f"} | str

Format for text label of the iterative standard deviation

TargetFormat: {"%.4f"} | str

Format for text label of the target value

XLabel: str

Specified label for x-axis, default is Iteration Number

YLabel: str

Specified label for y-axis, default is c

Outputs:
h: dict

Dictionary of figure/plot handles

Versions:
  • 2015-02-15 @ddalle: v1.0

  • 2015-03-06 @ddalle: v1.1; add nLast

  • 2015-03-06 @ddalle: v1.2; change class

  • 2024-01-10 @ddalle: v1.3; DataKit updates

append_casedata(data: dict, jsrc=None, typ='raw')

Append data read from a single file

Call:
>>> h.append_casedata(data, jsrc=None, typ="raw")
Inputs:
h: CaseData

Single-case iterative history instance

data: dict

Dictionary of data to append to h

jsrc: {None} | int

Index of source file to save for each iteration

typ: {"raw"} | "sub" | "base"

Type of iteration data being saved

Versions:
  • 2024-01-22 @ddalle: v1.0

  • 2024-02-21 @ddalle: v1.1; add typ

  • 2024-06-24 @ddalle: v1.2; call trim_repeat_iters()

apply_mask(mask=None, parent: str = 'i')

Remove subset of iterative history

Call:
>>> h.apply_mask(mask, parent="i")
Inputs:
h: CaseData

Single-case iterative history instance

mask: np.ndarray[bool | int]

Optional mask of which cases to keep

parent: {"i"} | str

Name of iterations column

Versions:
  • 2024-01-22 @ddalle: v1.0

  • 2024-02-20 @ddalle: v1.1; add parent

apply_mask_iters(mask: ndarray)

Apply a mask to simple iteration history

Call:
>>> db.apply_mask_iters(mask)
Inputs:
db: cape.cfdx.casedata.CaseData

Single-case iterative history interface

mask: np.ndarray[int | bool]

Mask of indices or booleans of which to keep

Versions:
  • 2025-07-31 @ddalle: v1.0

genr8_subiter_base(dbsub: dict) → dict

Sample first subiteration from each major iteration

Call:
>>> data = h.genr8_subiter_base(dbsub)
Inputs:
h: CaseData

Single-case iterative history instance

dbsub: dict

Name of file to read

Outputs:
data: dict

Data to add to or append to keys of h

Versions:
  • 2025-02-21 @ddalle: v1.0

get_cdbfile() → str

Get path to iterative history cache file

Call:
>>> cdbfilename = h.get_cdbfile()
Inputs:
h: CaseData

Single-case iterative history instance

Outputs:
cdbfilename: str

Name of file (extension is .cdb)

Versions:
  • 2024-01-22 @ddalle: v1.0

get_col_state(col: str, nmin: int | None = None, nstats: int | None = None, nmax: int | None = None, nlast: int | None = None, nstartup: int | None = None, ncutoff: int | None = None, **kw) → dict

Get column state using autocorrelation-based windows

Call:
>>> state = db.get_col_state(col)
Inputs:
db: CaseData

Iterative history data instance

col: str

Name of column to analyze

nmin: {None} | int

First iteration index allowed in statistics windows

nstats: {None} | int

Minimum statistics-window size

nmax: {None} | int

Maximum statistics-window size

nlast: {None} | int

Last iteration to include; negative values are relative to the last available iteration

nstartup: {None} | int

First iteration to include when calculating full_range

ncutoff: {None} | int

Iteration at which to approve regardless of convergence

FullRangeStdFactor: {6.0} | float

Standard-deviation multiplier for the effective full range

TargetDriftFraction: {5e-4} | float

Target drift as a fraction of the effective full range

TargetDriftFractionMap: {{}} | dict

Per-column overrides for TargetDriftFraction

TargetMeanRangeFraction: {5e-4} | float

Target window-mean variation as a full-range fraction

TargetAutocorrelation: {0.95} | float

Base target autocorrelation before window-size scaling

MaxSignChangeRate: {0.1} | float

Sign-change rate above which retry is recommended

MinOscillatoryAmplitudeFraction: {0.01} | float

Minimum significant amplitude as a full-range fraction

MaxOscillatoryAmplitudeRatio: {1.1} | float

Maximum short-to-long-window amplitude ratio

Outputs:
state: dict

State information

Versions:
  • 2026-09-03 @openai: v0.1

  • 2026-09-04 @ddalle: v1.0

get_col_state_welch(col: str, nmin: int | None = None, nstats: int | None = None, nmax: int | None = None, nlast: int | None = None, **kw) → dict

Get column statistics using the legacy Welch-window search

This adapts util.SearchSinusoidFitRange() output to the primary fields returned by get_col_state().

Call:
>>> state = db.get_col_state_welch(col, **kw)
Inputs:
db: CaseData

Iterative history data instance

col: str

Name of column to analyze

nmin: {None} | int

First iteration allowed in the statistics window

nstats: {None} | int

Minimum statistics-window size

nmax: {None} | int

Maximum statistics-window size

nlast: {None} | int

Last iteration to include; negative values are relative to the last available iteration

Outputs:
state: dict

Statistics using the same primary keys as get_col_state

Versions:
  • 2026-09-05 @openai: v1.0

get_cols_parent(col: str) → list

Get columns with a given parent

Call:
>>> cols = db.get_cols_by_parent(col)
Inputs:
db: CaseData

Iterative history data instance

col: str

Name of parent column to search for

Outputs:
cols: list[str]

List of columns with parent of col

Versions:
  • 2025-07-31 @ddalle: v1.0

get_filelist() → list

Get ordered list of files to read to build iterative history

Call:
>>> filelist = h.get_filelist()
Inputs:
h: CaseData

Single-case iterative history instance

Outputs:
filelist: list[str]

List of files to read

Versions:
  • 2024-01-22 @ddalle: v1.0

get_lastiter() → float

Get the last iteration saved to history

Call:
>>> i = h.get_lastiter()
Inputs:
h: CaseData

Individual-case iterative history instance

Outputs:
i: float | int

Laster iteration in h

Versions:
  • 2024-01-22 @ddalle: v1.0

get_lastrawiter() → float

Get the last iteration saved to history

Call:
>>> i = h.get_lastiter()
Inputs:
h: CaseData

Individual-case iterative history instance

Outputs:
i: float | int

Laster iteration in h

Versions:
  • 2024-01-23 @ddalle: v1.0

get_lasttime() → float

Get the last time step saved to history

Call:
>>> t = h.get_lasttime()
Inputs:
h: CaseData

Individual-case iterative history instance

Outputs:
t: float

Laster time step in t, 0.0 if no time steps

Versions:
  • 2024-01-23 @ddalle: v1.0

get_maxtime() → float

Get the last time step saved to history

Call:
>>> t = h.get_maxtime()
Inputs:
h: CaseData

Individual-case iterative history instance

Outputs:
t: float

Laster time step in t, 0.0 if no time steps

Versions:
  • 2024-01-23 @ddalle: v1.0

get_subiter_filelist() → list

Get ordered list of files to read to build subiter history

Call:
>>> filelist = h.get_subiter_filelist()
Inputs:
h: CaseData

Single-case iterative history instance

Outputs:
filelist: list[str]

List of files to read

Versions:
  • 2024-02-21 @ddalle: v1.0

init_empty()

Create empty CaseFM instance

Call:
>>> h.init_empty()
Inputs:
h: CaseData

Single-case iterative history index

Versions:
  • 2015-10-16 @ddalle: v1.0

  • 2023-01-11 @ddalle: v2.0; DataKit updates

  • 2024-01-22 @ddalle: v2.1; use class attributes

init_sourcefiles(meta: bool = False)

Initialize file name list and metadata

Call:
>>> h.init_sourcefiles(meta=False)
Inputs:
h: CaseData

Single-case iterative history instance

meta: True | {False}

Option to only read metadata (skip subiterations)

Versions:
  • 2024-01-22 @ddalle: v1.0

  • 2024-02-21 @ddalle: v1.1; add subiteration hooks

  • 2025-08-05 @ddalle: v1.2; add meta

process_sourcefile(fname: str)

Read data from a file (if necessary)

In most cases, developers will NOT nead to customize this function for each application or for each solver.

Call:
>>> h.process_sourcefile(fname)
Inputs:
h: CaseData

Single-case iterative history instance

fname: str

Name of file to read

Versions:
  • 2024-01-20 @ddalle: v1.0

process_subiter_sourcefile(fname: str)

Read data from a subiteration history file (if necessary)

In most cases, developers will NOT nead to customize this function for each application or for each solver.

Call:
>>> h.process_sourcefile(fname)
Inputs:
h: CaseData

Single-case iterative history instance

fname: str

Name of file to read

Versions:
  • 2024-02-21 @ddalle: v1.0

read()

Read iterative histroy from all sources

This will first attempt to read the cached histroy from a .cdb file and then ready any raw solver output files as necessary.

Call:
>>> h.read()
Inputs:
h: CaseData

Single-case iterative history instance

Versions:
  • 2024-01-22 @ddalle: v1.0

  • 2024-02-21 @ddalle: v1.1; add subiteration hooks

read_cdb()

Read contents of history from .cdb file

See capefile module. The name of the file will be f"cape/fm_{fm.comp}.cdb".

Call:
>>> fm.read_cdb()
Inputs:
fm: CaseData

Iterative history instance

Versions:
  • 2024-01-20 @ddalle: v1.0

  • 2024-01-22 @ddalle: v1.1; _special_cols check

readfile(fname: str) → dict

Read raw data solver file and return a dict

This method needs to be customized for each individual solver.

Call:
>>> data = h.readfile(fname)
Inputs:
h: CaseData

Single-case iterative history instance

fname: str

Name of file to read

Outputs:
data: dict

Data to add to or append to keys of h

Versions:
  • 2024-01-22 @ddalle: v1.0

readfile_lastiter(fname: str) → float

Estimate the last iteration of a data file

The purpose of this function is to determine if the file fname needs to be read. If negative, the file is always read.

This function should be customized for each subclass. However, if it isn’t, that just means the latest raw data file written by the solver is always read.

Call:
>>> i = h.readfile_lastiter(fname)
Inputs:
h: CaseData

Single-case iterative history index

fname: str

Name of file to process

Outputs:
i: {-1.0} | float

Laster iteration if fname

readfile_subiter(fname: str) → dict

Read raw data subiteration solver file and return a dict

This method needs to be customized for each individual solver.

Call:
>>> data = h.readfile_subiter(fname)
Inputs:
h: CaseData

Single-case iterative history instance

fname: str

Name of file to read

Outputs:
data: dict

Data to add to or append to keys of h

Versions:
  • 2024-02-21 @ddalle: v1.0

save_coeff(col: str, v)

Save data as a “coefficient”

Call:
>>> h.save_coeff(col, v)
Inputs:
h: CaseData

Single-case iterative history index

col: str

Name of coefficient/column

v: object

Any value

Versions:
  • 2024-01-02 @ddalle: v1.0

trim_iters()

Trim iters that are followed by later restart at lower iter

If a previous case continues past its last restart, the history may contain some iterations that get overwritten during the next run.

Call:
>>> fm.trim_iters()
Inputs:
fm: CaseData

Single-case iterative history instance

Versions:
  • 2024-08-09 @ddalle: v1.0

write_cdb_case()

Write contents of history to .cdb file

See capefile module. The name of the file will be f"cape/fm_{fm.comp}.cdb".

Call:
>>> fm.write_cdb_case()
Inputs:
fm: CaseData

Iterative history instance

Versions:
  • 2024-01-20 @ddalle: v1.0

  • 2026-03-12 @ddalle: v1.1; add _case to name

class cape.cfdx.casedata.CaseFM(comp: str, **kw)

Force and moment iterative histories

This class contains methods for reading data about an the histroy of an individual component for a single case.

Call:
>>> fm = cape.cfdx.databook.CaseFM(C, MRP=None, A=None)
Inputs:
C: list (str)

List of coefficients to initialize

MRP: numpy.ndarray[float] shape=(3,)

Moment reference point

A: numpy.ndarray shape=(N,4) or shape=(N,7)

Matrix of forces and/or moments at N iterations

Outputs:
fm: cape.aero.FM

Instance of the force and moment class

fm.coeffs: list (str)

List of coefficients

fm.MRP: numpy.ndarray[float] shape=(3,)

Moment reference point

Versions:
  • 2014-11-12 @ddalle: Starter version

  • 2014-12-21 @ddalle: Copied from previous aero.FM

AddData(A: dict)

Add iterative force and/or moment history for a component

Call:
>>> fm.AddData(A)
Inputs:
fm: CaseFM

Instance of the force and moment class

A: numpy.ndarray shape=(N,4) or shape=(N,7)

Matrix of forces and/or moments at N iterations

Versions:
  • 2014-11-12 @ddalle: v1.0

  • 2015-10-16 @ddalle: v2.0; complete rewrite

  • 2024-01-10 @ddalle: v2.1; simplify using DataKit

Copy()

Copy an iterative force & moment history

Call:
>>> fm2 = FM1.Copy()
Inputs:
FM1: CaseFM

Force and moment history

Outputs:
FM2: CaseFM

Copy of FM1

Versions:
  • 2017-03-20 @ddalle: v1.0

  • 2024-01-10 @ddalle: v2.0; simplify using DataKit

GetStats(nStats=100, nMax=None, **kw)

Get mean, min, max, and stdev for all coefficients

Call:
>>> s = fm.GetStats(nStats, nMax=None, nLast=None)
Inputs:
fm: CaseFM

Instance of the force and moment class

coeff: str

Name of coefficient to process

nStats: {100} | int

Min number of iterations in window to use for statistics

dnStats: {nStats} | int

Interval size for candidate windows

nMax: (nStats} | int

Maximum number of iterations to use for statistics

nMin: {0} | int

First usable iteration number

nLast: {fm.i[-1]} | int

Last iteration to use for statistics

nStartup: {None} | int

First iteration used to calculate the full-history range

nCutoff: {None} | int

Iteration at which to approve regardless of convergence

WindowMethod: {"autocorrelation"} | "welch"

Method used to select the statistics window

Outputs:
s: dict[float]

Dictionary of mean, min, max, std, err for each

Versions:
  • 2017-09-29 @ddalle: v1.0

  • 2024-01-10 @ddalle: v1.1; DataKit updates

  • 2026-09-05 @openai: v1.2; selectable window method

GetStatsCoeff(coeff, nStats=100, nMax=None, **kw)

Get mean, min, max, and other statistics for one coefficient

Call:
>>> s = fm.GetStatsCoeff(coeff, nStats=100, nMax=None, **kw)
Inputs:
fm: CaseFM

Instance of the force and moment class

coeff: str

Name of coefficient to process

nStats: {100} | int

Min number of iterations in window to use for statistics

dnStats: {nStats} | int

Interval size for candidate windows

nMax: (nStats} | int

Maximum number of iterations to use for statistics

nMin: {0} | int

First usable iteration number

nLast: {fm.i[-1]} | int

Last iteration to use for statistics

Outputs:
s: dict[float]

Dictionary of mean, min, max, std for coeff

Versions:
  • 2017-09-29 @ddalle: v1.0

  • 2024-01-10 @ddalle: v1.1; DataKit updates

GetStatsN(nStats=100, nLast=None)

Get mean, min, max, and standard deviation for all coefficients

Call:
>>> s = fm.GetStatsN(nStats, nLast=None)
Inputs:
fm: CaseFM

Instance of the force and moment class

nStats: int

Number of iterations in window to use for statistics

nLast: int

Last iteration to use for statistics

Outputs:
s: dict[float]

Dictionary of mean, min, max, std for each coefficient

Versions:
  • 2014-12-09 @ddalle: v1.0

  • 2015-02-28 @ddalle: v1.1; was GetStats()

  • 2015-03-04 @ddalle: v1.2; add nLast

  • 2024-01-10 @ddalle: v1.3; DataKit updates

GetStatsOld(nStats=100, nMax=None, nLast=None)

Get mean, min, max, and standard deviation for all coefficients

Call:
>>> s = fm.GetStatsOld(nStats, nMax=None, nLast=None)
Inputs:
fm: CaseFM

Instance of the force and moment class

nStats: int

Minimum number of iterations in window to use for statistics

nMax: int

Maximum number of iterations to use for statistics

nLast: int

Last iteration to use for statistics

Outputs:
s: dict[float]

Dictionary of mean, min, max, std for each coefficient

Versions:
  • 2015-02-28 @ddalle: v1.0

  • 2015-03-04 @ddalle: v1.1; add nLast

  • 2024-01-10 @ddalle: v1.2; DataKit updates

PlotCoeff(c: str, n=None, **kw)

Plot a single coefficient history

Call:
>>> h = fm.PlotCoeff(c, n=1000, nAvg=100, **kw)
Inputs:
fm: CaseFM

Instance of the component force history class

c: str

Name of coefficient to plot, e.g. 'CA'

n: int

Only show the last n iterations

nAvg: int

Use the last nAvg iterations to compute an average

d: float

Delta in the coefficient to show expected range

nLast: int

Last iteration to use (defaults to last iteration available)

nFirst: int

First iteration to plot

FigureWidth: float

Figure width

FigureHeight: float

Figure height

Outputs:
h: dict

Dictionary of figure/plot handles

Versions:
  • 2014-11-12 @ddalle: v1.0

  • 2014-12-09 @ddalle: Transferred to AeroPlot

  • 2015-02-15 @ddalle: Transferred to databook.Aero

  • 2015-03-04 @ddalle: Added nStart and nLast

  • 2015-12-07 @ddalle: Moved content to base class

PlotCoeffHist(c: str, nAvg=100, nBin=20, nLast=None, **kw)

Plot a single coefficient histogram

Call:
>>> h = fm.PlotCoeffHist(comp, c, n=1000, nAvg=100, **kw)
Inputs:
fm: CaseFM

Instance of the component force history class

comp: str

Name of component to plot

c: str

Name of coefficient to plot, e.g. 'CA'

nAvg: int

Use the last nAvg iterations to compute an average

nBin: int

Number of bins to plot

nLast: int

Last iteration to use (defaults to last iteration available)

FigureWidth: float

Figure width

FigureHeight: float

Figure height

Keyword arguments:
  • See cape.cfdx.databook.CaseData.PlotValueHist()

Outputs:
h: dict

Dictionary of figure/plot handles

Versions:
  • 2015-02-15 @ddalle: v1.0

  • 2015-03-06 @ddalle: Added nLast and fixed documentation

  • 2015-03-06 @ddalle: Copied to CaseFM

ShiftMRP(Lref, x, xi=None)

Shift the moment reference point

Call:
>>> fm.ShiftMRP(Lref, x, xi=None)
Inputs:
fm: CaseFM

Instance of the force and moment class

Lref: float

Reference length

x: list[float]

Target moment reference point

xi: list[float]

Current moment reference point (default: self.MRP)

Versions:
  • 2015-03-02 @ddalle: v1.0

TransformFM(topts: dict, x: dict, i: int)

Transform a force and moment history

Available transformations and their parameters are listed below.

  • “Euler321”: “psi”, “theta”, “phi”

  • “Euler123”: “phi”, “theta”, “psi”

  • “ScaleCoeffs”: “CA”, “CY”, “CN”, “CLL”, “CLM”, “CLN”

RunMatrix variables are used to specify values to use for the transformation variables. For example,

topts = {"Type": "Euler321",
    "psi": "Psi", "theta": "Theta", "phi": "Phi"}

will cause this function to perform a reverse Euler 3-2-1 transformation using x.Psi[i], x.Theta[i], and x.Phi[i] as the angles.

Coefficient scaling can be used to fix incorrect reference areas or flip axes. The default is actually to flip CLL and CLN due to the transformation from CFD axes to standard flight dynamics axes.

tops = {"Type": "ScaleCoeffs",
    "CLL": -1.0, "CLN": -1.0}
Call:
>>> fm.TransformFM(topts, x, i)
Inputs:
fm: CaseFM

Instance of the force and moment class

topts: dict

Dictionary of options for the transformation

x: cape.runmatrix.RunMatrix

The run matrix used for this analysis

i: int

Run matrix case index

Versions:
  • 2014-12-22 @ddalle: v1.0

TrimIters()

Trim non-ascending iterations and other problems

Call:
>>> fm.TrimIters()
Versions:
  • 2017-10-02 @ddalle: v1.0

  • 2024-01-10 @ddalle: v2.0; DataKit updates

genr8_mrp_history() → Point

Get moment reference point history, w/ motion if applicable

Call:
>>> x, y, z = fm.genr8_mrp_history()
>>> p = fm.genr8_mrp_history()
Inputs:
fm: CaseFM

Force & moment iterative history

Outputs:
x: np.ndarray[float]

Iterative history of xMRP

y: np.ndarray[float]

Iterative history of xMRP

z: np.ndarray[float]

Iterative history of xMRP

p: cape.cfdx.casedata.Point

Named tuple object of p.x, p.y, p.z

Versions:
  • 2025-09-26 @ddalle: v1.0

get_ab_history() → Pair

Get angles of attack and sideslip, w/ moving-body

This transforms the initial alpha, beta from the run matrix conditions using the Euler angles from moving-body, if present.

Call:
>>> a, b = fm.get_ab_history()
Inputs:
fm: CaseFM

Force & moment iterative history

Outputs:
a: np.ndarray | float

Angle of attack (history) [deg]

b: np.ndarray | float

Sideslip angle (history) [deg]

Versions:
  • 2025-09-26 @ddalle: v1.0

get_alpha(vdef: float = 0.0) → float

Get freestream angle of atack for this case

Call:
>>> a = fm.get_alpha(vdef=1.0, units="mks")
Inputs:
fm: CaseFM

Force & moment iterative history

vdef: {0.0} | float

Default value if no fm.runner is present

Outputs:
a: float

Angle of attack [deg]

Versions:
  • 2025-09-26 @ddalle: v1.0

get_aref(vdef: float = 1.0) → float

Get reference area for this component

Call:
>>> aref = fm.get_aref(vdef=1.0)
Inputs:
fm: CaseFM

Force & moment iterative history

vdef: {1.0} | float

Default value if no fm.runner is present

Outputs:
aref: float

Reference area

Versions:
  • 2025-09-26 @ddalle: v1.0

get_beta(vdef: float = 0.0) → float

Get freestream sideslip angle for this case

Call:
>>> b = fm.get_beta(vdef=1.0, units="mks")
Inputs:
fm: CaseFM

Force & moment iterative history

vdef: {0.0} | float

Default value if no fm.runner is present

Outputs:
b: float

Angle of sideslip [deg]

Versions:
  • 2025-09-26 @ddalle: v1.0

get_bref(vdef: float = 1.0) → float

Get reference span for this component

Call:
>>> bref = fm.get_bref(vdef=1.0)
Inputs:
fm: CaseFM

Force & moment iterative history

vdef: {1.0} | float

Default value if no fm.runner is present

Outputs:
bref: float

Reference span

Versions:
  • 2025-09-26 @ddalle: v1.0

get_cdbfile() → str

Get path to iterative history cache file

Call:
>>> cdbfilename = h.get_cdbfile()
Inputs:
h: CaseData

Single-case iterative history instance

Outputs:
cdbfilename: str

Name of file (extension is .cdb)

Versions:
  • 2024-01-22 @ddalle: v1.0

get_databook_opt(opt: str, vdef=None) → Any

Get a DataBook option for the component that fm tracks

Call:
>>> v = fm.get_databook_opt(opt, vdef=None)
Inputs:
fm: CaseFM

Force & moment iterative history

opt: str

Name of option to query

vdef: {None} | object

Default value

Outputs:
v: object

Value of run matrix’s DataBook > fm.comp > opt

Versions:
  • 2025-09-25 @ddalle: v1.0

get_lref(vdef: float = 1.0) → float

Get reference length for this component

Call:
>>> lref = fm.get_lref(vdef=1.0)
Inputs:
fm: CaseFM

Force & moment iterative history

vdef: {1.0} | float

Default value if no fm.runner is present

Outputs:
lref: float

Reference length

Versions:
  • 2025-09-26 @ddalle: v1.0

get_mrp(vdef: list = [0.0, 0.0, 0.0]) → list

Get moment reference point for this component

Call:
>>> xmrp = fm.get_mrp(vdef=[0.0, 0.0, 0.0])
Inputs:
fm: CaseFM

Force & moment iterative history

vdef: {1.0} | float

Default value if no fm.runner is present

Outputs:
xmrp: [float, float, float]

Reference point

Versions:
  • 2025-09-26 @ddalle: v1.0

get_qbar(vdef: float = 1.0, units: str | None = None) → float

Get freestream dynamic pressure

Call:
>>> qref = fm.get_qbar(vdef=1.0, units="mks")
Inputs:
fm: CaseFM

Force & moment iterative history

vdef: {1.0} | float

Default value if no fm.runner is present

units: {None} | str

Units for output (default is raw run matrix value)

Outputs:
qref: float

Dynamic pressure

Versions:
  • 2025-09-26 @ddalle: v1.0

get_rotation_origin() → Point

Get rotation origin [history]

Call:
>>> x, y, z = fm.get_rotation_origin()
>>> p = fm.genr8_mrget_rotation_origin_history()
Inputs:
fm: CaseFM

Force & moment iterative history

Outputs:
x: np.ndarray | float

Coordinate of origin of rotation

y: np.ndarray | float

Coordinate of origin of rotation

z: np.ndarray | float

Coordinate of origin of rotation

p: cape.cfdx.casedata.Point

Named tuple object of p.x, p.y, p.z

Versions:
  • 2025-09-26 @ddalle: v1.0

rotate_mrp(x0: float, y0: float, z0: float) → Point

Get moment reference point history, w/ motion if applicable

Call:
>>> x, y, z = fm.rotate_mrp(x0, y0, z0)
>>> p = fm.rotate_mrp(x0, y0, z0)
Inputs:
fm: CaseFM

Force & moment iterative history

x0: np.ndarray | float

Coordinate of rotation cnter

y0: np.ndarray | float

Coordinate of rotation cnter

z0: np.ndarray | float

Coordinate of rotation cnter

Outputs:
x: np.ndarray[float]

Iterative history of xMRP

y: np.ndarray[float]

Iterative history of xMRP

z: np.ndarray[float]

Iterative history of xMRP

p: cape.cfdx.casedata.Point

Named tuple object of p.x, p.y, p.z

Versions:
  • 2025-09-26 @ddalle: v1.0

rotate_point_history(x: float | ndarray, y: float | ndarray, z: float | ndarray, x0: float | ndarray, y0: float | ndarray, z0: float | ndarray) → Point

Rotate a point history using phi, theta, psi

No rotations will be performed if Euler angle columns are not present in fm.

Call:
>>> p = fm.rotate_point_history(x, y, z, x0, y0, z0)
Inputs:
fm: CaseFM

Force & moment iterative history

x: np.ndarray | float

Pre-rotation point

y: np.ndarray | float

Pre-rotation point

z: np.ndarray | float

Pre-rotation point coord

x0: np.ndarray | float

Coordinate of rotation cnter

y0: np.ndarray | float

Coordinate of rotation cnter

z0: np.ndarray | float

Coordinate of rotation cnter

Outputs:
p: cape.cfdx.casedata.Point

Named tuple object of p.x, p.y, p.z after rotation

Versions:
  • 2025-09-26 @ddalle: v1.0

shift_mrp_body()

Shift moment [coefficient] for moving-body MRP movements

Call:
>>> fm.shift_mrp_body()
Inputs:
fm: CaseFM

Instance of the force and moment class

Versions:
  • 2025-09-26 @ddalle: v1.0

transform_fm321_body()

Shift moment [coefficient] for moving-body MRP movements

Call:
>>> fm.shift_mrtransform_fm321_body()
Inputs:
fm: CaseFM

Instance of the force and moment class

Versions:
  • 2025-09-26 @ddalle: v1.0

trim_iters()

Trim any repeated iterations from history

Call:
>>> db.trim_iters()
Inputs:
db; cape.cfdx.casedata.CaseData

Single-case iterative history

Versions:
  • 2025-07-31 @ddalle: v1.0

class cape.cfdx.casedata.CasePointProbe(pt: str, runner=None, **kw)
class cape.cfdx.casedata.CaseProp(comp: str, **kw)
class cape.cfdx.casedata.CaseResid(meta: bool = False, runner=None, **kw)

Iterative residual history class

This class provides an interface to residuals, CPU time, and similar data for a given run directory

Call:
>>> hist = cape.cfdx.databook.CaseResid()
Outputs:
hist: cape.cfdx.databook.CaseResid

Instance of the run history class

GetIterationIndex(i)

Return index of a particular iteration in hist.i

If the iteration i is not present in the history, the index of the last available iteration less than or equal to i is returned.

Call:
>>> j = hist.GetIterationIndex(i)
Inputs:
hist: cape.cfdx.databook.CaseResid

Instance of the residual history class

i: int

Iteration number

Outputs:
j: int

Index of last iteration in fm.i less than or equal to i

Versions:
  • 2015-03-06 @ddalle: v1.0

  • 2024-01-10 @ddalle: v1.1; DataKit updates

GetNOrders(nStats: int = 1, col: str | None = None, nLast: int | None = None) → float

Get the number of orders of magnitude of residual drop

Call:
>>> nOrders = hist.GetNOrders(nStats=None, col=None)
Inputs:
hist: CaseResid

Single-case residual history instance

nStats: {1} | int

Number of iters to use for averaging the final residual

col: {None} | str

Name of residual to analyze; default from hist._default_resid

nLast: {None} | int

Last iteration to include in window (default -1)

Outputs:
nOrders: {1} | float

Number of orders of magnitude of residual drop

Versions:
  • 2015-01-01 @ddalle: v1.0

  • 2024-01-24 @ddalle: v2.0; generalize w/ DataKit apprch

  • 2025-08-05 @ddalle: v2.1; add nLast

GetNOrdersUnsteady(n=1)

Get residual drop magnitude

Call:
>>> nOrders = hist.GetNOrders(n=1)
Inputs:
hist: cape.cfdx.databook.CaseResid

Instance of the DataBook residual history

n: int

Number of iterations to analyze

Outputs:
nOrders: numpy.ndarray[float]

Number of orders of magnitude of unsteady residual drop

Versions:
  • 2015-01-01 @ddalle: First version

PlotL1(n=None, nFirst=None, nLast=None, **kw)

Plot the L1 residual

Call:
>>> h = hist.PlotL1(n=None, nFirst=None, nLast=None, **kw)
Inputs:
hist: cape.cfdx.databook.CaseResid

Instance of the DataBook residual history

n: int

Only show the last n iterations

nFirst: int

Plot starting at iteration nStart

nLast: int

Plot up to iteration nLast

FigureWidth: float

Figure width

FigureHeight: float

Figure height

Outputs:
h: dict

Dictionary of figure/plot handles

Versions:
  • 2014-11-12 @ddalle: v1.0

  • 2014-12-09 @ddalle: v1.1; move to AeroPlot

  • 2015-02-15 @ddalle: v1.2; move to databook.Aero

  • 2015-03-04 @ddalle: v1.3; add nStart and nLast

  • 2015-10-21 @ddalle: v1.4; refer to PlotResid()

PlotL2(n=None, nFirst=None, nLast=None, **kw)

Plot the L2 residual

Call:
>>> h = hist.PlotL2(n=None, nFirst=None, nLast=None, **kw)
Inputs:
hist: cape.cfdx.databook.CaseResid

Instance of the DataBook residual history

n: int

Only show the last n iterations

nFirst: int

Plot starting at iteration nStart

nLast: int

Plot up to iteration nLast

FigureWidth: float

Figure width

FigureHeight: float

Figure height

Outputs:
h: dict

Dictionary of figure/plot handles

Versions:
  • 2014-11-12 @ddalle: v1.0

  • 2014-12-09 @ddalle: v1.1; move to AeroPlot

  • 2015-02-15 @ddalle: v1.2; move to databook.Aero

  • 2015-03-04 @ddalle: v1.3; add nStart and nLast

  • 2015-10-21 @ddalle: v1.4; refer to PlotResid()

PlotLInf(n=None, nFirst=None, nLast=None, **kw)

Plot the L-infinity residual

Call:
>>> h = hist.PlotLInf(n=None, nFirst=None, nLast=None, **kw)
Inputs:
hist: cape.cfdx.databook.CaseResid

Instance of the DataBook residual history

n: int

Only show the last n iterations

nFirst: int

Plot starting at iteration nStart

nLast: int

Plot up to iteration nLast

FigureWidth: float

Figure width

FigureHeight: float

Figure height

Outputs:
h: dict

Dictionary of figure/plot handles

Versions:
  • 2016-02-04 @ddalle: v1.0

PlotResid(c='L1Resid', n=None, nFirst=None, nLast=None, **kw)

Plot a residual by name

Call:
>>> h = hist.PlotResid(c='L1Resid', n=None, **kw)
Inputs:
hist: cape.cfdx.databook.CaseResid

Instance of the DataBook residual history

c: str

Name of coefficient to plot

n: int

Only show the last n iterations

PlotOptions: dict

Plot options for the primary line(s)

nFirst: int

Plot starting at iteration nStart

nLast: int

Plot up to iteration nLast

FigureWidth: float

Figure width

FigureHeight: float

Figure height

YLabel: str

Label for y-axis

Outputs:
h: dict

Dictionary of figure/plot handles

Versions:
  • 2014-11-12 @ddalle: v1.0

  • 2014-12-09 @ddalle: v1.1; move to AeroPlot

  • 2015-02-15 @ddalle: v1.2; move to databook.Aero

  • 2015-03-04 @ddalle: v1.3; add nStart and nLast

  • 2015-10-21 @ddalle: v1.4; from PlotL1()

  • 2022-01-28 @ddalle: v1.5; add xcol

find_subiters(col: str = 'i_sub')

Find indices of first and last subiter for each whole iter

Call:
>>> maska, maskb = hist.find_subiters(col=None)
Inputs:
hist: CaseResid

Iterative residual history instance

col: {"i_sub"} | str

Name of subiteration col

Outputs:
maska: np.ndarray[int]

Index of first subiter for each whole iter

maskb: np.ndarray[int]

Index of last subiter for each whole iter

Versions:
  • 2024-07-18 @ddalle: v1.0

get_cdbfile() → str

Get path to iterative history cache file

Call:
>>> cdbfilename = h.get_cdbfile()
Inputs:
h: CaseData

Single-case iterative history instance

Outputs:
cdbfilename: str

Name of file (extension is .cdb)

Versions:
  • 2024-01-22 @ddalle: v1.0

class cape.cfdx.casedata.CaseSurfCp(comp: str, compids: List[str | int], ftriq: str, cntl: CntlBase, i: int)

Surface pressure coefficient

This class contains methods for reading data about an the histroy of an individual component for a single case.

Call:
>>> fm = cape.cfdx.databook.CaseSurfCp()
Outputs:
cp: cape.aero.CaseSurfCp

Instance of the surface pressure class

cp[“casenames”]: list

List of casenames of saved case data

cp[“x”]: np.ndarray

X-coord of surface pressure points (global)

cp[“casename.x”]: np.ndarray

X-coord of surface pressure points (case specific)

cp[“casename.cp”]: np.ndarray

Surface pressure points (case specific)

Versions:
  • 2025-09-26 @aburkhea: Started

delete_datafile(fname, casename)

Delete surfcp data capefile

Call:
>>> runner.write_datafile(casename)
Inputs:
runner: CaseRunner

Controller to run one case of solver

fname: str

Name of data file to write

casename: str

Name of case

Versions:
  • 2026-01-05 @aburkhea: v1.0

get_conditions() → dict

Get the freestream conditions needed for forces

Call:
>>> xi = db.get_conditions()
Inputs:
db: CaseTriqFM

Interface to TriqFM data for one component of one case

Outputs:
xi: dict

Conditions, incl. Mach (mach), Reynolds number (Re)

Versions:
  • 2017-03-28 @ddalle: v1.0

  • 2025-08-13 @ddalle: v1.1 (dex)

get_configfile() → str

Find configuration file for .triq file

Call:
>>> fcfg = db.get_configfile()
Inputs:
db: CaseTriqFM

Interface to TriqFM data for one component of one case

Outputs:
fcfg: str

Name of XML/JSON/MIXSUR config file

Versions:
  • 2025-08-13 @ddalle: v1.0

get_triq_surfcp() → dict

Get the surfcp on one comp

Call:
>>> fm = db.get_triq_surfcp(**kw)
Inputs:
db: CaseTriqFM

Interface to TriqFM data for one component of one case

comp: str

Name of comp

Outputs:
fm: dict[float]

Dictionary of force & moment coefficients

Versions:
  • 2017-03-28 @ddalle: v1.0

  • 2025-08-13 @ddalle: v2.0 (dex)

map_tri_compid()

Perform any component ID mapping if necessary

Call:
>>> triq = db.map_tri_compid()
Inputs:
db: CaseTriqFM

Interface to TriqFM data for one component of one case

Attributes:
DBF.compmap: dict

Map of component numbers altered during the mapping

Versions:
  • 2017-03-28 @ddalle: v1.0

read_tri_map() → Tri

Read the surface triangulation mapping file

This file defines the patches for the TriqFM output.

Call:
>>> triq = db.read_triq()
Inputs:
db: CaseTriqFM

Interface to TriqFM data for one component of one case

Outputs:
triq: cape.trifile.Triq

Triangulated surface data (also stored in db.triq)

Versions:
  • 2025-08-13 @ddalle: v1.0

read_triq() → Triq

Read the surface solution data from a .triq file

Call:
>>> triq = db.read_triq()
Inputs:
db: CaseTriqFM

Interface to TriqFM data for one component of one case

Outputs:
triq: cape.trifile.Triq

Triangulated surface data (also stored in db.triq)

Versions:
  • 2025-08-13 @ddalle: v1.0

write_datafile(fname, casename)

Write surfcp data capefile

Defaults to global x,y,z and case specific cp. When writing new case checks if global x,y,z exists then compares it to case x,y,z. Will switch to case x,y,z if they are different. Once case specific x,y,z started, will then always write case specific x,y,z.

Call:
>>> runner.write_datafile(casename)
Inputs:
runner: CaseRunner

Controller to run one case of solver

fname: str

Name of data file to write

casename: str

Name of case

Versions:
  • 2025-09-26 @aburkhea: v1.0

write_dbook_cdb(fname)

Write contents of history to .cdb file

Call:
>>> fm.write_dbook_cdb(fname)
Inputs:
fm: CaseData

Iterative history instance

Versions:
  • 2024-10-09 @aburkhea: v1.0

write_surf(**kw)

Write mapped solution as TRIQ or Tecplot file with zones

Call:
>>> db.write_triq(**kw)
Inputs:
db: CaseTriqFM

Interface to TriqFM data for one component of one case

Versions:
  • 2017-03-30 @ddalle: v1.0 (TriqFMDataBook)

  • 2025-08-13 @ddalle: v2.0 (dex)

class cape.cfdx.casedata.CaseTS(comp: str, **kw)

Force and moment time series iterative histories

This class contains methods for reading data about an the histroy of an individual component for a single case.

Call:
>>> fm = cape.cfdx.databook.CaseFM(C, MRP=None, A=None)
Inputs:
C: list (str)

List of coefficients to initialize

MRP: numpy.ndarray[float] shape=(3,)

Moment reference point

A: numpy.ndarray shape=(N,4) or shape=(N,7)

Matrix of forces and/or moments at N iterations

Outputs:
fm: cape.aero.FM

Instance of the force and moment class

fm.coeffs: list (str)

List of coefficients

fm.MRP: numpy.ndarray[float] shape=(3,)

Moment reference point

Versions:
  • 2024-10-09 @aburkhea: Started

get_tend(tcol)

Get end time in time series case data

Call:
>>> fm.get_tend
Inputs:
fm: CaseData

Iterative history instance

Versions:
  • 2024-10-10 @aburkhea: v1.0

write_dbook_cdb(fname)

Write contents of history to .cdb file

Call:
>>> fm.write_dbook_cdb(fname)
Inputs:
fm: CaseData

Iterative history instance

Versions:
  • 2024-10-09 @aburkhea: v1.0

class cape.cfdx.casedata.DBPlotOpts(*args, **kw)
class cape.cfdx.casedata.FMPair(F, M)

Pair for force and moment vector [histories], F, M

F

Alias for field number 0

M

Alias for field number 1

cape.cfdx.casedata.ImportPyPlot()

Import matplotlib.pyplot if not already loaded

Call:
>>> ImportPyPlot()
Versions:
  • 2014-12-27 @ddalle: v1.0

class cape.cfdx.casedata.Pair(a, b)

Tuple of two components, e.g. AoA and AoS, a, b

a

Alias for field number 0

b

Alias for field number 1

class cape.cfdx.casedata.Point(x, y, z)

Tuple of coordinates, x, y, z

x

Alias for field number 0

y

Alias for field number 1

z

Alias for field number 2

class cape.cfdx.casedata.WindowRank(linear_fit_a1, trend_fit_a1, autocorrelation, sinusoid_amplitude)

Metrics used to rank candidate statistics windows

autocorrelation

Alias for field number 2

linear_fit_a1

Alias for field number 0

sinusoid_amplitude

Alias for field number 3

trend_fit_a1

Alias for field number 1

cape.cfdx.casedata.autocorr(v: ndarray, t: ndarray | None = None, n: int = 100) → Tuple[float, float]

Calculate autocorrelation of iterative history with offsets

Call:
>>> dt, r = autocorr(v, t=None, n=100)
Inputs:
v: np.ndarray[float]

Iterative history

t: {None} | np.ndarray

Optional time history (or just use iteration number)

n: {100} | int

Number of offsets to analyze

Outputs:
dt: np.ndarray[float]

Time/iteration shifts

r: np.ndarray[float]

Autocorrelation at each shift

Versions:
  • 2026-06-14 @ddalle: v1.0

cape.cfdx.casedata.find_autocorr_peaks(v: ndarray, polyorder: int = 3, window_length: int = 10) → tuple

Find autocorrelation peaks; ensure alternating anticorr/corr

Call:
>>> jlo, vlo, jhi, vhi = find_autocorr_peaks(v, **kw)
Inputs:
v: :np.ndarray`[float]

Iterative history

polyorder: {3} | int

Polynomial order for filtering

window_length: {10} | int

Filter window width

Outputs:
jlo: np.ndarray[int]

Indices of local minima

vlo: np.ndarray[float]

Lightly filetered values of v at local minima

jhi: np.ndarray[int]

Indices of local maxima

vhi: np.ndarray[float]

Lightly filtered values of v at local maxima

Versions:
  • 2026-06-17 @ddalle: v1.0

cape.cfdx.casedata.find_max_autocorr(v: ndarray, polyorder: int = 3, window_length: int = 10) → tuple

Find the maximum shifted autocorrelation peak

Call:
>>> j, vmax = find_max_autocorr(v, **kw)
Inputs:
v: :np.ndarray`[float]

Autocorrelation signal

polyorder: {3} | int

Polynomial order for filtering

window_length: {10} | int

Filter window width

Outputs:
j: int | None

Index of maximum shifted autocorrelation peak

vmax: float | None

Lightly filtered value of v at j

Versions:
  • 2026-09-03 @openai: v1.0

cape.cfdx.casedata.find_peaks_filtered(v: ndarray, polyorder: int = 3, window_length: int = 10)

Find peaks of smoothed iterative history

Call:
>>> jlo, vlo, jhi, vhi = find_pkeaks_filtered(v, **kw)
Inputs:
v: :np.ndarray`[float]

Iterative history

polyorder: {3} | int

Polynomial order for filtering

window_length: {10} | int

Filter window width

Outputs:
jlo: np.ndarray[int]

Indices of local minima

vlo: np.ndarray[float]

Lightly filetered values of v at local minima

jhi: np.ndarray[int]

Indices of local maxima

vhi: np.ndarray[float]

Lightly filtered values of v at local maxima

Versions:
  • 2026-06-15 @ddalle: v1.0

  • 2026-09-06 @ddalle: v1.1; default for short histories