Documentation ¶
Overview ¶
Package hbook is a set of data analysis tools for HEP (histograms (1D, 2D, 3D), profiles and ntuples). hbook is a work in progress of a concurrent friendly histogram filling toolkit. It is loosely based on AIDA interfaces and concepts as well as the "simplicity" of HBOOK and the previous work of YODA.
Index ¶
- Constants
- type Annotation
- type Bin
- type Bin1D
- func (b *Bin1D) EffEntries() float64
- func (b *Bin1D) Entries() int64
- func (b *Bin1D) ErrW() float64
- func (o *Bin1D) MarshalBinary() (data []byte, err error)
- func (Bin1D) Rank() int
- func (b *Bin1D) SumW() float64
- func (b *Bin1D) SumW2() float64
- func (o *Bin1D) UnmarshalBinary(data []byte) (err error)
- func (b *Bin1D) XEdges() Range
- func (b *Bin1D) XFocus() float64
- func (b *Bin1D) XMax() float64
- func (b *Bin1D) XMean() float64
- func (b *Bin1D) XMid() float64
- func (b *Bin1D) XMin() float64
- func (b *Bin1D) XRMS() float64
- func (b *Bin1D) XStdDev() float64
- func (b *Bin1D) XStdErr() float64
- func (b *Bin1D) XVariance() float64
- func (b *Bin1D) XWidth() float64
- type Bin1Ds
- type Bin2D
- func (b *Bin2D) EffEntries() float64
- func (b *Bin2D) Entries() int64
- func (o *Bin2D) MarshalBinary() (data []byte, err error)
- func (Bin2D) Rank() int
- func (b *Bin2D) SumW() float64
- func (b *Bin2D) SumW2() float64
- func (o *Bin2D) UnmarshalBinary(data []byte) (err error)
- func (b *Bin2D) XEdges() Range
- func (b *Bin2D) XFocus() float64
- func (b *Bin2D) XMax() float64
- func (b *Bin2D) XMean() float64
- func (b *Bin2D) XMid() float64
- func (b *Bin2D) XMin() float64
- func (b *Bin2D) XRMS() float64
- func (b *Bin2D) XStdDev() float64
- func (b *Bin2D) XStdErr() float64
- func (b *Bin2D) XVariance() float64
- func (b *Bin2D) XWidth() float64
- func (b *Bin2D) XYFocus() (float64, float64)
- func (b *Bin2D) XYMid() (float64, float64)
- func (b *Bin2D) XYWidth() (float64, float64)
- func (b *Bin2D) YEdges() Range
- func (b *Bin2D) YFocus() float64
- func (b *Bin2D) YMax() float64
- func (b *Bin2D) YMean() float64
- func (b *Bin2D) YMid() float64
- func (b *Bin2D) YMin() float64
- func (b *Bin2D) YRMS() float64
- func (b *Bin2D) YStdDev() float64
- func (b *Bin2D) YStdErr() float64
- func (b *Bin2D) YVariance() float64
- func (b *Bin2D) YWidth() float64
- type BinP1D
- func (b *BinP1D) EffEntries() float64
- func (b *BinP1D) Entries() int64
- func (o *BinP1D) MarshalBinary() (data []byte, err error)
- func (BinP1D) Rank() int
- func (b *BinP1D) SumW() float64
- func (b *BinP1D) SumW2() float64
- func (o *BinP1D) UnmarshalBinary(data []byte) (err error)
- func (b *BinP1D) XEdges() Range
- func (b *BinP1D) XFocus() float64
- func (b *BinP1D) XMax() float64
- func (b *BinP1D) XMean() float64
- func (b *BinP1D) XMid() float64
- func (b *BinP1D) XMin() float64
- func (b *BinP1D) XRMS() float64
- func (b *BinP1D) XStdDev() float64
- func (b *BinP1D) XStdErr() float64
- func (b *BinP1D) XVariance() float64
- func (b *BinP1D) XWidth() float64
- type Binning1D
- type Binning2D
- type Count
- type Dist0D
- type Dist1D
- func (d *Dist1D) EffEntries() float64
- func (d *Dist1D) Entries() int64
- func (o *Dist1D) MarshalBinary() (data []byte, err error)
- func (*Dist1D) Rank() int
- func (d *Dist1D) SumW() float64
- func (d *Dist1D) SumW2() float64
- func (d *Dist1D) SumWX() float64
- func (d *Dist1D) SumWX2() float64
- func (o *Dist1D) UnmarshalBinary(data []byte) (err error)
- type Dist2D
- func (d *Dist2D) EffEntries() float64
- func (d *Dist2D) Entries() int64
- func (o *Dist2D) MarshalBinary() (data []byte, err error)
- func (*Dist2D) Rank() int
- func (d *Dist2D) SumW() float64
- func (d *Dist2D) SumW2() float64
- func (d *Dist2D) SumWX() float64
- func (d *Dist2D) SumWX2() float64
- func (d *Dist2D) SumWXY() float64
- func (d *Dist2D) SumWY() float64
- func (d *Dist2D) SumWY2() float64
- func (o *Dist2D) UnmarshalBinary(data []byte) (err error)
- type DivOptions
- type H1D
- func (h *H1D) Annotation() Annotation
- func (h *H1D) Bin(x float64) *Bin1D
- func (h *H1D) Clone() *H1D
- func (h *H1D) Counts() []Count
- func (h *H1D) DataRange() (xmin, xmax, ymin, ymax float64)
- func (h *H1D) EffEntries() float64
- func (h *H1D) Entries() int64
- func (h *H1D) Error(i int) float64
- func (h *H1D) Fill(x, w float64)
- func (h *H1D) FillN(xs, ws []float64)
- func (h *H1D) Integral(args ...float64) float64
- func (h *H1D) Len() int
- func (o *H1D) MarshalBinary() (data []byte, err error)
- func (h *H1D) MarshalYODA() ([]byte, error)
- func (h *H1D) Name() string
- func (h *H1D) Rank() int
- func (h *H1D) RioMarshal(w io.Writer) error
- func (h *H1D) RioUnmarshal(r io.Reader) error
- func (h *H1D) RioVersion() rio.Version
- func (h *H1D) Scale(factor float64)
- func (h *H1D) SumW() float64
- func (h *H1D) SumW2() float64
- func (h *H1D) SumWX() float64
- func (h *H1D) SumWX2() float64
- func (o *H1D) UnmarshalBinary(data []byte) (err error)
- func (h *H1D) UnmarshalYODA(data []byte) error
- func (h *H1D) Value(i int) float64
- func (h *H1D) XMax() float64
- func (h *H1D) XMean() float64
- func (h *H1D) XMin() float64
- func (h *H1D) XRMS() float64
- func (h *H1D) XStdDev() float64
- func (h *H1D) XStdErr() float64
- func (h *H1D) XVariance() float64
- func (h *H1D) XY(i int) (float64, float64)
- type H2D
- func (h *H2D) Annotation() Annotation
- func (h *H2D) Bin(x, y float64) *Bin2D
- func (h *H2D) EffEntries() float64
- func (h *H2D) Entries() int64
- func (h *H2D) Fill(x, y, w float64)
- func (h *H2D) FillN(xs, ys, ws []float64)
- func (h *H2D) GridXYZ() h2dGridXYZ
- func (h *H2D) Integral() float64
- func (o *H2D) MarshalBinary() (data []byte, err error)
- func (h *H2D) MarshalYODA() ([]byte, error)
- func (h *H2D) Name() string
- func (h *H2D) Rank() int
- func (h *H2D) SumW() float64
- func (h *H2D) SumW2() float64
- func (h *H2D) SumWX() float64
- func (h *H2D) SumWX2() float64
- func (h *H2D) SumWXY() float64
- func (h *H2D) SumWY() float64
- func (h *H2D) SumWY2() float64
- func (o *H2D) UnmarshalBinary(data []byte) (err error)
- func (h *H2D) UnmarshalYODA(data []byte) error
- func (h *H2D) XMax() float64
- func (h *H2D) XMean() float64
- func (h *H2D) XMin() float64
- func (h *H2D) XRMS() float64
- func (h *H2D) XStdDev() float64
- func (h *H2D) XStdErr() float64
- func (h *H2D) XVariance() float64
- func (h *H2D) YMax() float64
- func (h *H2D) YMean() float64
- func (h *H2D) YMin() float64
- func (h *H2D) YRMS() float64
- func (h *H2D) YStdDev() float64
- func (h *H2D) YStdErr() float64
- func (h *H2D) YVariance() float64
- type Histogram
- type Object
- type P1D
- func (p *P1D) Annotation() Annotation
- func (p *P1D) Binning() *binningP1D
- func (p *P1D) EffEntries() float64
- func (p *P1D) Entries() int64
- func (p *P1D) Fill(x, y, w float64)
- func (o *P1D) MarshalBinary() (data []byte, err error)
- func (p *P1D) MarshalYODA() ([]byte, error)
- func (p *P1D) Name() string
- func (p *P1D) Rank() int
- func (p *P1D) Scale(factor float64)
- func (p *P1D) SumW() float64
- func (p *P1D) SumW2() float64
- func (o *P1D) UnmarshalBinary(data []byte) (err error)
- func (p *P1D) UnmarshalYODA(data []byte) error
- func (p *P1D) XMax() float64
- func (p *P1D) XMean() float64
- func (p *P1D) XMin() float64
- func (p *P1D) XRMS() float64
- func (p *P1D) XStdDev() float64
- func (p *P1D) XStdErr() float64
- func (p *P1D) XVariance() float64
- type Point2D
- func (o *Point2D) MarshalBinary() (data []byte, err error)
- func (p *Point2D) ScaleX(f float64)
- func (p *Point2D) ScaleXY(f float64)
- func (p *Point2D) ScaleY(f float64)
- func (o *Point2D) UnmarshalBinary(data []byte) (err error)
- func (p Point2D) XMax() float64
- func (p Point2D) XMin() float64
- func (p Point2D) YMax() float64
- func (p Point2D) YMin() float64
- type Rand1D
- type Range
- type S2D
- func (s *S2D) Annotation() Annotation
- func (s *S2D) DataRange() (xmin, xmax, ymin, ymax float64)
- func (s *S2D) Entries() int64
- func (s *S2D) Fill(pts ...Point2D)
- func (s *S2D) Len() int
- func (o *S2D) MarshalBinary() (data []byte, err error)
- func (s *S2D) MarshalYODA() ([]byte, error)
- func (s *S2D) Name() string
- func (s *S2D) Point(i int) Point2D
- func (s *S2D) Points() []Point2D
- func (*S2D) Rank() int
- func (s *S2D) ScaleX(f float64)
- func (s *S2D) ScaleXY(f float64)
- func (s *S2D) ScaleY(f float64)
- func (s *S2D) Sort()
- func (o *S2D) UnmarshalBinary(data []byte) (err error)
- func (s *S2D) UnmarshalYODA(data []byte) error
- func (s *S2D) XError(i int) (float64, float64)
- func (s *S2D) XY(i int) (x, y float64)
- func (s *S2D) YError(i int) (float64, float64)
- type S2DOpts
Examples ¶
Constants ¶
const ( UnderflowBin1D = -1 OverflowBin1D = -2 )
Indices for the under- and over-flow 1-dim bins.
const ( BngNW int = 1 + iota BngN BngNE BngE BngSE BngS BngSW BngW )
indices for the 2D-binning overflows
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
type Annotation map[string]interface{}
Annotation is a bag of attributes that are attached to a histogram.
func (*Annotation) MarshalBinary ¶
func (ann *Annotation) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler
func (Annotation) MarshalYODA ¶
func (ann Annotation) MarshalYODA() ([]byte, error)
MarshalYODA implements the YODAMarshaler interface.
func (*Annotation) UnmarshalBinary ¶
func (ann *Annotation) UnmarshalBinary(data []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler
func (*Annotation) UnmarshalYODA ¶
func (ann *Annotation) UnmarshalYODA(data []byte) error
UnmarshalYODA implements the YODAUnmarshaler interface.
type Bin ¶
type Bin interface { Rank() int // Number of dimensions of the bin Entries() int64 // Number of entries in the bin EffEntries() float64 // Effective number of entries in the bin SumW() float64 // sum of weights SumW2() float64 // sum of squared weights }
Bin models 1D, 2D, ... bins.
type Bin1D ¶
Bin1D models a bin in a 1-dim space.
func (*Bin1D) EffEntries ¶
EffEntries returns the effective number of entries \f$ = (\sum w)^2 / \sum w^2 \f$
func (*Bin1D) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler
func (*Bin1D) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler
func (*Bin1D) XFocus ¶
XFocus returns the mean position in the bin, or the midpoint (if the sum of weights for this bin is 0).
type Bin1Ds ¶
type Bin1Ds []Bin1D
Bin1Ds is a sorted slice of Bin1D implementing sort.Interface.
type Bin2D ¶
Bin2D models a bin in a 2-dim space.
func (*Bin2D) EffEntries ¶
EffEntries returns the effective number of entries \f$ = (\sum w)^2 / \sum w^2 \f$
func (*Bin2D) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler
func (*Bin2D) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler
func (*Bin2D) XFocus ¶
XFocus returns the mean position in the bin, or the midpoint (if the sum of weights for this bin is 0).
func (*Bin2D) XYFocus ¶
XYFocus returns the mean position in the bin, or the midpoint (if the sum of weights for this bin is 0).
func (*Bin2D) XYMid ¶
XYMid returns the (x,y) coordinates of the geometric center of the bin. i.e.: 0.5*(high+low)
func (*Bin2D) YFocus ¶
YFocus returns the mean position in the bin, or the midpoint (if the sum of weights for this bin is 0).
type BinP1D ¶
type BinP1D struct {
// contains filtered or unexported fields
}
BinP1D models a bin in a 1-dim space.
func (*BinP1D) EffEntries ¶
EffEntries returns the effective number of entries \f$ = (\sum w)^2 / \sum w^2 \f$
func (*BinP1D) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler
func (*BinP1D) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler
func (*BinP1D) XFocus ¶
XFocus returns the mean position in the bin, or the midpoint (if the sum of weights for this bin is 0).
type Binning1D ¶ added in v0.15.0
Binning1D is a 1-dim binning of the x-axis.
func (*Binning1D) MarshalBinary ¶ added in v0.15.0
MarshalBinary implements encoding.BinaryMarshaler
func (*Binning1D) UnmarshalBinary ¶ added in v0.15.0
UnmarshalBinary implements encoding.BinaryUnmarshaler
type Binning2D ¶ added in v0.15.0
type Binning2D struct { Bins []Bin2D Dist Dist2D Outflows [8]Dist2D XRange Range YRange Range Nx int Ny int XEdges []Bin1D YEdges []Bin1D }
func (*Binning2D) MarshalBinary ¶ added in v0.15.0
MarshalBinary implements encoding.BinaryMarshaler
func (*Binning2D) UnmarshalBinary ¶ added in v0.15.0
UnmarshalBinary implements encoding.BinaryUnmarshaler
type Count ¶ added in v0.28.0
Count is a 1-dim binned information, made of a X range, a value and its uncertainties.
Example ¶
package main import ( "fmt" "go-hep.org/x/hep/hbook" ) func main() { c := hbook.Count{} c.XRange = hbook.Range{Min: 0, Max: 1} c.Val = 10 c.Err.Low = 2 c.Err.High = 3 fmt.Printf("[%v, %v] -> %v +%v -%v", c.XRange.Min, c.XRange.Max, c.Val, c.Err.High, c.Err.Low) }
Output: [0, 1] -> 10 +3 -2
Example (WithH1D) ¶
package main import ( "fmt" "go-hep.org/x/hep/hbook" ) func main() { h := hbook.NewH1D(6, 0, 6) h.Fill(-0.5, 1) h.Fill(0, 1.5) h.Fill(0.5, 1) h.Fill(1.2, 1) h.Fill(2.1, 2) h.Fill(4.2, 1) h.Fill(5.9, 1) h.Fill(6, 0.5) for _, c := range h.Counts() { fmt.Printf("[%v, %v] -> %v +%.1f -%.1f\n", c.XRange.Min, c.XRange.Max, c.Val, c.Err.High, c.Err.Low) } }
Output: [0, 1] -> 2.5 +0.9 -0.9 [1, 2] -> 1 +0.5 -0.5 [2, 3] -> 2 +1.0 -1.0 [3, 4] -> 0 +0.0 -0.0 [4, 5] -> 1 +0.5 -0.5 [5, 6] -> 1 +0.5 -0.5
type Dist0D ¶ added in v0.15.0
type Dist0D struct { N int64 // number of entries SumW float64 // sum of weights SumW2 float64 // sum of squared weights }
Dist0D is a 0-dim distribution.
func (*Dist0D) EffEntries ¶ added in v0.15.0
EffEntries returns the number of weighted entries, such as:
(\sum w)^2 / \sum w^2
func (*Dist0D) Entries ¶ added in v0.15.0
Entries returns the number of entries in the distribution.
func (*Dist0D) MarshalBinary ¶ added in v0.15.0
MarshalBinary implements encoding.BinaryMarshaler
func (*Dist0D) UnmarshalBinary ¶ added in v0.15.0
UnmarshalBinary implements encoding.BinaryUnmarshaler
type Dist1D ¶ added in v0.15.0
type Dist1D struct { Dist Dist0D // weight moments Stats struct { SumWX float64 // 1st order weighted x moment SumWX2 float64 // 2nd order weighted x moment } }
Dist1D is a 1-dim distribution.
func (*Dist1D) EffEntries ¶ added in v0.15.0
EffEntries returns the effective number of entries in the distribution.
func (*Dist1D) Entries ¶ added in v0.15.0
Entries returns the number of entries in the distribution.
func (*Dist1D) MarshalBinary ¶ added in v0.15.0
MarshalBinary implements encoding.BinaryMarshaler
func (*Dist1D) SumW2 ¶ added in v0.15.0
SumW2 returns the sum of squared weights of the distribution.
func (*Dist1D) UnmarshalBinary ¶ added in v0.15.0
UnmarshalBinary implements encoding.BinaryUnmarshaler
type Dist2D ¶ added in v0.15.0
type Dist2D struct { X Dist1D // x moments Y Dist1D // y moments Stats struct { SumWXY float64 // 2nd-order cross-term } }
Dist2D is a 2-dim distribution.
func (*Dist2D) EffEntries ¶ added in v0.15.0
EffEntries returns the effective number of entries in the distribution.
func (*Dist2D) Entries ¶ added in v0.15.0
Entries returns the number of entries in the distribution.
func (*Dist2D) MarshalBinary ¶ added in v0.15.0
MarshalBinary implements encoding.BinaryMarshaler
func (*Dist2D) SumW2 ¶ added in v0.15.0
SumW2 returns the sum of squared weights of the distribution.
func (*Dist2D) UnmarshalBinary ¶ added in v0.15.0
UnmarshalBinary implements encoding.BinaryUnmarshaler
type DivOptions ¶ added in v0.27.0
type DivOptions func(c *divConfig)
DivOptions allows to customize the behaviour of DivideH1D
func DivIgnoreNaNs ¶ added in v0.27.0
func DivIgnoreNaNs() DivOptions
DivIgnoreNaNs function configures DivideH1D to ignore data points with NaNs.
func DivReplaceNaNs ¶ added in v0.27.0
func DivReplaceNaNs(v float64) DivOptions
DivReplaceNaNs function configures DivideH1D to replace NaN raised during divisions with the provided value.
type H1D ¶
type H1D struct { Binning Binning1D Ann Annotation }
H1D is a 1-dim histogram with weighted entries.
Example ¶
package main import ( "fmt" "go-hep.org/x/hep/hbook" "golang.org/x/exp/rand" "gonum.org/v1/gonum/stat/distuv" ) func main() { const npoints = 10000 // Create a normal distribution. dist := distuv.Normal{ Mu: 0, Sigma: 1, Src: rand.New(rand.NewSource(0)), } // Draw some random values from the standard // normal distribution. h := hbook.NewH1D(20, -4, +4) for i := 0; i < npoints; i++ { v := dist.Rand() h.Fill(v, 1) } // fill h with a slice of values and their weights h.FillN([]float64{1, 2, 3}, []float64{1, 1, 1}) h.FillN([]float64{1, 2, 3}, nil) // all weights are 1. fmt.Printf("mean: %v\n", h.XMean()) fmt.Printf("rms: %v\n", h.XRMS()) fmt.Printf("std-dev: %v\n", h.XStdDev()) fmt.Printf("std-err: %v\n", h.XStdErr()) }
Output: mean: 0.005589967511734562 rms: 1.0062596231244403 std-dev: 1.0062943821322063 std-err: 0.010059926295994191
func AddH1D ¶ added in v0.27.0
AddH1D returns the bin-by-bin summed histogram of h1 and h2 assuming their statistical uncertainties are uncorrelated.
Example ¶
package main import ( "fmt" "math" "go-hep.org/x/hep/hbook" ) func main() { h1 := hbook.NewH1D(6, 0, 6) h1.Fill(-0.5, 1) h1.Fill(0, 1.5) h1.Fill(0.5, 1) h1.Fill(1.2, 1) h1.Fill(2.1, 2) h1.Fill(4.2, 1) h1.Fill(5.9, 1) h1.Fill(6, 0.5) h2 := hbook.NewH1D(6, 0, 6) h2.Fill(-0.5, 0.7) h2.Fill(0.2, 1) h2.Fill(0.7, 1.2) h2.Fill(1.5, 0.8) h2.Fill(2.2, 0.7) h2.Fill(4.3, 1.3) h2.Fill(5.2, 2) h2.Fill(6.8, 1) hsum := hbook.AddH1D(h1, h2) fmt.Printf("Under: %.1f +/- %.1f\n", hsum.Binning.Outflows[0].SumW(), math.Sqrt(hsum.Binning.Outflows[0].SumW2())) for i := 0; i < hsum.Len(); i++ { fmt.Printf("Bin %v: %.1f +/- %.1f\n", i, hsum.Binning.Bins[i].SumW(), math.Sqrt(hsum.Binning.Bins[i].SumW2())) } fmt.Printf("Over : %.1f +/- %.1f\n", hsum.Binning.Outflows[1].SumW(), math.Sqrt(hsum.Binning.Outflows[1].SumW2())) }
Output: Under: 1.7 +/- 1.2 Bin 0: 4.7 +/- 2.4 Bin 1: 1.8 +/- 1.3 Bin 2: 2.7 +/- 2.1 Bin 3: 0.0 +/- 0.0 Bin 4: 2.3 +/- 1.6 Bin 5: 3.0 +/- 2.2 Over : 1.5 +/- 1.1
func AddScaledH1D ¶ added in v0.27.0
AddScaledH1D returns the histogram with the bin-by-bin h1+alpha*h2 operation, assuming statistical uncertainties are uncorrelated.
Example ¶
package main import ( "fmt" "math" "go-hep.org/x/hep/hbook" ) func main() { h1 := hbook.NewH1D(6, 0, 6) h1.Fill(-0.5, 1) h1.Fill(0, 1.5) h1.Fill(0.5, 1) h1.Fill(1.2, 1) h1.Fill(2.1, 2) h1.Fill(4.2, 1) h1.Fill(5.9, 1) h1.Fill(6, 0.5) h2 := hbook.NewH1D(6, 0, 6) h2.Fill(-0.5, 0.7) h2.Fill(0.2, 1) h2.Fill(0.7, 1.2) h2.Fill(1.5, 0.8) h2.Fill(2.2, 0.7) h2.Fill(4.3, 1.3) h2.Fill(5.2, 2) h2.Fill(6.8, 1) hsum := hbook.AddScaledH1D(h1, 10, h2) fmt.Printf("Under: %.1f +/- %.1f\n", hsum.Binning.Outflows[0].SumW(), math.Sqrt(hsum.Binning.Outflows[0].SumW2())) for i := 0; i < hsum.Len(); i++ { fmt.Printf("Bin %v: %.1f +/- %.1f\n", i, hsum.Binning.Bins[i].SumW(), math.Sqrt(hsum.Binning.Bins[i].SumW2())) } fmt.Printf("Over : %.1f +/- %.1f\n", hsum.Binning.Outflows[1].SumW(), math.Sqrt(hsum.Binning.Outflows[1].SumW2())) }
Output: Under: 8.0 +/- 7.1 Bin 0: 24.5 +/- 15.7 Bin 1: 9.0 +/- 8.1 Bin 2: 9.0 +/- 7.3 Bin 3: 0.0 +/- 0.0 Bin 4: 14.0 +/- 13.0 Bin 5: 21.0 +/- 20.0 Over : 10.5 +/- 10.0
func NewH1DFromBins ¶
NewH1DFromBins returns a 1-dim histogram given a slice of 1-dim bins. It panics if the length of bins is < 1. It panics if the bins overlap.
func NewH1DFromEdges ¶
NewH1DFromEdges returns a 1-dim histogram given a slice of edges. The number of bins is thus len(edges)-1. It panics if the length of edges is <= 1. It panics if the edges are not sorted. It panics if there are duplicate edge values.
func SubH1D ¶ added in v0.27.0
SubH1D returns the bin-by-bin subtracted histogram of h1 and h2 assuming their statistical uncertainties are uncorrelated.
Example ¶
package main import ( "fmt" "math" "go-hep.org/x/hep/hbook" ) func main() { h1 := hbook.NewH1D(6, 0, 6) h1.Fill(-0.5, 1) h1.Fill(0, 1.5) h1.Fill(0.5, 1) h1.Fill(1.2, 1) h1.Fill(2.1, 2) h1.Fill(4.2, 1) h1.Fill(5.9, 1) h1.Fill(6, 0.5) h2 := hbook.NewH1D(6, 0, 6) h2.Fill(-0.5, 0.7) h2.Fill(0.2, 1) h2.Fill(0.7, 1.2) h2.Fill(1.5, 0.8) h2.Fill(2.2, 0.7) h2.Fill(4.3, 1.3) h2.Fill(5.2, 2) h2.Fill(6.8, 1) hsub := hbook.SubH1D(h1, h2) under := hsub.Binning.Outflows[0] fmt.Printf("Under: %.1f +/- %.1f\n", under.SumW(), math.Sqrt(under.SumW2())) for i, bin := range hsub.Binning.Bins { fmt.Printf("Bin %v: %.1f +/- %.1f\n", i, bin.SumW(), math.Sqrt(bin.SumW2())) } over := hsub.Binning.Outflows[1] fmt.Printf("Over : %.1f +/- %.1f\n", over.SumW(), math.Sqrt(over.SumW2())) }
Output: Under: 0.3 +/- 1.2 Bin 0: 0.3 +/- 2.4 Bin 1: 0.2 +/- 1.3 Bin 2: 1.3 +/- 2.1 Bin 3: 0.0 +/- 0.0 Bin 4: -0.3 +/- 1.6 Bin 5: -1.0 +/- 2.2 Over : -0.5 +/- 1.1
func (*H1D) Annotation ¶
func (h *H1D) Annotation() Annotation
Annotation returns the annotations attached to this histogram
func (*H1D) Bin ¶ added in v0.16.0
Bin returns the bin at coordinates (x) for this 1-dim histogram. Bin returns nil for under/over flow bins.
func (*H1D) Counts ¶ added in v0.28.0
Counts return a slice of Count, ignoring outerflow. The low and high error is equal to 0.5 * sqrt(sum(w^2)).
func (*H1D) EffEntries ¶
EffEntries returns the number of effective entries in this histogram
func (*H1D) Error ¶ added in v0.27.0
Error returns the error, defined as sqrt(sumW2), of the idx-th bin.
func (*H1D) FillN ¶ added in v0.22.0
FillN fills this histogram with the provided slices of xs and weight ws. if ws is nil, the histogram will be filled with entries of weight 1. Otherwise, FillN panics if the slices lengths differ.
func (*H1D) Integral ¶
Integral computes the integral of the histogram.
The number of parameters can be 0 or 2. If 0, overflows are included. If 2, the first parameter must be the lower bound of the range in which the integral is computed and the second one the upper range.
If the lower bound is math.Inf(-1) then the underflow bin is included. If the upper bound is math.Inf(+1) then the overflow bin is included.
Examples:
// integral of all in-range bins + overflows v := h.Integral() // integral of all in-range bins, underflow and overflow bins included. v := h.Integral(math.Inf(-1), math.Inf(+1)) // integrall of all in-range bins, overflow bin included v := h.Integral(h.Binning.XRange.Min, math.Inf(+1)) // integrall of all bins for which the lower edge is in [0.5, 5.5) v := h.Integral(0.5, 5.5)
func (*H1D) Len ¶
Len returns the number of bins for this histogram
Len implements gonum/plot/plotter.Valuer
func (*H1D) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler
func (*H1D) MarshalYODA ¶
MarshalYODA implements the YODAMarshaler interface.
func (*H1D) RioMarshal ¶
RioMarshal implements rio.RioMarshaler
func (*H1D) RioUnmarshal ¶
RioUnmarshal implements rio.RioUnmarshaler
func (*H1D) RioVersion ¶
RioVersion implements rio.RioStreamer
func (*H1D) SumW ¶
SumW returns the sum of weights in this histogram. Overflows are included in the computation.
func (*H1D) SumW2 ¶
SumW2 returns the sum of squared weights in this histogram. Overflows are included in the computation.
func (*H1D) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler
func (*H1D) UnmarshalYODA ¶
UnmarshalYODA implements the YODAUnmarshaler interface.
func (*H1D) Value ¶
Value returns the content of the idx-th bin.
Value implements gonum/plot/plotter.Valuer
func (*H1D) XStdDev ¶
XStdDev returns the standard deviation in X. Overflows are included in the computation.
func (*H1D) XStdErr ¶
XStdErr returns the standard error in X. Overflows are included in the computation.
type H2D ¶
type H2D struct { Binning Binning2D Ann Annotation }
H2D is a 2-dim histogram with weighted entries.
Example ¶
package main import ( "log" "go-hep.org/x/hep/hbook" "golang.org/x/exp/rand" "gonum.org/v1/gonum/mat" "gonum.org/v1/gonum/stat/distmv" ) func main() { h := hbook.NewH2D(100, -10, 10, 100, -10, 10) const npoints = 10000 dist, ok := distmv.NewNormal( []float64{0, 1}, mat.NewSymDense(2, []float64{4, 0, 0, 2}), rand.New(rand.NewSource(1234)), ) if !ok { log.Fatalf("error creating distmv.Normal") } v := make([]float64, 2) // Draw some random values from the standard // normal distribution. for i := 0; i < npoints; i++ { v = dist.Rand(v) h.Fill(v[0], v[1], 1) } // fill h with slices of values and their weights h.FillN( []float64{1, 2, 3}, // xs []float64{1, 2, 3}, // ys []float64{1, 1, 1}, // ws ) // fill h with slices of values. all weights are 1. h.FillN( []float64{1, 2, 3}, // xs []float64{1, 2, 3}, // ys nil, // ws ) }
Output:
func NewH2DFromEdges ¶
NewH2DFromEdges creates a new 2-dim histogram from slices of edges in x and y. The number of bins in x and y is thus len(edges)-1. It panics if the length of edges is <=1 (in any dimension.) It panics if the edges are not sorted (in any dimension.) It panics if there are duplicate edge values (in any dimension.)
func (*H2D) Annotation ¶
func (h *H2D) Annotation() Annotation
Annotation returns the annotations attached to this histogram
func (*H2D) Bin ¶ added in v0.16.0
Bin returns the bin at coordinates (x,y) for this 2-dim histogram. Bin returns nil for under/over flow bins.
func (*H2D) EffEntries ¶
EffEntries returns the number of effective entries in this histogram
func (*H2D) FillN ¶ added in v0.22.0
FillN fills this histogram with the provided slices (xs,ys) and weights ws. if ws is nil, the histogram will be filled with entries of weight 1. Otherwise, FillN panics if the slices lengths differ.
func (*H2D) GridXYZ ¶
func (h *H2D) GridXYZ() h2dGridXYZ
GridXYZ returns an anonymous struct value that implements gonum/plot/plotter.GridXYZ and is ready to plot.
func (*H2D) Integral ¶
Integral computes the integral of the histogram.
Overflows are included in the computation.
func (*H2D) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler
func (*H2D) MarshalYODA ¶
MarshalYODA implements the YODAMarshaler interface.
func (*H2D) SumW ¶
SumW returns the sum of weights in this histogram. Overflows are included in the computation.
func (*H2D) SumW2 ¶
SumW2 returns the sum of squared weights in this histogram. Overflows are included in the computation.
func (*H2D) SumWX ¶ added in v0.15.0
SumWX returns the 1st order weighted x moment Overflows are included in the computation.
func (*H2D) SumWX2 ¶ added in v0.15.0
SumWX2 returns the 2nd order weighted x moment Overflows are included in the computation.
func (*H2D) SumWXY ¶ added in v0.15.0
SumWXY returns the 1st order weighted x*y moment Overflows are included in the computation.
func (*H2D) SumWY ¶ added in v0.15.0
SumWY returns the 1st order weighted y moment Overflows are included in the computation.
func (*H2D) SumWY2 ¶ added in v0.15.0
SumWY2 returns the 2nd order weighted y moment Overflows are included in the computation.
func (*H2D) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler
func (*H2D) UnmarshalYODA ¶
UnmarshalYODA implements the YODAUnmarshaler interface.
func (*H2D) XStdDev ¶
XStdDev returns the standard deviation in X. Overflows are included in the computation.
func (*H2D) XStdErr ¶
XStdErr returns the standard error in X. Overflows are included in the computation.
func (*H2D) XVariance ¶
XVariance returns the variance in X. Overflows are included in the computation.
func (*H2D) YStdDev ¶
YStdDev returns the standard deviation in Y. Overflows are included in the computation.
type Histogram ¶
type Histogram interface { // Annotation returns the annotations attached to the // histogram. (e.g. name, title, ...) Annotation() Annotation // Name returns the name of this histogram Name() string // Rank returns the number of dimensions of this histogram. Rank() int // Entries returns the number of entries of this histogram. Entries() int64 }
Histogram is an n-dim histogram (with weighted entries)
type Object ¶
type Object interface { Annotation() Annotation Name() string }
Object is the general handle to any hbook data analysis object.
type P1D ¶
type P1D struct {
// contains filtered or unexported fields
}
P1D is a 1-dim profile histogram.
Example ¶
package main import ( "fmt" "log" "go-hep.org/x/hep/hbook" "golang.org/x/exp/rand" "gonum.org/v1/gonum/mat" "gonum.org/v1/gonum/stat/distmv" ) func main() { const npoints = 1000 p := hbook.NewP1D(100, -10, 10) dist, ok := distmv.NewNormal( []float64{0, 1}, mat.NewSymDense(2, []float64{4, 0, 0, 2}), rand.New(rand.NewSource(1234)), ) if !ok { log.Fatalf("error creating distmv.Normal") } v := make([]float64, 2) // Draw some random values from the standard // normal distribution. for i := 0; i < npoints; i++ { v = dist.Rand(v) p.Fill(v[0], v[1], 1) } fmt.Printf("mean: %v\n", p.XMean()) fmt.Printf("rms: %v\n", p.XRMS()) fmt.Printf("std-dev: %v\n", p.XStdDev()) fmt.Printf("std-err: %v\n", p.XStdErr()) }
Output: mean: 0.11198383683853215 rms: 2.0240892891977125 std-dev: 2.0220003848882695 std-err: 0.06394126645984038
func NewP1DFromH1D ¶
NewP1DFromH1D creates a 1-dim profile histogram from a 1-dim histogram's binning.
func (*P1D) Annotation ¶
func (p *P1D) Annotation() Annotation
Annotation returns the annotations attached to this profile histogram
func (*P1D) Binning ¶
func (p *P1D) Binning() *binningP1D
Binning returns the binning of this profile histogram
func (*P1D) EffEntries ¶
EffEntries returns the number of effective entries in this profile histogram
func (*P1D) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler
func (*P1D) MarshalYODA ¶
MarshalYODA implements the YODAMarshaler interface.
func (*P1D) SumW ¶
SumW returns the sum of weights in this profile histogram. Overflows are included in the computation.
func (*P1D) SumW2 ¶
SumW2 returns the sum of squared weights in this profile histogram. Overflows are included in the computation.
func (*P1D) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler
func (*P1D) UnmarshalYODA ¶
UnmarshalYODA implements the YODAUnmarshaler interface.
func (*P1D) XStdDev ¶
XStdDev returns the standard deviation in X. Overflows are included in the computation.
type Point2D ¶
type Point2D struct { X float64 // x-position Y float64 // y-position ErrX Range // error on x-position ErrY Range // error on y-position }
Point2D is a position in a 2-dim space
func (*Point2D) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler
func (*Point2D) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler
type Rand1D ¶ added in v0.28.4
type Rand1D struct {
// contains filtered or unexported fields
}
Rand1D represents a 1D distribution created from a hbook.H1D histogram.
Example ¶
package main import ( "fmt" "image/color" "log" "go-hep.org/x/hep/hbook" "go-hep.org/x/hep/hplot" "golang.org/x/exp/rand" "gonum.org/v1/gonum/stat/distuv" "gonum.org/v1/plot/vg" ) func main() { const N = 10000 var ( h1 = hbook.NewH1D(100, -10, 10) src = rand.New(rand.NewSource(1234)) rnd = distuv.Normal{ Mu: 0, Sigma: 2, Src: src, } ) for i := 0; i < N; i++ { h1.Fill(rnd.Rand(), 1) } var ( h2 = hbook.NewH1D(100, -10, 10) hr = hbook.NewRand1D(h1, rand.NewSource(5678)) ) for i := 0; i < N; i++ { h2.Fill(hr.Rand(), 1) } fmt.Printf( "h1: mean=%+8f std-dev=%+8f +/- %8f\n", h1.XMean(), h1.XStdDev(), h1.XStdErr(), ) fmt.Printf( "cdf(0)= %+1.1f\ncdf(1)= %+1.1f\n", rnd.CDF(0), rnd.CDF(1), ) fmt.Printf( "h2: mean=%+8f std-dev=%+8f +/- %8f\n", h2.XMean(), h2.XStdDev(), h2.XStdErr(), ) fmt.Printf( "cdf(0)= %+1.1f\ncdf(1)= %+1.1f\n", hr.CDF(0), hr.CDF(1), ) h1.Scale(1. / h1.Integral(h1.XMin(), h1.XMax())) h2.Scale(1. / h2.Integral(h2.XMin(), h2.XMax())) { rp := hplot.NewRatioPlot() rp.Ratio = 0.3 rp.Top.Title.Text = "Distributions" rp.Top.Y.Label.Text = "Y" hh1 := hplot.NewH1D(h1) hh1.FillColor = color.NRGBA{R: 255, A: 100} hh2 := hplot.NewH1D(h2) hh2.FillColor = color.NRGBA{B: 255, A: 100} rp.Top.Add( hh1, hh2, hplot.NewGrid(), ) rp.Top.Legend.Add("template", hh1) rp.Top.Legend.Add("monte-carlo", hh2) rp.Top.Legend.Top = true rp.Bottom.X.Label.Text = "X" rp.Bottom.Y.Label.Text = "Diff" rp.Bottom.Add( hplot.NewH1D(hbook.SubH1D(h1, h2)), hplot.NewGrid(), ) err := hplot.Save(rp, 15*vg.Centimeter, -1, "testdata/rand_h1d.png") if err != nil { log.Fatal(err) } } }
Output: h1: mean=+0.020436 std-dev=+1.992307 +/- 0.019923 cdf(0)= +0.5 cdf(1)= +0.7 h2: mean=-0.003631 std-dev=+2.008359 +/- 0.020084 cdf(0)= +0.5 cdf(1)= +0.7
func NewRand1D ¶ added in v0.28.4
NewRand1D creates a Rand1D from the provided histogram. If src is nil, the global x/exp/rand source will be used.
type Range ¶
Range is a 1-dim interval [Min, Max].
func (*Range) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler
func (*Range) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler
type S2D ¶
type S2D struct {
// contains filtered or unexported fields
}
S2D is a collection of 2-dim data points with errors.
Example ¶
package main import ( "fmt" "log" "go-hep.org/x/hep/hbook" ) func main() { s := hbook.NewS2D(hbook.Point2D{X: 1, Y: 1}, hbook.Point2D{X: 2, Y: 1.5}, hbook.Point2D{X: -1, Y: +2}) if s == nil { log.Fatal("nil pointer to S2D") } fmt.Printf("len=%d\n", s.Len()) s.Fill(hbook.Point2D{X: 10, Y: -10, ErrX: hbook.Range{Min: 5, Max: 5}, ErrY: hbook.Range{Min: 6, Max: 6}}) fmt.Printf("len=%d\n", s.Len()) fmt.Printf("pt[%d]=%+v\n", 3, s.Point(3)) }
Output: len=3 len=4 pt[3]={X:10 Y:-10 ErrX:{Min:5 Max:5} ErrY:{Min:6 Max:6}}
Example (NewS2DFrom) ¶
package main import ( "fmt" "log" "go-hep.org/x/hep/hbook" ) func main() { s := hbook.NewS2DFrom([]float64{1, 2, -1}, []float64{1, 1.5, 2}) if s == nil { log.Fatal("nil pointer to S2D") } fmt.Printf("len=%d\n", s.Len()) s.Fill(hbook.Point2D{X: 10, Y: -10, ErrX: hbook.Range{Min: 5, Max: 5}, ErrY: hbook.Range{Min: 6, Max: 6}}) fmt.Printf("len=%d\n", s.Len()) fmt.Printf("pt[%d]=%+v\n", 3, s.Point(3)) }
Output: len=3 len=4 pt[3]={X:10 Y:-10 ErrX:{Min:5 Max:5} ErrY:{Min:6 Max:6}}
Example (NewS2DFromH1D) ¶
package main import ( "fmt" "go-hep.org/x/hep/hbook" ) func main() { h := hbook.NewH1D(20, -4, +4) h.Fill(1.1, 2) h.Fill(2.1, 3) h.Fill(3.1, 1) h.Fill(1.1, 1) h.Fill(-2.1, 1) h.Fill(-3.1, 1) s := hbook.NewS2DFromH1D(h) s.Sort() for _, pt := range s.Points() { fmt.Printf("point=(%+3.2f +/- (%+3.2f,%+3.2f), %+3.2f +/- (%+3.2f, %+3.2f))\n", pt.X, pt.ErrX.Min, pt.ErrX.Max, pt.Y, pt.ErrY.Min, pt.ErrY.Max) } }
Output: point=(-3.80 +/- (+0.20,+0.20), +0.00 +/- (+0.00, +0.00)) point=(-3.40 +/- (+0.20,+0.20), +0.00 +/- (+0.00, +0.00)) point=(-3.00 +/- (+0.20,+0.20), +2.50 +/- (+2.50, +2.50)) point=(-2.60 +/- (+0.20,+0.20), +0.00 +/- (+0.00, +0.00)) point=(-2.20 +/- (+0.20,+0.20), +2.50 +/- (+2.50, +2.50)) point=(-1.80 +/- (+0.20,+0.20), +0.00 +/- (+0.00, +0.00)) point=(-1.40 +/- (+0.20,+0.20), +0.00 +/- (+0.00, +0.00)) point=(-1.00 +/- (+0.20,+0.20), +0.00 +/- (+0.00, +0.00)) point=(-0.60 +/- (+0.20,+0.20), +0.00 +/- (+0.00, +0.00)) point=(-0.20 +/- (+0.20,+0.20), +0.00 +/- (+0.00, +0.00)) point=(+0.20 +/- (+0.20,+0.20), +0.00 +/- (+0.00, +0.00)) point=(+0.60 +/- (+0.20,+0.20), +0.00 +/- (+0.00, +0.00)) point=(+1.00 +/- (+0.20,+0.20), +7.50 +/- (+5.59, +5.59)) point=(+1.40 +/- (+0.20,+0.20), +0.00 +/- (+0.00, +0.00)) point=(+1.80 +/- (+0.20,+0.20), +0.00 +/- (+0.00, +0.00)) point=(+2.20 +/- (+0.20,+0.20), +7.50 +/- (+7.50, +7.50)) point=(+2.60 +/- (+0.20,+0.20), +0.00 +/- (+0.00, +0.00)) point=(+3.00 +/- (+0.20,+0.20), +2.50 +/- (+2.50, +2.50)) point=(+3.40 +/- (+0.20,+0.20), +0.00 +/- (+0.00, +0.00)) point=(+3.80 +/- (+0.20,+0.20), +0.00 +/- (+0.00, +0.00))
func DivideH1D ¶
func DivideH1D(num, den *H1D, opts ...DivOptions) (*S2D, error)
DivideH1D divides 2 1D-histograms and returns a 2D scatter. DivideH1D returns an error if the binning of the 1D histograms are not compatible. If no DivOptions is passed, NaN raised during division are kept.
Example ¶
h1 := NewH1D(5, 0, 5) h1.Fill(0, 1) h1.Fill(1, 2) h1.Fill(2, 3) h1.Fill(3, 3) h1.Fill(4, 4) h2 := NewH1D(5, 0, 5) h2.Fill(0, 11) h2.Fill(1, 22) h2.Fill(2, 0) h2.Fill(3, 33) h2.Fill(4, 44) s0, err := DivideH1D(h1, h2) if err != nil { panic(err) } s1, err := DivideH1D(h1, h2, DivIgnoreNaNs()) if err != nil { panic(err) } s2, err := DivideH1D(h1, h2, DivReplaceNaNs(1.0)) if err != nil { panic(err) } fmt.Println("Default:") for i, pt := range s0.Points() { fmt.Printf("Point %v: %.2f + %.2f - %.2f\n", i, pt.Y, pt.ErrY.Min, pt.ErrY.Min) } fmt.Println("\nDivIgnoreNaNs:") for i, pt := range s1.Points() { fmt.Printf("Point %v: %.2f + %.2f - %.2f\n", i, pt.Y, pt.ErrY.Min, pt.ErrY.Min) } fmt.Println("\nDivReplaceNaNs with v=1.0:") for i, pt := range s2.Points() { fmt.Printf("Point %v: %.2f + %.2f - %.2f\n", i, pt.Y, pt.ErrY.Min, pt.ErrY.Min) }
Output: Default: Point 0: 0.09 + 0.13 - 0.13 Point 1: 0.09 + 0.13 - 0.13 Point 2: NaN + 0.00 - 0.00 Point 3: 0.09 + 0.13 - 0.13 Point 4: 0.09 + 0.13 - 0.13 DivIgnoreNaNs: Point 0: 0.09 + 0.13 - 0.13 Point 1: 0.09 + 0.13 - 0.13 Point 2: 0.09 + 0.13 - 0.13 Point 3: 0.09 + 0.13 - 0.13 DivReplaceNaNs with v=1.0: Point 0: 0.09 + 0.13 - 0.13 Point 1: 0.09 + 0.13 - 0.13 Point 2: 1.00 + 0.00 - 0.00 Point 3: 0.09 + 0.13 - 0.13 Point 4: 0.09 + 0.13 - 0.13
func NewS2D ¶
NewS2D creates a new 2-dim scatter with pts as an optional initial set of data points.
If n <= 0, the initial capacity is 0.
func NewS2DFrom ¶
NewS2DFrom creates a new 2-dim scatter with x,y data slices.
It panics if the lengths of the 2 slices don't match.
func NewS2DFromH1D ¶
NewS2DFromH1D creates a new 2-dim scatter from the given H1D. NewS2DFromH1D optionally takes a S2DOpts slice: only the first element is considered.
func NewS2DFromP1D ¶
NewS2DFromP1D creates a new 2-dim scatter from the given P1D. NewS2DFromP1D optionally takes a S2DOpts slice: only the first element is considered.
func (*S2D) Annotation ¶
func (s *S2D) Annotation() Annotation
Annotation returns the annotations attached to the scatter. (e.g. name, title, ...)
func (*S2D) DataRange ¶
DataRange returns the minimum and maximum x and y values, implementing the gonum/plot.DataRanger interface.
func (*S2D) Len ¶
Len returns the number of points in the scatter.
Len implements the gonum/plot/plotter.XYer interface.
func (*S2D) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler
func (*S2D) MarshalYODA ¶
MarshalYODA implements the YODAMarshaler interface.
func (*S2D) Points ¶
Points returns the points of the scatter.
Users may not modify the returned slice. Users may not rely on the stability of the indices as the slice of points may be re-sorted at any point in time.
func (*S2D) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler
func (*S2D) UnmarshalYODA ¶
UnmarshalYODA implements the YODAUnmarshaler interface.
func (*S2D) XError ¶
XError returns the two error values for X data.
XError implements the gonum/plot/plotter.XErrorer interface.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package ntup provides a way to create, open and iterate over n-tuple data.
|
Package ntup provides a way to create, open and iterate over n-tuple data. |
ntcsv
Package ntcsv provides a convenient access to CSV files as n-tuple data.
|
Package ntcsv provides a convenient access to CSV files as n-tuple data. |
ntroot
Package ntroot provides convenience functions to access ROOT trees as n-tuple data.
|
Package ntroot provides convenience functions to access ROOT trees as n-tuple data. |
Package rootcnv provides tools to convert ROOT histograms and graphs to go-hep/hbook ones.
|
Package rootcnv provides tools to convert ROOT histograms and graphs to go-hep/hbook ones. |
Package yodacnv provides tools to read/write YODA archive files.
|
Package yodacnv provides tools to read/write YODA archive files. |