Struct net_ensembles::sampling::HeatmapUsizeMean [−][src]
pub struct HeatmapUsizeMean<HistX, HistY> { /* fields omitted */ }
Expand description
Heatmap with mean of y-axis
- stores heatmap in row-major order: the rows of the heatmap are contiguous, and the columns are strided
- enables you to quickly create a heatmap
- you can create gnuplot scripts to plot the heatmap
- for each x-axis bin, the y-axis mean is calculated
- …
Difference to HeatmapU
HeatmapU
does not contain the averages for th y-axis, but can be transposed and also used for Y-Histograms which take types which do not implement AsPrimitive
Implementations
Internal HeatmapU
Create a heatmap
- creates new instance
hist_x
defines the bins along the x-axishist_y
defines the bins along the y-axis
pub fn count_inside_heatmap<X, Y, A, B>(
&mut self,
x_val: A,
y_val: B
) -> Result<(usize, usize), HeatmapError> where
A: Borrow<X>,
B: Borrow<Y>,
Y: AsPrimitive<f64>,
HistX: HistogramVal<X>,
HistY: HistogramVal<Y>,
pub fn count_inside_heatmap<X, Y, A, B>(
&mut self,
x_val: A,
y_val: B
) -> Result<(usize, usize), HeatmapError> where
A: Borrow<X>,
B: Borrow<Y>,
Y: AsPrimitive<f64>,
HistX: HistogramVal<X>,
HistY: HistogramVal<Y>,
Update Heatmap
- similar to
count
ofHeatmapU
This time, however, any value that is out of bounds will be ignored for the calculation of the mean of the y-axis, meaning also values which correspond to a valid x-bin will be ignored, if their y-value is not inside the Y Histogram
pub fn count<X, Y, A, B>(
&mut self,
x_val: A,
y_val: B
) -> Result<(usize, usize), HeatmapError> where
A: Borrow<X>,
B: Borrow<Y>,
Y: AsPrimitive<f64>,
HistX: HistogramVal<X>,
HistY: HistogramVal<Y>,
pub fn count<X, Y, A, B>(
&mut self,
x_val: A,
y_val: B
) -> Result<(usize, usize), HeatmapError> where
A: Borrow<X>,
B: Borrow<Y>,
Y: AsPrimitive<f64>,
HistX: HistogramVal<X>,
HistY: HistogramVal<Y>,
Update heatmap
- Corresponds to
count
ofHeatmapU
The difference is, that the mean of the y-axis is updated as long as y_val
is finite
and x_val
is in bounds (because the mean is calculated for each bin in the x direction
separately)
Internal slice for mean
- The mean is calculated from this slice
- The mean corresponds to the bins of the x-axis
- you can also access the estimated error of the mean here
Iterate over the calculated mean
- iterates over the means
- The mean corresponds to the bins of the x-axis
- if a bin on the x-axis has no entries, the corresponding
mean will be
f64::NAN
Get a mean vector
- The entries are the means corresponds to the bins of the x-axis
- if a bin on the x-axis has no entries, the corresponding
mean will be
f64::NAN
Note
- If you want to iterate over the mean values, use
mean_iter
instead - If you require error information, take a look at
mean_slice
returns (column wise) normalized heatmap
-
returns normalized heatmap as
HeatmapF64Mean
-
Heatmap vector
self.heatmap_normalized().heatmap()
contains only 0.0, if nothing was in the heatmap -
otherwise the sum of each column (fixed x) will be 1.0 (within numerical errors), if it contained at least one hit. If it did not, the column will only consist of 0.0
-
otherwise the sum of this Vector is 1.0
For the calculation of the mean, each count
will have a weight of 1
Create a gnuplot script to plot your heatmap
writer
: The gnuplot script will be written to thisgnuplot_output_name
: how shall the file, created by executing gnuplot, be called? Ending of file will be set automatically
Note
- This is the same as calling
gnuplot
with defaultGnuplotSettings
and defaultGnuplotPointSettings
- The default axis are the bin indices, which, e.g, means they always begin at 0. You have to set the axis via the GnuplotSettings
Create a gnuplot script to plot your heatmap
This function writes a file, that can be plotted via the terminal via gnuplot
gnuplot gnuplot_file
Parameter:
writer
: writer gnuplot script will be written tognuplot_output_name
: how shall the file, created by executing gnuplot, be called? Ending of file will be set automaticallysettings
: Here you can set the axis, choose between terminals and more. I recommend that you take a look at GnuplotSettingspoint_color
: the mean (in y-direction) will be plotted as points in the heatmap. Here you can choose the point color
Note
- The default axis are the bin indices, which, e.g, means they always begin at 0. You have to set the axis via the GnuplotSettings
Trait Implementations
impl<HistWidth, HistHeight> From<HeatmapUsizeMean<HistWidth, HistHeight>> for HeatmapUsize<HistWidth, HistHeight>
impl<HistWidth, HistHeight> From<HeatmapUsizeMean<HistWidth, HistHeight>> for HeatmapUsize<HistWidth, HistHeight>
pub fn from(
heatmap_mean: HeatmapUsizeMean<HistWidth, HistHeight>
) -> HeatmapUsize<HistWidth, HistHeight>
pub fn from(
heatmap_mean: HeatmapUsizeMean<HistWidth, HistHeight>
) -> HeatmapUsize<HistWidth, HistHeight>
Performs the conversion.
Auto Trait Implementations
impl<HistX, HistY> RefUnwindSafe for HeatmapUsizeMean<HistX, HistY> where
HistX: RefUnwindSafe,
HistY: RefUnwindSafe,
impl<HistX, HistY> Send for HeatmapUsizeMean<HistX, HistY> where
HistX: Send,
HistY: Send,
impl<HistX, HistY> Sync for HeatmapUsizeMean<HistX, HistY> where
HistX: Sync,
HistY: Sync,
impl<HistX, HistY> Unpin for HeatmapUsizeMean<HistX, HistY> where
HistX: Unpin,
HistY: Unpin,
impl<HistX, HistY> UnwindSafe for HeatmapUsizeMean<HistX, HistY> where
HistX: UnwindSafe,
HistY: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn cast_trunc(self) -> T
pub fn cast_trunc(self) -> T
Cast to integer, truncating Read more
pub fn cast_nearest(self) -> T
pub fn cast_nearest(self) -> T
Cast to the nearest integer Read more
pub fn cast_floor(self) -> T
pub fn cast_floor(self) -> T
Cast the floor to an integer Read more
pub fn try_cast_trunc(self) -> Result<T, Error>
pub fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
pub fn try_cast_nearest(self) -> Result<T, Error>
pub fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
pub fn try_cast_floor(self) -> Result<T, Error>
pub fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
pub fn try_cast_ceil(self) -> Result<T, Error>
pub fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more