Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
b5e93218
Commit
b5e93218
authored
Mar 31, 2021
by
Martin Reinecke
Browse files
Merge branch 'log_invgamma' into 'NIFTy_7'
Log invgamma See merge request
!614
parents
1db37c41
a1dd5ebb
Pipeline
#97899
passed with stages
in 24 minutes and 57 seconds
Changes
4
Pipelines
10
Hide whitespace changes
Inline
Side-by-side
src/__init__.py
View file @
b5e93218
...
...
@@ -77,7 +77,8 @@ from .sugar import *
from
.plot
import
Plot
from
.library.special_distributions
import
InverseGammaOperator
,
UniformOperator
,
LaplaceOperator
from
.library.special_distributions
import
InverseGammaOperator
,
\
UniformOperator
,
LaplaceOperator
,
LogInverseGammaOperator
from
.library.los_response
import
LOSResponse
from
.library.dynamic_operator
import
(
dynamic_operator
,
dynamic_lightcone_operator
)
...
...
src/library/special_distributions.py
View file @
b5e93218
...
...
@@ -124,6 +124,20 @@ def InverseGammaOperator(domain, alpha, q, delta=1e-2):
return
makeOp
(
q
)
@
op
def
LogInverseGammaOperator
(
domain
,
alpha
,
q
,
delta
=
1e-2
):
"""Transform a standard normal into the log of an inverse gamma distribution.
See also
--------
:class:`InverseGammaOperator`
"""
op
=
_InterpolationOperator
(
domain
,
lambda
x
:
np
.
log
(
invgamma
.
ppf
(
norm
.
_cdf
(
x
),
float
(
alpha
))),
-
8.2
,
8.2
,
delta
)
if
np
.
isscalar
(
q
):
return
op
.
scale
(
q
)
return
makeOp
(
q
)
@
op
class
UniformOperator
(
Operator
):
"""Transform a standard normal into a uniform distribution.
...
...
src/pointwise.py
View file @
b5e93218
...
...
@@ -11,7 +11,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright(C) 2020 Max-Planck-Society
# Copyright(C) 2020
-2021
Max-Planck-Society
# Author: Martin Reinecke
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
...
...
@@ -124,7 +124,7 @@ def exponentiate(v, base):
def
_exponentiate_helper
(
v
,
base
):
tmp
=
np
.
power
(
base
,
v
)
return
(
tmp
,
np
.
log
(
base
)
*
tmp
)
return
(
tmp
,
np
.
log
(
base
)
*
tmp
)
ptw_dict
=
{
...
...
test/test_operators/test_jacobian.py
View file @
b5e93218
...
...
@@ -95,6 +95,8 @@ def testInverseGamma(space, seed):
q
=
0.73
model
=
ift
.
InverseGammaOperator
(
space
,
alpha
,
q
)
ift
.
extra
.
check_operator
(
model
,
pos
,
ntries
=
20
)
model
=
ift
.
LogInverseGammaOperator
(
space
,
alpha
,
q
)
ift
.
extra
.
check_operator
(
model
,
pos
,
ntries
=
20
)
@
pmp
(
"loc"
,
[
0
,
13.2
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment