Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RobTillaart committed Jan 3, 2024
1 parent 5f2b1fa commit 02bf759
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).


## [0.3.6] - 2024-01-03
- add **float saturation()**
- fix examples
- minor edits

Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Length should be less than 65534.
- **~Histogram16()** destructor.


#### maxBucket
#### MaxBucket

Default the maxBucket size is defined as 255 (8 bit), 65535 (16 bit) or
2147483647 (32 bit) depending on class used.
Expand Down Expand Up @@ -190,6 +190,18 @@ Note **PDF()** is a continuous function and therefore not applicable in a discre
- https://en.wikipedia.org/wiki/Probability_density_function PDF()


#### Experimental

An additional helper function.

- **float saturation()** returns the **count()** / nr of bins.
Is an indicator of how "filled" the histogram is.

Might need to calculate the average level.

Note: **findMax()** gives an indication for the topmost individual bucket.


## Future


Expand Down
12 changes: 12 additions & 0 deletions histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,18 @@ uint16_t Histogram::countBelow(const int32_t level)
}



///////////////////////////////////////////////////
//
// experimental
//
// use with care
float Histogram::saturation()
{
return (1.0 * _count) / _length;
}


// experimental use with care
int32_t Histogram::getMaxBucket()
{
Expand Down
6 changes: 6 additions & 0 deletions histogram.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ class Histogram
uint16_t countBelow(const int32_t level);


///////////////////////////////////////////////////
//
// experimental
//
float saturation();

// use with care
int32_t getMaxBucket();
void setMaxBucket(int32_t value);
Expand Down

0 comments on commit 02bf759

Please sign in to comment.