keflavich / imf

Simple tools to work with the Initial Mass Function
MIT License
44 stars 17 forks source link

implement the percentile point functions (inverse of cdf) #15

Closed segasai closed 4 years ago

segasai commented 4 years ago

Hi,

I've implemented the PPF (percentile point function; inverse of CDF) for all the distributions. They are useful for example for sampling (i.e. nested sampling where you need to convert your prior into uniform from zero to one). I've also added tests that they work as inverse as CDFs.

Sergey

segasai commented 4 years ago

Let me also push one more commit before merging, which ensures that nan's are returned when input is outside 0,1 range

segasai commented 4 years ago

I think I've concluded my push request now. (edited). I've added a couple of other commits with tests. One compares means/stddevs with integrals of pdf, and another compares the PDF integrals with the CDF values