report

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package report writes a run's summary as a table, JSON or CSV from the typed values, by hand. The CLI, the browser build and the language bindings all produce their output through it, so the JSON shape is one and the same everywhere.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoundsAt

func BoundsAt(b variate.Bounds, x float64) (lo, hi float64)

BoundsAt reads a transform bracket at x from the lattice point at or above x, for both curves: a total of at least x rounds up to at least that point, and a total that rounds down to at least that point is at least x. Below the first point the upper bound is then the probability of a non-empty period, not one.

func CSVField

func CSVField(s string) string

CSVField quotes a field when it needs it.

func PhaseText added in v0.1.4

func PhaseText(p variate.Phase) string

PhaseText heads a report of one phase, so that it cannot be taken for the whole cycle; empty for a model over its whole cycle.

func PlanJSON

func PlanJSON(w *bufio.Writer, c *variate.Compiled, e *variate.Expectation, cfg variate.Config, warnings []variate.Warning, estimate string, blocks []BlockFigure)

PlanJSON writes the convergence plan as JSON: the expected work, the exact mean, the warnings, the criteria rows, the periods the plan runs and what binds them, an estimate of the time, and the blocks.

func SweepJSON added in v0.1.3

func SweepJSON(sw *variate.Sweep) []byte

SweepJSON is WriteSweepJSON into a byte slice.

func WriteSweepCSV added in v0.1.3

func WriteSweepCSV(w *bufio.Writer, sw *variate.Sweep)

WriteSweepCSV writes one row per input.

func WriteSweepJSON added in v0.1.3

func WriteSweepJSON(w *bufio.Writer, sw *variate.Sweep)

WriteSweepJSON writes a sweep as one JSON object; a figure is a lo, hi pair, equal when exact or simulated, a missing standard error is null, and each row carries the range the model gave its input (null under a screen or when there is none) and the factors it was moved by.

func WriteSweepTable added in v0.1.3

func WriteSweepTable(w *bufio.Writer, sw *variate.Sweep)

WriteSweepTable writes a sweep as a table, the largest swing first: each input's range, the figure at its low end, as it is and at its high end, an exact or simulated figure as one number and a bracket as [lo, hi], and a simulated difference's standard error beside it.

Types

type BlockFigure

type BlockFigure struct {
	Source                     string
	Rate, MTBF, Unavailability float64
}

BlockFigure is a reliability block's stationary figures, for the plan.

type Histogram

type Histogram struct {
	Edges []float64
	Mass  []float64
}

Histogram is a band chart of the period total: the mass between consecutive edges, with the mass beyond the last edge as a final band.

func LinearHistogram

func LinearHistogram(w *variate.Workspace, top float64, n int, unit float64) *Histogram

LinearHistogram builds a histogram of n bands from 0 to top from the workspace's streaming histogram, plus the open band beyond top. The empty periods are in no band: they are reported as a share of their own, and in a rare-event model they would dwarf every other band. A positive unit says the total is a multiple of it; the bands are then the same whole number of multiples each, with edges halfway between multiples, so a chart of a lattice does not ripple with the number of atoms a band happens to catch.

func LinearHistogramOf

func LinearHistogramOf(w *variate.Workspace, row int, top float64, n int, unit float64) *Histogram

LinearHistogramOf is LinearHistogram for the quantity at a row of the workspace (Workspace.QuantityRow).

func LogHistogram

func LogHistogram(w *variate.Workspace, lo, top float64, n int) *Histogram

LogHistogram builds a histogram of n bands with edges spaced equally in the logarithm from lo to top, plus the open band beyond top, from the workspace's streaming histogram. Leading bands with less than minMass are dropped, so the chart starts where the mass does. Periods with a total below lo, including the empty ones, are in no band.

func LogHistogramOf

func LogHistogramOf(w *variate.Workspace, row int, lo, top float64, n int) *Histogram

LogHistogramOf is LogHistogram for the quantity at a row of the workspace.

type Report

type Report struct {
	C        *variate.Compiled
	R        *variate.Result
	Sum      *variate.Summary
	Analytic bool // include the exact expectations and the transform
	E        *variate.Expectation
	Tr       *variate.Transformed
	Hist     *Histogram        // linear bands of the period total, for drawing; nil = none
	LogHist  *Histogram        // log-spaced bands of the same, for drawing; nil = none
	Warnings []variate.Warning // compile warnings to include in the JSON
}

Report is everything the summary writers read.

func New

func New(c *variate.Compiled, w *variate.Workspace, r *variate.Result, analytic bool) (*Report, error)

New assembles the report of a finished run from its workspace: the summary, and with analytic the exact expectations and the transform computed at compile. Every entry point builds its report here.

func (*Report) JSON

func (rep *Report) JSON() []byte

JSON renders the report as one JSON document.

func (*Report) WriteCSV

func (rep *Report) WriteCSV(w *bufio.Writer)

WriteCSV writes one row per quantity.

func (*Report) WriteExceedanceFile

func (rep *Report) WriteExceedanceFile(path string) error

WriteExceedanceFile writes the curve as CSV: x, p, stderr, and the transform's lower and upper bounds when they exist.

func (*Report) WriteJSON

func (rep *Report) WriteJSON(w *bufio.Writer)

WriteJSON writes the report as one JSON object.

func (*Report) WriteTable

func (rep *Report) WriteTable(w *bufio.Writer)

WriteTable writes the human-readable report.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL