-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Main API change for v0.11 * fix append! * kill second parameter in Hists types * make Makie plotting recipe more robust * Update makie_plotting.jl * update tagbot
- Loading branch information
Showing
23 changed files
with
783 additions
and
792 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Quick Start | ||
|
||
This section describes the most important surface level API: creating histogram. | ||
```@contents | ||
Pages = ["start.md"] | ||
``` | ||
|
||
```@setup fh | ||
using FHist | ||
``` | ||
|
||
There are two possible ways to make a histogram: | ||
- make an empty histogram to be filled later (via [`atomic_push!`](@ref)) | ||
- make a filled histogram given data | ||
|
||
We call the first one "constructor like" use case and the second one "fit like" use case (as in "fit | ||
data to a histogram"). | ||
|
||
Each of the two options imply a set of options that can go with them. The two sets of options | ||
have some overlap, e.g. `binedges`, `overflow`; but there are also options only make sense of one of | ||
them, e.g., `nbins` only works in the "fit like" use case. | ||
|
||
## Make an empty histogram | ||
|
||
The minimal information needed is `binedges`: | ||
```@example fh | ||
h1 = Hist1D(; binedges = 1:10) | ||
``` | ||
|
||
You can provide more if you have them available (for example, when you're creating | ||
histogram from another data source): | ||
|
||
```@example fh | ||
h2 = Hist1D(; binedges = 1:10, bincounts = collect(1:9)) | ||
``` | ||
|
||
!!! note "Default / infer strategy for empty histogram" | ||
|
||
To see the full list of keyword arguments as well as how they are inferred, see [`Hist1D`](@ref). To | ||
summarize in words: | ||
|
||
1. `counttype` defaults to `Float64` because `maxintfloat(Float64) ≈ 9e15` | ||
2. `binedges` must be provided by user | ||
3. `bincounts` defaults to all zero, with `eltype == counttype` and appropriate shape | ||
4. `sumw2` defaults to all zero with appropriate shape | ||
5. `nentries` defaults to 0 | ||
6. `overflow` defaults to `false` | ||
|
||
|
||
|
||
## Make a filled histogram given data | ||
|
||
The minimal information needed is `data`, which is a __positional__ argument: | ||
```@example fh | ||
h3 = Hist1D(randn(2000)) | ||
``` | ||
|
||
You can provide more (in keyword arguments) if you want granular control over the binning behavior (e.g. number of bins, | ||
the exact bins to use): | ||
|
||
```@example fh | ||
h4 = Hist1D(randn(2000); nbins=4) | ||
``` | ||
|
||
!!! warning | ||
`nbins` is not strictly enforced, use `binedges` if you need exact control. | ||
|
||
We can do non-uniform binning for example: | ||
```@example fh | ||
h5 = Hist1D(randn(2000); binedges = [0, 0.5, 0.8, 0.9, 1.0]) | ||
``` | ||
|
||
!!! note "Default / infer strategy for filled histogram with data" | ||
|
||
To see the full list of keyword arguments as well as how they are inferred, see [`Hist1D`](@ref). To | ||
summarize in words: | ||
|
||
1. data `array` must be provided by the user | ||
2. `counttype` defaults to `Float64` because `maxintfloat(Float64) ≈ 9e15` | ||
3. `nbins` defaults to sturges approximation | ||
4. `binedges` defaults to uniform binning given `nbins` | ||
5. `weights` defaults to all unity (i.e. not weighted) | ||
6. `overflow` defaults `false` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## Basic attributes | ||
|
||
- [`binedges`](@ref): Get the bin edges of the histogram, for 1D histogram, it returns just a vector. For others, it returns a tuple of vectors. If you need a tuple of vectors, use h.binedges at your own risk. | ||
- [`bincounts`](@ref): Get the bin counts (weights) of the histogram. | ||
- [`sumw2`](@ref): Get the sum of weights squared of the histogram, it has the same shape as `bincounts(h)`. | ||
- [`nentries`](@ref): Get the number of times a histogram is filled (`push!`ed) | ||
|
||
## Derived attributes | ||
- [`bincenters`](@ref): Get the bin centers of the histogram, for 1D histogram, it returns just a vector. For others, it returns a tuple of vectors. | ||
- [`binerrors`](@ref): Get the error of each bin of the histogram. By default it calls `sqrt()` on | ||
each entry of `sumw2` as an approximation. | ||
- `mean`, `std`, `median`, `quantile`, weighted by histogram `bincounts()`. | ||
```@docs | ||
integral | ||
``` | ||
|
||
## Manipulating histogram | ||
|
||
This section includes adding data to histogram, and other operations that return a histogram (may | ||
with reduced dimensionality) | ||
```@docs | ||
atomic_push! | ||
cumulative | ||
rebin | ||
restrict | ||
profile | ||
project | ||
``` |
Oops, something went wrong.
ced8d83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
ced8d83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/103452
Tip: Release Notes
Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.
To add them here just re-invoke and the PR will be updated.
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:
ced8d83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
Release notes:
Breaking changes
Hist1D(; <kwargs...>)
is used for creating empty histograms, andHist1D(<args>...; ...)
is used for one-shot histogram makingced8d83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request updated: JuliaRegistries/General/103452
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:
ced8d83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
Release notes:
Breaking changes
Hist1D(; <kwargs...>)
is used for creating empty histograms, andHist1D(<args>...; ...)
is used for one-shot histogram makingImprovements
appened!()
ced8d83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request updated: JuliaRegistries/General/103452
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: