Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LightSimtastic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
UHHDetLab
SiPM
LightSimtastic
Commits
c13ce820
Commit
c13ce820
authored
1 month ago
by
Antonello, Dr. Massimiliano
Browse files
Options
Downloads
Patches
Plain Diff
Formatting
parent
3064373b
No related branches found
No related tags found
No related merge requests found
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
AdditionalPDFs.py
+4
-27
4 additions, 27 deletions
AdditionalPDFs.py
LightSimtastic.py
+179
-518
179 additions, 518 deletions
LightSimtastic.py
with
183 additions
and
545 deletions
AdditionalPDFs.py
+
4
−
27
View file @
c13ce820
import
numpy
as
np
from
scipy.stats
import
rv_discrete
,
uniform
import
scipy.special
as
sc
from
scipy.stats._distn_infrastructure
import
(
rv_discrete
,
get_distribution_names
)
from
scipy.stats._distn_infrastructure
import
(
rv_discrete
,
get_distribution_names
)
class
gpd_gen
(
rv_discrete
):
def
_argcheck
(
self
,
mu
,
lbda
):
return
mu
>=
0.0
and
lbda
>=
0.0
and
lbda
<=
1.0
def
_rvs
(
self
,
mu
,
lbda
):
population
=
np
.
asarray
(
self
.
_random_state
.
poisson
(
mu
,
self
.
_size
)
)
population
=
np
.
asarray
(
self
.
_random_state
.
poisson
(
mu
,
self
.
_size
))
if
population
.
shape
==
():
population
=
population
.
reshape
(
-
1
)
offspring
=
population
.
copy
()
while
np
.
any
(
offspring
>
0
):
# probability dists are NOT ufuncs
# print("offspring", offspring)
offspring
[:]
=
[
self
.
_random_state
.
poisson
(
m
)
for
m
in
lbda
*
offspring
]
offspring
[:]
=
[
self
.
_random_state
.
poisson
(
m
)
for
m
in
lbda
*
offspring
]
population
+=
offspring
return
population
...
...
@@ -41,10 +32,8 @@ class gpd_gen(rv_discrete):
elif
n
==
2
:
return
(
mu
/
(
1
-
lbda
))
**
2
+
mu
/
(
1
-
lbda
)
**
3
gpoisson
=
gpd_gen
(
name
=
'
gpoisson
'
)
class
borel_gen
(
rv_discrete
):
def
_argcheck
(
self
,
mu
):
return
((
mu
>
0
)
&
(
mu
<
1
))
...
...
@@ -82,7 +71,6 @@ class borel_gen(rv_discrete):
return
_rnd
def
_stats
(
self
,
mu
):
_mu
=
1
/
(
1
-
mu
)
_var
=
mu
/
(
1
-
mu
)
**
3
...
...
@@ -93,15 +81,9 @@ class borel_gen(rv_discrete):
g2
=
scipy
.
_lib
.
_util
.
_lazywhere
(
mu_nonzero
,
(
tmp
,),
lambda
x
:
3
+
(
1
+
8
*
x
+
6
*
x
**
2
)
/
(
x
*
(
1
-
x
)),
np
.
inf
)
return
_mu
,
_var
,
g1
,
g2
borel
=
borel_gen
(
name
=
'
borel
'
)
class
erlang_gen
(
rv_discrete
):
def
_pdf
(
self
,
x
,
a
):
# gamma.pdf(x, a) = x**(a-1) * exp(-x) / gamma(a)
return
np
.
exp
(
self
.
_logpdf
(
x
,
a
))
...
...
@@ -109,11 +91,6 @@ class erlang_gen(rv_discrete):
def
_logpdf
(
self
,
k
,
mu
,
nu
):
return
sc
.
xlogy
(
a
-
1.0
,
x
)
-
x
-
sc
.
gammaln
(
a
)
# def _rvs(self, mu, nu, size=None, random_state=None):
# u = scipy.stats.uniform.rvs(loc=0, scale = 1, size=size)
# cum = np.cumsum([self._pmf(_k, mu, nu) for _k in range(0, 100)])
...
...
This diff is collapsed.
Click to expand it.
LightSimtastic.py
+
179
−
518
View file @
c13ce820
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment