/misc.py (6ea8dc8f50a656c48f786d5a00bd6398276c9741) (2004 bytes) (mode 100644) (type blob)
#!/usr/bin/env python
# coding: utf-8
import numpy as np
from . import sball # for Isocurves
def isolevels_2d(pdf, weighting_pdf_const, r_levels, from_top=None):
"""
weighting_pdf_const = 1 / (xmax - xmin) / (ymax - ymin)
"""
s_ball = sball.Sball(2) # nvar=2
p_levels = []
for r in r_levels:
p_levels.append(1 - s_ball.get_pf(r))
return isolevels(pdf, weighting_pdf_const, p_levels, from_top)
def isolevels(pdf, weighting_pdf_const, p_levels, from_top=None):
"""
weighting_pdf_const = 1 / (xmax - xmin) / (ymax - ymin)
"""
#č třeba P prostor doopravdy zlobí, takže zkusím nějak tak
if from_top is None:
weights = pdf / weighting_pdf_const
p_all = np.sum(weights) / len(pdf)
#č prečo víme, že celková pravděpodobnost může bejt nekoněčně velká
if p_all <= 1:
from_top = True
else:
from_top = False
max_pdf = np.max(pdf)
pdf_levels = []
if from_top:
# descending
sorted_pdf = np.flip(np.sort(pdf))
p_cumsum = np.cumsum(sorted_pdf) / weighting_pdf_const / len(pdf)
for p in p_levels:
# little bit tricky, didn't find numpy method for this
mask = p_cumsum <= p
level_down_bound = np.max(sorted_pdf[~mask], initial=0)
level_up_bound = np.min(sorted_pdf[mask], initial=max_pdf)
pdf_levels.append((level_down_bound + level_up_bound) / 2)
else: # from bottom
sorted_pdf = np.sort(pdf)
p_cumsum = np.cumsum(sorted_pdf) / weighting_pdf_const / len(pdf)
for p in p_levels:
# little bit tricky, didn't find numpy method for this
mask = p_cumsum <= 1-p
level_down_bound = np.max(sorted_pdf[mask], initial=0)
level_up_bound = np.min(sorted_pdf[~mask], initial=max_pdf)
pdf_levels.append((level_down_bound + level_up_bound) / 2)
return pdf_levels
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
26998 |
eb786c41e6db077a9fd4999e8bba97eed20d2f50 |
IS_stat.py |
100644 |
blob |
6 |
0916b75b752887809bac2330f3de246c42c245cd |
__init__.py |
100644 |
blob |
73368 |
3d245b8568158ac63c80fa0847631776a140db0f |
blackbox.py |
100644 |
blob |
11243 |
10c424c2ce5e8cdd0da97a5aba74c54d1ca71e0d |
candybox.py |
100644 |
blob |
38136 |
d757b85ac75f3e00642d6bd40a280ce772932c0f |
convex_hull.py |
100644 |
blob |
84248 |
25ee32affeb85c8d759a7b090b6d568b2095350d |
dicebox.py |
100644 |
blob |
36930 |
a775d1114bc205bbd1da0a10879297283cca0d4c |
estimation.py |
100644 |
blob |
34394 |
3f0ab9294a9352a071de18553aa687c2a9e6917a |
f_models.py |
100644 |
blob |
31540 |
a577087003a885ca7499d1ee9451e703fa9d2d36 |
g_models.py |
100644 |
blob |
42820 |
1092b3b9f05b11d0c53b3aa63df2460ec355085d |
gl_plot.py |
100644 |
blob |
2718 |
5d721d117448dbb96c554ea8f0e4651ffe9ac457 |
gp_plot.py |
100644 |
blob |
29393 |
96162a5d181b8307507ba2f44bafe984aa939163 |
lukiskon.py |
100644 |
blob |
12867 |
5bc331e3ef3a8a6bfeb7ebe5e1ae4f4c58e8cc06 |
mart.py |
100644 |
blob |
7983 |
75455aa723db8bab291dcf941b92b9ffdba3aef1 |
mart3d.py |
100644 |
blob |
1364 |
944337088f060aabe029b611c27145bb28de4b38 |
maxes.py |
100644 |
blob |
5356 |
faac09f784e48599ff9a67e607a8e8a990b05d80 |
mgraph.py |
100644 |
blob |
2004 |
6ea8dc8f50a656c48f786d5a00bd6398276c9741 |
misc.py |
100644 |
blob |
3336 |
ce5171f10153dc0151d824369161d65fcbbda83b |
mplot.py |
100644 |
blob |
1450 |
4849f178b588e252b8c7f6a940d2d82ad35f6914 |
plot.py |
100644 |
blob |
2807 |
1feb1d43e90e027f35bbd0a6730ab18501cef63a |
plotly_plot.py |
100644 |
blob |
141713 |
1fcf59b8b219edc53872c081e38727fb3f2c7754 |
qt_plot.py |
100644 |
blob |
8206 |
5981023118262109fca8309d9b313b521a25f88f |
reader.py |
100644 |
blob |
4284 |
a0e0b4e593204ff6254f23a67652804db07800a6 |
samplebox.py |
100644 |
blob |
6396 |
8dee4de0d2afced5c7a5c3e91684a9e139b5aa00 |
sball.py |
100644 |
blob |
5553 |
bac994ae58f1df80c7f8b3f33955af5402f5a4f3 |
sball_old.py |
100644 |
blob |
2605 |
0034d2e3f14c056541888235e59127e8f28b131d |
schemes.py |
100644 |
blob |
21623 |
281aef80556b8d22842b8659f6f0b7dab0ad71af |
shapeshare.py |
100644 |
blob |
48537 |
10f90c5614e9a04f0cd9f78e75f0db4a6becb3e4 |
simplex.py |
100644 |
blob |
13090 |
2b9681eed730ecfadc6c61b234d2fb19db95d87d |
spring.py |
100644 |
blob |
10940 |
6965eabdb5599bb22773e7fef1178f9b2bb51efe |
stm_df.py |
100644 |
blob |
3433 |
3063a1b6a132cbb5440ab95f1b6af1f1ff4266ac |
testcases_2D.py |
100644 |
blob |
2465 |
d829bff1dd721bdb8bbbed9a53db73efac471dac |
welford.py |
100644 |
blob |
22048 |
4a6014ca5255aa96059ff9ed5a7e29df98d26ffc |
whitebox.py |
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/iam-git/WellMet
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/iam-git/WellMet
Clone this repository using git:
git clone git://git.rocketgit.com/user/iam-git/WellMet
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main