gwexpy.histogram.HistogramDict
- class gwexpy.histogram.HistogramDict(*args: Any, **kwargs: Any)[source]
Bases:
DictMapMixin,HistogramBaseDict[Histogram]A dictionary of Histogram objects, indexed by label.
HistogramDict provides a convenient container for multiple histograms, allowing batch operations like fill, rebin, and statistical summaries.
- Parameters:
*args – Passed to OrderedDict and update.
**kwargs – Passed to OrderedDict and update.
Notes
Key mapping methods:
fill(*args, **kwargs)Fill each Histogram in the dict with new data.
rebin(*args, **kwargs)Rebin each Histogram in the dict.
mean(*args, **kwargs)Compute weighted mean of each Histogram.
std(*args, **kwargs)Compute weighted standard deviation of each Histogram.
Examples
>>> from gwexpy.histogram import Histogram, HistogramDict >>> h = Histogram([1, 2], [0, 1, 2]) >>> hd = HistogramDict() >>> hd['H1'] = h >>> hd HistogramDict([('H1', <Histogram (nbins=2, unit=)>)])
Methods
__init__(*args, **kwargs)clear()copy()Return a deep copy of the histogram mapping.
fill(*args, **kwargs)Fill each Histogram in the dict with new data.
fromkeys(iterable[, value])Create a new ordered dictionary with keys from iterable and values set to value.
get(key[, default])Return the value for key if key is in the dictionary, else default.
integral(*args, **kwargs)Compute integral of each Histogram in the dict.
itemskeysmax(*args, **kwargs)Compute upper edge of last non-zero bin for each Histogram.
mean(*args, **kwargs)Compute weighted mean of each Histogram.
median(*args, **kwargs)Compute median of each Histogram.
min(*args, **kwargs)Compute lower edge of first non-zero bin for each Histogram.
move_to_end(key[, last])Move an existing element to the end (or beginning if last is false).
plot([label, method, figsize])Plot data.
plot_all(*args, **kwargs)Alias for plot().
pop(key[,default])If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem([last])Remove and return a (key, value) pair from the dictionary.
quantile(*args, **kwargs)Compute quantile of each Histogram.
read(source, *args, **kwargs)Read data into a HistogramDict.
rebin(*args, **kwargs)Rebin each Histogram in the dict.
setdefault(key[, default])Return the stored histogram for
keyor insertdefault.std(*args, **kwargs)Compute weighted standard deviation of each Histogram.
to_density(*args, **kwargs)Convert each Histogram to density representation.
updatevaluesvar(*args, **kwargs)Compute weighted variance of each Histogram.
write(target, *args, **kwargs)Write dict to file (HDF5, ROOT, etc.).
- EntryClass
alias of
Histogram
- rebin(*args, **kwargs)
Rebin each Histogram in the dict. Returns a HistogramDict.
- fill(*args, **kwargs)
Fill each Histogram in the dict with new data.
- integral(*args, **kwargs)
Compute integral of each Histogram in the dict. Returns a dict of Quantities.
- to_density(*args, **kwargs)
Convert each Histogram to density representation. Returns a dict of Quantities.
- mean(*args, **kwargs)
Compute weighted mean of each Histogram. Returns a dict of Quantities.
- var(*args, **kwargs)
Compute weighted variance of each Histogram. Returns a dict of Quantities.
- std(*args, **kwargs)
Compute weighted standard deviation of each Histogram. Returns a dict of Quantities.
- median(*args, **kwargs)
Compute median of each Histogram. Returns a dict of Quantities.
- quantile(*args, **kwargs)
Compute quantile of each Histogram. Returns a dict of Quantities.
- min(*args, **kwargs)
Compute lower edge of first non-zero bin for each Histogram. Returns a dict of Quantities.
- max(*args, **kwargs)
Compute upper edge of last non-zero bin for each Histogram. Returns a dict of Quantities.