API documentation
making_histograms
generate_annotated_hists(*xs: Sequence[float], max_bins: int = 50, num_bins: Optional[int] = None, min_value: Optional[float] = None, max_value: Optional[float] = None, annotations: Annotations = Annotations(0), **named_xs: Sequence[float]) -> Generator[List[str], None, None]
Yields a histogram with annotations for each set of samples
Depending on the style, it yields a header first
It will ensure that all histograms are aligned (have the same number of bins and ranges).
:param xs: The sets of samples to make histograms from. :param max_bins: The maximum number of bins to use. Determines the maximum length of the histogram string. :param num_bins: The number of bins to use. If None, it will be computed from the data. :param min_value: Where the histogram should start. If None, it will be computed from the data. :param max_value: Where the histogram should end. If None, it will be computed from the data. :param annotations: The annotations to add to each histogram such as mean/std/min/max/n. :param named_xs: The sets of values to make histograms from. The keys are used as names. :raises ValueError: If num_bins > max_bins or min_value > max_value or both xs and named_xs were specified.
Source code in src/data_samples_printer/making_histograms.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
|
generate_hists(*xs: Sequence[float], max_bins: int = 50, num_bins: Optional[int] = None, min_value: Optional[float] = None, max_value: Optional[float] = None) -> Generator[str, None, None]
Yields histogram strings for each set of samples.
It will ensure that all histograms are aligned (have the same number of bins and ranges).
:param xs: The sets of samples to make histograms from. :param max_bins: The maximum number of bins to use. Determines the maximum length of the yielded strings. :param num_bins: The number of bins to use. If None, it will be computed from the data. :param min_value: Where the histogram should start. If None, it will be computed from the data. :param max_value: Where the histogram should end. If None, it will be computed from the data. :raises ValueError: If num_bins > max_bins or min_value > max_value.
Source code in src/data_samples_printer/making_histograms.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
make_header(annotations: Annotations, add_names_column: bool) -> List[str]
Makes a header with the given annotations to print above annotated histograms.
Source code in src/data_samples_printer/making_histograms.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
make_min_max_footer(*xs: Sequence[float], width: int, min_value: Optional[float] = None, max_value: Optional[float] = None, **named_xs: Sequence[float]) -> str
Makes a footer with the min and max values of the given samples.
To be printed below and unannotated histogram.
:param xs: The sets of samples to make histograms from. :param width: The width of the histogram in chars. :param min_value: Where the histogram should start. If None, it will be computed from the data. :param max_value: Where the histogram should end. If None, it will be computed from the data.
Source code in src/data_samples_printer/making_histograms.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
|