mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-04-30 12:00:39 +00:00
8c7017a99d
- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5" - Update version.txt from 4.29 → .30 (automated by Makefile)
1.1 KiB
1.1 KiB
obistats Package — Semantic Overview
The *obistats* Go package provides lightweight, type-generic statistical utilities for numerical data.
Core Functions
-
Median[T Number](data []T) float64
Computes the median of a slice. Internally copies and sorts input data to avoid mutation, handling both even- and odd-length slices correctly. Returns0for empty input. -
Mean[T Number](data []T) float64
Calculates the arithmetic mean by summing all elements (converted tofloat64) and dividing by count.
Type Constraints
- Uses Go generics (
constraints.Float | constraints.Integer), enabling use withint,float32,float64, etc.
Design Notes
- Non-mutating (
Medianworks on a copy). - Simple, efficient implementations—no external dependencies beyond
golang.org/x/exp/constraintsandslices. - Focused on central tendency measures only—no variance, std dev, or distribution stats.
Use Case
Ideal for small-to-medium numerical datasets where minimal dependencies and clarity are prioritized over advanced statistics.