cape.cfdx.report
: Automated CFD report interface¶
The Cape module for generating automated results reports using PDFLaTeX
provides a single class cape.cfdx.report.Report
, which creates
a handle for the tex
file and creates folders containing individual
figures for each case. The cape.cfdx.report.Report
class is
a sort of dual-purpose object that contains a file interface using
cape.filecntl.texfile.Tex
combined with a capability to create
figures for each case or sweep of cases mostly based on
cape.cfdx.dataBook
.
An automated report is a multi-page PDF generated using PDFLaTeX. Usually, each CFD case has one or more pages dedicated to results for that case. The user defines a list of figures, each with its own list of subfigures, and these are generated for each case in the run matrix (subject to any command-line constraints the user may specify). Types of subfigures include
Table of the values of the input variables for this case
Table of force and moment values and statistics
Iterative histories of forces or moments (one or more coeffs)
Iterative histories of residuals
Images using a Tecplot layout
Many more
In addition, the user may also define “sweeps,” which analyze groups of cases defined by user-specified constraints. For example, a sweep may be used to plot results as a function of Mach number for sets of cases having matching angle of attack and sideslip angle. When using a sweep, the report contains one or more pages for each sweep (rather than one or more pages for each case).
Reports are usually created using system commands of the following format.
The basis report class contains almost all of the capabilities needed
for generating the reports, and so the derivative classes such as
cape.pycart.report.Report
, caep.pyfun.report.Report
,
and cape.pyover.report.Report
contain very little additional
content.
The class has an immense number of methods, which can be somewhat
grouped into bookkeeping methods and plotting methods. The main
user-facing methods are cape.cfdx.report.Report.UpdateCases()
and
cape.cfdx.report.Report.UpdateSweep()
. Each
type of subfigure has its own method,
for example cape.cfdx.report.Report.SubfigPlotCoeff()
for
"PlotCoeff"
or cape.cfdx.report.Report.SubfigPlotL2()
for
"PlotL2"
.
- See also:
cape.cfdx.databook.CaseFM
- class cape.cfdx.report.Report(cntl: CntlBase, rep: str)¶
Interface for automated report generation
- Call:
>>> R = Report(cntl, rep)
- Inputs:
- cntl:
cape.cfdx.cntl.Cntl
CAPE run matrix control instance
- rep:
str
Name of report to update
- cntl:
- Outputs:
- R:
cape.cfdx.report.Report
Automated report interface
- R:
- Attributes:
- CheckSweepSubfigStatus(sfig, rc, fruns, nIter)¶
Check whether or not to update a subfigure and print status
- Call:
>>> q = R.CheckSweepSubfigStatus(sfig, I, rc, fruns, nIter)
- Inputs:
- Outputs:
- q:
True
|False
Whether or not to update the subfigure
- q:
- Versions:
2016-10-25
@ddalle
: v1.0
- CleanUpCases(I=None, cons=[])¶
Clean up case folders
- Call:
>>> R.CleanUpCases(I=None, cons=[])
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- I:
list
[int
] List of case indices
- cons:
list
[str
] List of constraints to define what cases to update
- R:
- Versions:
2015-05-29
@ddalle
: v1.0
- CleanUpSweeps(I=None, cons=[])¶
Clean up the folders for all sweeps
- Call:
>>> R.CleanUpSweeps(I=None, cons=[])
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- I:
list
[int
] List of case indices
- cons:
list
[str
] List of constraints to define what cases to update
- R:
- Versions:
2015-05-29
@ddalle
: v1.0
- EvalVar(v, i: int) str ¶
Eval expression,
$mach
tox.mach[i]
, etc.- Call:
>>> txt = R.EvalVar(raw, i) >>> txt = R.EvalVar(v, i)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- raw:
str
String, with
$
as sigil for variables to expand- v:
object
Any other format returned as
str(v)
- i:
int
Case index
- R:
- Outputs:
- txt:
str
Input string with sigils expanded and evaluated
- txt:
- Versions:
2016-10-31
@ddalle
: v1.0
- GetCoSweepIndices(fswp, i0, comp, cons=[], targ=None)¶
Get indices of a target matching local sweep constraints
- Call:
>>> I = R.GetTargetSweepIndices(fswp, i0, comp, cons, targ)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- fswp:
str
Name of sweep to update
- i0:
int
Index of ref point in R.cntl.DataBook.x
- targ: {
None
} |str
Name of the target in data book to use (if any)
- R:
- Outputs:
- I:
numpy.ndarray
[int
] List of target data indices
- I:
- Versions:
2015-06-03
@ddalle
: v1.0
- GetFigureList(i, fswp=None)¶
Get list of figures for a report or sweep page
- GetSubfigRefComponent(sfig)¶
Get handle for data book component for a sweep subfigure
- Call:
>>> DBc = R.GetSubfigRefComponent(sfig)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of subfigure
- R:
- Outputs:
- DBc:
cape.cfdx.databook.DataBookComp
Component data book
- DBc:
- Versions:
2017-04-23
@ddalle
: v1.0
- GetSweepIndices(fswp, I=None, cons=[], comp=None)¶
Divide cases into individual sweeps
- Call:
>>> J = R.GetSweepIndices(fswp, I=None, cons=[], comp=None)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- fswp:
str
Name of sweep to update
- I:
list
[int
] List of case indices
- cons:
list
[str
] List of constraints to define what cases to update
- comp: {
None
} |str
Optional name of DataBook component (useful for TriqFM components, which may have a different trajectory)
- R:
- Outputs:
- Versions:
2015-05-29
@ddalle
: v1.0
- GetTargetSweepIndices(fswp, i0, targ, cons=[])¶
Get indices of target matching a local sweep’s constraint
- Call:
>>> I = R.GetTargetSweepIndices(fswp, i0, targ)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- fswp:
str
Name of sweep to update
- i0:
int
Index of point in R.cntl.DataBook.x to use as reference
- targ:
int
Name of the target in data book to use
- R:
- Outputs:
- I:
numpy.ndarray
[int
] List of target data indices
- I:
- Versions:
2015-06-03
@ddalle
: v1.0
- LinkVizFiles(sfig=None, i=None)¶
Create links to appropriate visualization files
- Call:
>>> R.LinkVizFiles(sfig, i)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of subfigure
- i:
int
Case index
- R:
- Versions:
2016-02-06
@ddalle
: v1.02017-01-07
@ddalle
: v1.1; add sfig and i inputs
- PrepTecplotColorMaps(tec, sfig, i)¶
Customize color maps for a Tecplot layout
- Call:
>>> R.PrepTecplotColorMaps(tec, sfig, i)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- tec:
cape.filecntl.tecfile.Tecscript
Tecplot layout interface (modified in place)
- sfig:
str
Name of subfigure for accessing options
- i:
int
Case index
- R:
- Versions:
2017-01-05
@ddalle
: v1.0
- PrepTecplotContourLevels(tec, sfig, i)¶
Customize contour levels for a Tecplot layout
- Call:
>>> R.PrepTecplotContourLevels(tec, sfig, i)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- tec:
cape.filecntl.tecfile.Tecscript
Tecplot layout interface (modified in place)
- sfig:
str
Name of subfigure for accessing options
- i:
int
Case index
- R:
- Versions:
2017-01-05
@ddalle
: v1.0
- PrepTecplotLayoutKeys(tec: Tecscript, sfig: str, i: int)¶
Set any parameters for Tecplot layout
- Call:
>>> R.PrepTecplotLayoutKeys(tec, sfig, i)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- tec:
cape.filecntl.tecfile.Tecscript
Tecplot layout interface (modified in place)
- sfig:
str
Name of subfigure for accessing options
- i:
int
Case index
- R:
- Versions:
2017-03-23
@ddalle
: v1.0
- PrepTecplotLayoutVars(tec: Tecscript, sfig: str, i: int)¶
Set any variables for Tecplot layout
- Call:
>>> R.PrepTecplotLayoutVars(tec, sfig, i)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- tec:
cape.filecntl.tecfile.Tecscript
Tecplot layout interface (modified in place)
- sfig:
str
Name of subfigure for accessing options
- i:
int
Case index
- R:
- Versions:
2016-10-31
@ddalle
: v1.0
- PrepTecplotSlicePosition(tec, sfig, i)¶
Set slice position for Tecplot layout
- Call:
>>> R.PrepTecplotSlicePosition(tec, sfig, i)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- tec:
cape.filecntl.tecfile.Tecscript
Tecplot layout interface (modified in place)
- sfig:
str
Name of subfigure for accessing options
- i:
int
Case index
- R:
- Versions:
2016-10-31
@ddalle
: v1.0
- ReadCaseFM(i: int, comp: str) CaseFM ¶
Read iterative history for a component
This function needs to be customized for each solver
- Call:
>>> fm = r.ReadCaseFM(i, comp)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- i:
int
Case index
- comp:
str
Name of component to read
- r:
- Outputs:
- fm:
None
|cape.cfdx.casedata.CaseFM
Case iterative force & moment history for one component
- fm:
- Versions:
2015-10-16
@ddalle
: v1.02025-08-26
@ddalle
: v2.0; generalized w/ CaseRunner
- ReadCaseResid(i: int) CaseResid ¶
Read iterative residual history for a component
This function needs to be customized for each solver
- Call:
>>> hist = r.ReadCaseResid(i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- i:
int
Case index
- r:
- Outputs:
- hist:
None
|cape.cfdx.databook.CaseResid
Case iterative residual history for one case
- hist:
- Versions:
2015-10-16
@ddalle
: v1.02025-08-26
@ddalle
: v2.0; generalized w/ CaseRunner
- ReadDataBook(fsrc='data')¶
Read the data book if necessary for a specific sweep
- Call:
>>> R.ReadDataBook(fsrc="data")
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- fsrc: {
"data"
} |"trajectory"
|str
Data book trajectory source
- R:
- Versions:
2015-05-29
@ddalle
: v1.0
- ReadFM(comp, targ=None)¶
Read a data book component and return it
- Call:
>>> DBc = R.ReadFM(comp, targ=None)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- comp:
str
Name of data book component
- targ: {
None
} |str
Name of target, if any
- R:
- Outputs:
- DBc:
None
|cape.cfdx.databook.DataBookComp
Individual component data book or
None
if not found
- DBc:
- Versions:
2017-04-20
@ddalle
: v1.0
- ReadLineLoad(comp, i, targ=None, update=False)¶
Read line load for a case
- Call:
>>> LL = R.ReadLineLoad(comp, i, targ=None, update=False)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- comp:
str
Name of line load component
- i:
int
Case number
- targ: {
None
} |str
Name of target data book to read, if not
None
- update:
True
| {False
} Whether to attempt an update if case not in data book
- R:
- Outputs:
- LL:
cape.cfdx.lineload.CaseLL
Individual case line load interface
- LL:
- Versions:
2016-06-10
@ddalle
: v1.02017-04-05
@ddalle
: v1.1;cfdx
version
- ReadTecscript(fsrc) Tecscript ¶
Read a Tecplot script interface
- Call:
>>> tec = r.ReadTecscript(fsrc)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- fscr:
str
Name of file to read
- r:
- Outputs:
- tec:
cape.filecntl.tecfile.Tecscript
Interface to Tecplot layout/macro file
- tec:
- Versions:
2016-10-25
@ddalle
: v1.0
- ReadTriqFM(comp, fsrc='data', targ=None)¶
Read a TriqFM data book if necessary for a specific sweep
- Call:
>>> DBF = R.ReadTriqFM(comp, fsrc="data", targ=None)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- comp:
str
Name of TriqFM component
- fsrc: {
"data"
} |"trajectory"
|str
Data book trajectory source
- targ: {
None
} |str
Name of target data book, if any
- R:
- Outputs:
- DBF:
cape.cfdx.pointsensor.TriqFMDataBook
Patch loads data book
- DBF:
- Versions:
2017-04-05
@ddalle
: v1.0
- ReadTriqPoint(grp, pt, targ=None)¶
Read a point sensor
- Call:
>>> DBP = R.ReadTriqPoint(grp, pt, targ=None)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- grp:
str
Name of TriqPoint group
- pt:
str
Name of the TriqPoint sensor
- targ: {
None
} |str
Name of target data book, if any
- R:
- Outputs:
- DBF:
cape.cfdx.pointsensor.TriqFMDataBook
Point sensor group data book
- DBF:
- Versions:
2018-02-09
@ddalle
: v1.0
- RemoveCase(i)¶
Remove case folder or tar
- Call:
>>> R.RemoveCase(i)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- i:
int
Case index
- R:
- Versions:
2023-06-06
@aburkhea
: v1.0
- RemoveCases(I=None, cons=[], **kw)¶
Remove case folders or tars
- Call:
>>> R.RemoveCases(I=None, cons=[])
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- I:
list
[int
] List of case indices
- cons:
list
(str
) List of constraints to define what cases to remove
- R:
- Versions:
2023-06-06
@aburkhea
: v1.0
- SubfigCaption(sfig, cdef=None)¶
Get a caption for a subfigure
This relies on the options Caption and CaptionComponent. A Caption specification creates a full caption, while the CaptionComponent creates a prefix. The default caption has the format Component/Coefficient if applicable, and otherwise uses sfig.
- Call:
>>> fcpt = R.SubfigCaption(sfig, cdef=None)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- cdef: {
None
} |str
Default caption
- R:
- Outputs:
- fcpt:
str
Caption
- fcpt:
- Versions:
2017-03-31
@ddalle
: v1.0
- SubfigConditions(sfig, I, q=True)¶
Create lines for a “Conditions” subfigure
- Call:
>>> lines = R.SubfigConditions(sfig, i, q=True) >>> lines = R.SubfigConditions(sfig, I, q=True)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- i:
int
Case index
- I:
numpy.ndarray
[int
] List of case indices
- q:
True
|False
Whether or not to update images
- R:
- Versions:
2014-03-08
@ddalle
: v1.02014-06-02
@ddalle
: Added range capability
- SubfigContourCoeff(sfig, fswp, I, q)¶
Create a contour plot of results from several cases
- Call:
>>> R.SubfigSweepCoeff(sfig, fswp, I, q)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- fswp:
str
Name of sweep
- I:
numpy.ndarray
[int
] List of indices in the sweep
- q:
True
|False
Whether or not to update images
- R:
- Versions:
2017-04-17
@ddalle
: v1.0
- SubfigFormatAxes(sfig, ax)¶
Apply formatting options to an
AxesSubplot
instance- Call:
>>> R.SubfigFormatAxes(sfig, ax)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of subfigure to update
- ax:
matplotlib.axes._subplots.AxesSubplot
Axis handle
- R:
- Versions:
2017-10-12
@ddalle
: v1.0
- SubfigFunction(sfig, I)¶
Apply a generic Python function to a subfigure definition
- Call:
>>> R.SubfigFunction(sfig, i) >>> R.SubfigFunction(sfig, I)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of subfigure to initialize
- i:
int
Case index
- I:
np.ndarray
[int
] Case index
- R:
- Versions:
2017-06-22
@ddalle
: v1.0
- SubfigImage(sfig, i, q)¶
Create image based on a file present in the case folder
- SubfigInit(sfig)¶
Create the initial lines of a subfigure
- Call:
>>> lines = R.SubfigInit(sfig)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of subfigure to initialize
- R:
- Outputs:
- Versions:
2016-01-16
@ddalle
: v1.0
- SubfigParaviewLayout(sfig, i, q)¶
Create image based on a Paraview Python script
- SubfigPlotCoeff(sfig, i, q)¶
Create plot for a coefficient and input lines to LaTeX file
- Call:
>>> lines = R.SubfigPlotCoeff(sfig, i, q)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of subfigure to update
- i:
int
Case index
- q:
True
|False
Whether or not to update images
- R:
- Versions:
2015-03-09
@ddalle
: v1.0
- SubfigPlotL1(sfig, i, q)¶
Create plot for L1 residual
- Call:
>>> lines = R.SubfigPlotL1(sfig, i, q)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- i:
int
Case index
- q:
True
|False
Whether or not to update images
- R:
- Versions:
2014-03-09
@ddalle
: v1.02015-11-25
@ddalle
: Moved contents toSubfigPlotResid()
- SubfigPlotL2(sfig, i, q)¶
Create plot for L2 residual
- Call:
>>> lines = R.SubfigPlotL2(sfig, i, q)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- i:
int
Case index
- q:
True
|False
Whether or not to update images
- R:
- Versions:
2015-11-25
@ddalle
: v1.0
- SubfigPlotLInf(sfig, i, q)¶
Create plot for L2 residual
- Call:
>>> lines = R.SubfigPlotL2(sfig, i, q)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- i:
int
Case index
- q:
True
|False
Whether or not to update images
- R:
- Versions:
2015-11-25
@ddalle
: v1.0
- SubfigPlotLabel(sfig, k)¶
Get line label for subfigure plot
- Call:
>>> lbl = R.SubfigPlotLabel(sfig, k)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- k:
int
Plot index
- q:
True
|False
Whether or not to update images
- R:
- Outputs:
- lbl:
str
Plot label
- lbl:
- Versions:
2015-06-04
@ddalle
: v1.0
- SubfigPlotLineLoad(sfig, i, q)¶
Create plot for a sectional loads profile
- Call:
>>> lines = R.SubfigPlotLineLoad(sfig, i, q)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of subfigure to update
- i:
int
Case index
- q:
True
|False
Whether or not to update images
- R:
- Versions:
2016-06-10
@ddalle
: v1.0
- SubfigPlotLineLoadGroup(sfig, fswp, I, q)¶
Plot a line load for a group of cases
- Call:
>>> R.SubfigPlotLineLoadGroup(sfig, fswp, I, q)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- fswp:
str
Name of sweep
- I:
numpy.ndarray
[int
] List of indices in the sweep
- q:
True
|False
Whether or not to update images
- R:
- Versions:
2017-04-23
@ddalle
: v1.0
- SubfigPlotResid(sfig, i, q, c=None)¶
Create plot for named residual
- Call:
>>> lines = R.SubfigPlotResid(sfig, i, c=None)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- i:
int
Case index
- q:
True
|False
Whether or not to update images
- c:
str
Name of residual to plot (defaults to option from JSON)
- R:
- Versions:
2014-03-09
@ddalle
: v1.02015-11-25
@ddalle
: Forked fromSubfigPlotL1()
- SubfigPlotTurbResid(sfig, i, q)¶
Create plot for turbulence residual
- Call:
>>> lines = R.SubfigPlotTurbResid(sfig, i, q)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- i:
int
Case index
- q:
True
|False
Whether or not to update images
- R:
- Versions:
2015-11-25
@ddalle
: v1.0
- SubfigSummary(sfig, i, q=True)¶
Create lines for a “Summary” subfigure
- Call:
>>> lines = R.SubfigSummary(sfig, i, q=True)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- i:
int
Case index
- q:
True
|False
Whether or not to update images
- R:
- Versions:
2014-03-09
@ddalle
: v1.0
- SubfigSweepCases(sfig, fswp, I, q=True)¶
Create lines for a “SweepConditions” subfigure
- Call:
>>> lines = R.SubfigSweepCases(sfig, fswp, I)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- fswp:
str
Name of sweep
- I:
numpy.ndarray
[int
] Case indices
- q:
True
|False
Whether or not to update images
- R:
- Outputs:
- lines:
str
List of lines in the subfigure
- lines:
- Versions:
2015-06-02
@ddalle
: v1.0
- SubfigSweepCoeff(sfig, fswp, I, q)¶
Plot a sweep of a coefficient over several cases
- Call:
>>> R.SubfigSweepCoeff(sfig, fswp, I, q)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- fswp:
str
Name of sweep
- I:
numpy.ndarray
[int
] List of indices in the sweep
- q:
True
|False
Whether or not to update images
- R:
- Versions:
2015-05-28
@ddalle
: v1.0
- SubfigSweepCoeffHist(sfig, fswp, I, q)¶
Plot a histogram of a coefficient over several cases
- Call:
>>> R.SubfigSweepCoeffHist(sfig, fswp, I)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- fswp:
str
Name of sweep
- I:
numpy.ndarray
[int
] List of indices in the sweep
- q:
True
|False
Whether or not to redraw images
- R:
- Versions:
2016-01-16
@ddalle
: v1.0 (SubfigSweepPointHist)2018-02-13
@ddalle
: v1.0
- SubfigSweepConditions(sfig, fswp, i, q=True)¶
Create lines for a “SweepConditions” subfigure
- Call:
>>> lines = R.SubfigSweepConditions(sfig, fswp, I, q)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- fswp:
str
Name of sweep
- i:
int
Case index
- q:
True
|False
Whether or not to update images
- R:
- Outputs:
- lines:
str
List of lines in the subfigure
- lines:
- Versions:
2015-05-29
@ddalle
: v1.02015-06-02
@ddalle
: v1.1; add min/max values
- SubfigTargetPlotLabel(sfig, k, targ)¶
Get line label for subfigure plot
- Call:
>>> lbl = R.SubfigPlotLabel(sfig, k, targ)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- k:
int
Plot index
- targ:
str
Name of target
- R:
- Outputs:
- lbl:
str
Plot label for target plot
- lbl:
- Versions:
2015-06-04
@ddalle
: v1.0
- SubfigTargets(sfig)¶
Return list of targets (by name) for a subfigure
- Call:
>>> targs = R.SubfigTargets(sfig)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- R:
- Outputs:
- Versions:
2015-06-04
@ddalle
: v1.0
- SubfigTecplotLayout(sfig: str, i: int, q)¶
Create image based on a Tecplot layout file
- Call:
>>> lines = R.SubfigTecplotLayout(sfig, i)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of sfigure to update
- i:
int
Case index
- R:
- Versions:
2016-09-06
@ddalle
: v1.02016-10-05
@ddalle
: v1.1; add “FieldMap” option2016-10-25
@ddalle
: v1.2; firstcape
version2025-08-25
@ddalle
: v1.3; support “case” compiling
- SweepSubfigSwitch(sfig, fswp, I, lines, q)¶
Switch function to find the correct subfigure function
This function may need to be defined for each CFD solver
- Call:
>>> lines = R.SubfigSwitch(sfig, fswp, I, lines)
- Inputs:
- Outputs:
- Versions:
2016-10-25
@ddalle
: v1.0, fromUpdateSubfig()
- UpdateSweep(fswp, I=None, cons=[])¶
Update the pages of a sweep
- Call:
>>> R.UpdateSweep(fswp, I)
- Inputs:
- Versions:
2015-05-29
@ddalle
: v1.02015-06-11
@ddalle
: Added minimum cases per page
- UpdateSweepPage(fswp, I, IT=[])¶
Update one page of a sweep for an automatic report
- Call:
>>> R.UpdateSweepPage(fswp, I, IT=[])
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- fswp:
str
Name of sweep to update
- I:
numpy.ndarray
[int
] List of cases in this sweep
- IT:
list
(numpy.ndarray
[int
]) List of correspond indices for each target
- R:
- Versions:
2015-05-29
@ddalle
: v1.02023-10-21
@ddalle
: v1.1; allow arbitrary depth
- UpdateSweepSubfigs(fig, fswp, I)¶
Update subfigures for a sweep figure fig
- Call:
>>> lines = R.UpdateSweepSubfigs(fig, fswp, I)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- fig:
str
Name of figure to update
- fswp:
str
Name of sweep
- I:
numpy.ndarray
[int
] List of case indices in the subsweep
- R:
- Outputs:
- Versions:
2015-05-29
@ddalle
: v1.02016-10-25
@ddalle
: v1.1; move some to SubfigSwitch()
- UpdateSweeps(I=None, cons=[], **kw)¶
Update pages of the report related to data book sweeps
- Call:
>>> R.UpdateSweeps(I=None, cons=[], **kw)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- I:
list
[int
] List of case indices
- cons:
list
[str
] List of constraints to define what cases to update
- R:
- Versions:
2015-05-28
@ddalle
: v1.0
- WriteScientific(v, decimals=8)¶
Convert value or string to scientific notation
The typical behavior is
1.4e-5
–>1.4\times10^{-5}
- Call:
>>> word = R.WriteScientific(v, decimals=8)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- v:
str
|float
|int
Value to be translated, preferably a string
- decimals: {
8
} |int
> 4 Round floats at \(10^{-d}\)
- R:
- Outputs:
- word:
str
String with substitutions made
- word:
- Versions:
2017-04-11
@ddalle
: v1.0
- cases¶
dict
[cape.filecntl.texfile.Tex
] Dictionary of LaTeX handles for each single-case page
- cd(fdir: str)¶
Interface to
os.chdir()
, respecting “Archive” optionThis function can only change one directory at a time.
- Call:
>>> R.cd(fdir)
- Inputs:
- R:
cape.cfdx.report.Report
Automated report interface
- fdir:
str
Name of directory to change to
- R:
- Versions:
2015-03-08
@ddalle
: v1.0
- clean_up_cases()¶
Clean up case folders
- Call:
>>> r.clean_up_cases()
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- r:
- Versions:
2015-05-29
@ddalle
: v1.0
- cntl¶
cape.cfdx.cntl.Cntl
Run matrix control instance
- compile_tex() int ¶
Compile the report using
pdflatex
- Call:
>>> r.compile_tex()
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- r:
- Outputs:
- ierr:
int
Return code
- ierr:
- Versions:
2025-08-25
@ddalle
: v1.0
- convert_vtk2plt(sfig: str)¶
Convert VTK file(s) to Tecplot(R) PLT format if requested
- Call:
>>> rep.convert_vtk2plt(sfig, i)
- Inputs:
- rep:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of subfigure
- i:
int
Case index
- rep:
- Versions:
2025-07-17
@ddalle
: v1.0
- find_cases(**kw)¶
Identify list of cases to report
- Call:
>>> r.find_cases(**kw)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- I: {
None
} |np.ndarray
[int
] Indices of cases to report
- re: {
None
} |str
Regular expression filter for case names
- r:
- Attributes:
- Versions:
2025-08-23
@ddalle
: v1.0
- get_CompileDir() str ¶
Get folder in which to compile document
- Call:
>>> dirname = r.get_CompileDir()
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- r:
- Outputs:
- dirname:
str
Absolute path to folder containing main
.tex
file
- dirname:
- Versions:
2026-08-22
@ddalle
: v1.0
- get_LaTeXFileName() str ¶
Get name of main LaTeX file
- Call:
>>> fname = r.get_LaTeXFileName()
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- r:
- Outputs:
- fname:
str
Name (basename) of file to write
- fname:
- Versions:
2026-08-22
@ddalle
: v1.0
- get_ReportLocation() str ¶
Get Location option from Report section
- Call:
>>> loc = r.get_ReportLocation()
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- r:
- Outputs:
- loc:
"case"
|"report"
Location for report figures to be stored
- loc:
- Versions:
2025-08-22
@ddalle
: v1.0
- get_ReportOpt(opt: str, vdef=None) Any ¶
Get value of generic Report option
- Call:
>>> v = r.get_ReportOpt(opt, vdef=None)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- opt:
str
Name of string
- vdef: {
None
} |object
Optional default value
- r:
- Outputs:
- v:
object
Value of option
- v:
- Versions:
2025-08-22
@ddalle
: v1.0
- get_case_n(i: int) int | None ¶
Get number of iterations for case i, using cache
- Call:
>>> n = r.get_case_n(i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- i:
int
Case number
- r:
- Outputs:
- n:
int
Number of iterations from case i
- n:
- Versions:
2025-08-23
@ddalle
: v1.0
- get_case_name(i: int) str ¶
Get case’s folder name
- Call:
>>> frun = r.get_case_name(i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- i:
int
Case number
- r:
- Outputs:
- frun:
str
Relative path to case i
- frun:
- Versions:
2025-08-24
@ddalle
: v1.0
- get_case_status(i: int) str ¶
Get number of iterations for case i, using cache
- Call:
>>> sts = r.get_case_n(i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- i:
int
Case number
- r:
- Outputs:
- sts:
str
Status for case i
- sts:
- Versions:
2025-08-23
@ddalle
: v1.0
- get_figdir(i: int) str ¶
Get path to case’s figures relative to compile dir
- Call:
>>> figdir = r.get_figdir(i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- i:
int
Case number
- r:
- Outputs:
- figdir:
str
Path to case’s figure folder relative to compile folder
- figdir:
- Versions:
2025-08-24
@ddalle
: v1.0
- get_figlist(i: int) list ¶
Get list of figures for a report based on case’s status
- Call:
>>> figs = r.get_figlist(i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- i:
int
Case index
- r:
- Outputs:
- Versions:
2025-08-24
@ddalle
: v1.0
- get_subfig_defn(sfig: str, i: int) dict ¶
Get the archival defintion for existing copy of a subfigure
- Call:
>>> defn = r.get_subfig_defn(sfig, i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of subfigure
- i:
int
Case index
- r:
- Outputs:
- defn:
dict
Definition for sfig in case i, if any
- defn:
- Versions:
2025-08-24
@ddalle
: v1.0
- get_subfig_status(sfig: str, i: int) int | None ¶
Get the iteration for any existing copy of a subfigure
- Call:
>>> n = r.get_subfig_status(sfig, i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of subfigure
- i:
int
Case index
- r:
- Outputs:
- n:
int
|None
Iteration number of existing subfigure, else
None
- n:
- Versions:
2025-08-24
@ddalle
: v1.0
- includegraphics(fimg: str, lines: list, i: int)¶
Add line for including image in a file
This automates checks if the file exists and links to the correct folder based on the Location setting.
- Call:
>>> r.includegraphics(fimg, lines, i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- fimg:
str
Name of image file to include
- lines:
list
[str
] Lines of text for
.tex
file, appended to- i:
int
Case number
- r:
- Versions:
2025-08-25
@ddalle
: v1.0
- mkdir_p(dirname: str, where: str | None = None)¶
Create a folder if necessary
- Call:
>>> r.mkdir_p(dirname, where=None)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- dirname:
str
Name of folder (can be multilevel e.g.
a/b
)- where: {
None
} |str
Absolute path to start from (or
os.getcwd()
)
- r:
- Versions:
2025-08-22
@ddalle
: v1.0
- read_case_json(i: int) dict ¶
Read the JSON file which contains the current statuses
- Call:
>>> rc = r.read_case_json(i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- i:
int
Case index
- r:
- Outputs:
- rc:
dict
Dictionary of subfigure definitions and status
- rc:
- Versions:
2016-10-25
@ddalle
: v1.0
- read_runner(i: int) CaseRunner ¶
Read case control instance for case i
- Call:
>>> runner = r.read_runner(i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- i:
int
Case index
- r:
- Outputs:
- runner:
cape.cfdx.casecntl.CaseRunner
Case control instance
- runner:
- Versions:
2025-08-26
@ddalle
: v1.0
- save_figure(sfig: str, h: dict)¶
Write out image files in varous formats
- Call:
>>> r.save_figure(sfig, sfig, h)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of subfigure
- h:
matplotlib.figure
Matplotlib figure handle
- r:
- Output:
- fimg:
str
Figure name
- fimg:
- Versions:
2023-06-06
@jmeeroff
: v1.02025-08-25
@ddalle
: v1.1; save to get_figdir()
- subfig_frontend(sfig: str, i: int) list ¶
Switch function to find the correct subfigure function
This function may need to be defined for each CFD solver
- Call:
>>> lines = r.subfig_frontend(sfig, i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of subfigure to update
- i:
int
Case index
- r:
- Outputs:
- Versions:
2016-10-25
@ddalle
: v1.0, fromUpdateSubfig()
2025-08-25
@ddalle
: v2.0, fromSubfigSwitch()
- sweeps¶
dict
[cape.filecntl.texfile.Tex
] Dictionary of LaTeX handles for each sweep page
- tar(ftar: str, *a)¶
Tar an archive folder if requested
- Call:
>>> rep.tar(ftar, *a)
- Inputs:
- rep:
cape.cfdx.report.Report
Automated report itnerface
- ftar:
str
Name of archive to create
- a:
tuple
[str
] Names or patterns of files to include in archive
- rep:
- Versions:
2015-03-07
@ddalle
: v1.0 (cape.tar.tar())2019-11-07
@ddalle
: v1.1 (cape.tar.tar())2025-08-22
@ddalle
: v1.0
- tar_case(i: int)¶
Archive/tar one case’s report, if appropriate
- Call:
>>> r.tar_case(i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report itnerface
- i:
int
Case number
- r:
- Versions:
2025-08-24
@ddalle
: v1.0
- tex¶
cape.filecntl.texfile.Tex
Main LaTeX file interface
- untar(ftar: str)¶
Untar an archive folder if requested
- Call:
>>> r.untar(ftar)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report itnerface
- ftar:
str
Name of archive to create
- r:
- Versions:
2015-03-07
@ddalle
: v1.0 (cape.tar.tar())2019-11-07
@ddalle
: v1.1 (cape.tar.tar())2025-08-22
@ddalle
: v1.0
- untar_case(i: int)¶
Untar the archive of one case’s report, if appropriate
- Call:
>>> r.untar_case(i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report itnerface
- i:
int
Case number
- r:
- Versions:
2025-08-24
@ddalle
: v1.0
- update_case(i: int)¶
Open, create if necessary, and update LaTeX file for a case
- Call:
>>> r.update_case(i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- i:
int
Case index
- r:
- Versions:
2015-03-08
@ddalle
: v1.0;UpdateCase()
2023-10-21
@ddalle
: v1.1; allow arbitrary depth2025-08-23
@ddalle
: v2.0; rename, use Location
- update_cases()¶
Update images and LaTeX for multiple cases of one report
- Call:
>>> r.update_cases()
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- r:
- Versions:
2025-08-23
@ddalle
: v1.0
- update_report(**kw)¶
Update a report based on the list of figures
- Call:
>>> r.UpdateReport(**kw)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- I:
list
[int
] List of case indices
- cons:
list
[str
] List of constraints to define what cases to update
- r:
- Versions:
2015-05-22
@ddalle
: v1.0,UpdateReport()
2025-08-25
@ddalle
: v2.0, use Location
- update_subfig(sfig: str, i: int)¶
Update a subfigure
- Call:
>>> r.update_subfig(sfig, i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- sfig:
str
Name of subfigure
- i:
int
Case index
- r:
- Versions:
2025-08-25
@ddalle
: v1.0
- write_case(i: int)¶
Write the primary
.tex
file for one caseThis will write a file either
{r.casedict_name[i]}/report-{r.rep}.tex
{r.casedict_name[i]}/report/report-{r.rep}.tex
depending on the Location setting. The file includes the header information for the case and the definitions of each figure. The subfigures are identified via
\include{}
statements.- Call:
>>> r.write_case(i)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- i:
int
Case index
- r:
- Versions:
2025-08-23
@ddalle
: v1.0
- write_case_json(i: int, rc: dict)¶
Write the current status to
report.json
- Call:
>>> r.write_case_json(i, rc)
- Inputs:
- r:
cape.cfdx.report.Report
Automated report interface
- i:
int
Case number
- rc:
dict
Dictionary of subfigure definitions and status
- r:
- Versions:
2016-10-25
@ddalle
: v1.0 (WriteCaseJSON())2025-08-24
@ddalle
: v1.1 add i
- write_main()¶
Write the primary
.tex
file- Call:
>>> r.write_main()
- Inputs:
- rep:
cape.cfdx.report.Report
Automated report itnerface
- rep:
- Versions:
2025-08-23
@ddalle
: v1.0