# Retrieve statistic data from PPSD

**URL:** https://discourse.obspy.org/t/retrieve-statistic-data-from-ppsd/1771
**Category:** Uncategorized
**Created:** [August 18, 2023, 12:04pm UTC](https://discourse.obspy.org/t/retrieve-statistic-data-from-ppsd/1771 "2023-08-18T12:04:35Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Isabel](https://discourse.obspy.org/user_avatar/discourse.obspy.org/isabel/32/915_2.png) [@Isabel](https://discourse.obspy.org/u/Isabel)
#### Post date: [August 18, 2023, 12:04pm UTC](https://discourse.obspy.org/t/retrieve-statistic-data-from-ppsd/1771/1 "2023-08-18T12:04:35Z")

</div>

Is it possible to retrieve the PDF-result (also the variance, not only mean) for specific periods or do I have to retrieve the PSD values and do the statistic analysis in post-processing?

---

<div class="post-metadata">

### Author: ![megies](https://discourse.obspy.org/user_avatar/discourse.obspy.org/megies/32/9_2.png) [@megies](https://discourse.obspy.org/u/megies)
#### Post date: [August 18, 2023, 12:47pm UTC](https://discourse.obspy.org/t/retrieve-statistic-data-from-ppsd/1771/2 "2023-08-18T12:47:50Z")

</div>

You mean the data from the classic PQLX-style histogram plot? Sure. After you make a plot or manually force a histogram stack (via `ppsd.calculate_histogram()`) you can access the values as `ppsd.current_histogram` and you can access the information on the x-/y-coordinates of the bins (centers and edges) as:

- ppsd.db\_bin\_centers
- ppsd.db\_bin\_edges
- ppsd.period\_bin\_centers
- ppsd.period\_bin\_left\_edges
- ppsd.period\_bin\_right\_edges

Edit: As for further statistics.. I think only extracting percentiles is supported, if you need further statistics, you can easily do them on the histogram data with numpy methods, e.g. `np.var(ppsd.current_histogram, axis=1)` and then convert to actual values using the bin widths.

---

<div class="post-metadata">

### Author: ![Isabel](https://discourse.obspy.org/user_avatar/discourse.obspy.org/isabel/32/915_2.png) [@Isabel](https://discourse.obspy.org/u/Isabel)
#### Post date: [August 18, 2023, 2:18pm UTC](https://discourse.obspy.org/t/retrieve-statistic-data-from-ppsd/1771/3 "2023-08-18T14:18:34Z")

</div>

> [@megies](#):
>
> : As for further statistics… I think only extracting percentiles is supported, if you need further statistics, you can easily do them on the histogram data with numpy methods, e.g. `np.var(ppsd.current_histogram, axis=1)` and then convert to actual values using the bin width

Thanks. That was exactly my question!
