Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
ca1c9734
Commit
ca1c9734
authored
May 24, 2013
by
Marco Selig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
positivity check for tr[B2] in infer_power; new 'save' keyword for plotting functions.
parent
8216da7a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
12 deletions
+56
-12
nifty_core.py
nifty_core.py
+53
-12
nifty_power.py
nifty_power.py
+3
-0
No files found.
nifty_core.py
View file @
ca1c9734
...
...
@@ -1650,6 +1650,9 @@ class space(object):
Whether to show the legend or not (default: False).
mono : bool, *optional*
Whether to plot the monopole or not (default: True).
save : string, *optional*
Valid file name where the figure is to be stored, by default
the figure is not saved (default: False).
error : {float, numpy.ndarray, nifty.field}, *optional*
Object indicating some confidence interval to be plotted
(default: None).
...
...
@@ -2063,8 +2066,12 @@ class point_space(space):
scalars, arrays, or fields (default: None).
legend : bool, *optional*
Whether to show the legend or not (default: False).
save : string, *optional*
Valid file name where the figure is to be stored, by default
the figure is not saved (default: False).
"""
if
(
not
pl
.
isinteractive
()):
if
(
not
pl
.
isinteractive
())
and
(
not
bool
(
kwargs
.
get
(
"save"
,
False
)))
:
about
.
warnings
.
cprint
(
"WARNING: interactive mode off."
)
x
=
self
.
enforce_shape
(
np
.
array
(
x
,
dtype
=
self
.
datatype
))
...
...
@@ -2118,6 +2125,9 @@ class point_space(space):
ax0
.
set_ylabel
(
"values"
+
unit
)
ax0
.
set_title
(
title
)
if
(
bool
(
kwargs
.
get
(
"save"
,
False
))):
fig
.
savefig
(
str
(
kwargs
.
get
(
"save"
)),
dpi
=
None
,
facecolor
=
None
,
edgecolor
=
None
,
orientation
=
'portrait'
,
papertype
=
None
,
format
=
None
,
transparent
=
False
,
bbox_inches
=
None
,
pad_inches
=
0.1
)
pl
.
close
(
fig
)
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...
...
@@ -3096,6 +3106,9 @@ class rg_space(space):
Whether to show the legend or not (default: False).
mono : bool, *optional*
Whether to plot the monopole or not (default: True).
save : string, *optional*
Valid file name where the figure is to be stored, by default
the figure is not saved (default: False).
error : {float, numpy.ndarray, nifty.field}, *optional*
Object indicating some confidence interval to be plotted
(default: None).
...
...
@@ -3121,7 +3134,7 @@ class rg_space(space):
(default: 0).
"""
if
(
not
pl
.
isinteractive
()):
if
(
not
pl
.
isinteractive
())
and
(
not
bool
(
kwargs
.
get
(
"save"
,
False
)))
:
about
.
warnings
.
cprint
(
"WARNING: interactive mode off."
)
naxes
=
(
np
.
size
(
self
.
para
)
-
1
)
//
2
...
...
@@ -3290,6 +3303,10 @@ class rg_space(space):
else
:
raise
ValueError
(
about
.
_errors
.
cstring
(
"ERROR: unsupported number of axes ( "
+
str
(
naxes
)
+
" > 2 )."
))
if
(
bool
(
kwargs
.
get
(
"save"
,
False
))):
fig
.
savefig
(
str
(
kwargs
.
get
(
"save"
)),
dpi
=
None
,
facecolor
=
None
,
edgecolor
=
None
,
orientation
=
'portrait'
,
papertype
=
None
,
format
=
None
,
transparent
=
False
,
bbox_inches
=
None
,
pad_inches
=
0.1
)
pl
.
close
(
fig
)
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
...
...
@@ -4038,8 +4055,12 @@ class lm_space(space):
Whether to show the legend or not (default: False).
mono : bool, *optional*
Whether to plot the monopole or not (default: True).
save : string, *optional*
Valid file name where the figure is to be stored, by default
the figure is not saved (default: False).
"""
if
(
not
pl
.
isinteractive
()):
if
(
not
pl
.
isinteractive
())
and
(
not
bool
(
kwargs
.
get
(
"save"
,
False
)))
:
about
.
warnings
.
cprint
(
"WARNING: interactive mode off."
)
if
(
power
):
...
...
@@ -4138,6 +4159,10 @@ class lm_space(space):
fig
.
colorbar
(
sub
,
ax
=
ax0
,
orientation
=
"horizontal"
,
fraction
=
0.1
,
pad
=
0.05
,
shrink
=
0.75
,
aspect
=
20
,
ticks
=
[
vmin
,
vmax
],
format
=
f_
,
drawedges
=
False
,
boundaries
=
b_
,
values
=
v_
)
ax0
.
set_title
(
title
)
if
(
bool
(
kwargs
.
get
(
"save"
,
False
))):
fig
.
savefig
(
str
(
kwargs
.
get
(
"save"
)),
dpi
=
None
,
facecolor
=
None
,
edgecolor
=
None
,
orientation
=
'portrait'
,
papertype
=
None
,
format
=
None
,
transparent
=
False
,
bbox_inches
=
None
,
pad_inches
=
0.1
)
pl
.
close
(
fig
)
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
...
...
@@ -4717,8 +4742,12 @@ class gl_space(space):
Whether to show the legend or not (default: False).
mono : bool, *optional*
Whether to plot the monopole or not (default: True).
save : string, *optional*
Valid file name where the figure is to be stored, by default
the figure is not saved (default: False).
"""
if
(
not
pl
.
isinteractive
()):
if
(
not
pl
.
isinteractive
())
and
(
not
bool
(
kwargs
.
get
(
"save"
,
False
)))
:
about
.
warnings
.
cprint
(
"WARNING: interactive mode off."
)
if
(
power
):
...
...
@@ -4799,6 +4828,10 @@ class gl_space(space):
cb0
.
ax
.
text
(
0.5
,
-
1.0
,
unit
,
fontdict
=
None
,
withdash
=
False
,
transform
=
cb0
.
ax
.
transAxes
,
horizontalalignment
=
"center"
,
verticalalignment
=
"center"
)
ax0
.
set_title
(
title
)
if
(
bool
(
kwargs
.
get
(
"save"
,
False
))):
fig
.
savefig
(
str
(
kwargs
.
get
(
"save"
)),
dpi
=
None
,
facecolor
=
None
,
edgecolor
=
None
,
orientation
=
'portrait'
,
papertype
=
None
,
format
=
None
,
transparent
=
False
,
bbox_inches
=
None
,
pad_inches
=
0.1
)
pl
.
close
(
fig
)
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
...
...
@@ -5330,11 +5363,14 @@ class hp_space(space):
Whether to show the legend or not (default: False).
mono : bool, *optional*
Whether to plot the monopole or not (default: True).
save : string, *optional*
Valid file name where the figure is to be stored, by default
the figure is not saved (default: False).
iter : int, *optional*
Number of iterations performed in the HEALPix basis
transformation.
"""
if
(
not
pl
.
isinteractive
()):
if
(
not
pl
.
isinteractive
())
and
(
not
bool
(
kwargs
.
get
(
"save"
,
False
)))
:
about
.
warnings
.
cprint
(
"WARNING: interactive mode off."
)
if
(
power
):
...
...
@@ -5387,6 +5423,10 @@ class hp_space(space):
cmap
.
set_under
(
color
=
'k'
,
alpha
=
0.0
)
## transparent box
hp
.
mollview
(
x
,
fig
=
None
,
rot
=
None
,
coord
=
None
,
unit
=
unit
,
xsize
=
800
,
title
=
title
,
nest
=
False
,
min
=
vmin
,
max
=
vmax
,
flip
=
"astro"
,
remove_dip
=
False
,
remove_mono
=
False
,
gal_cut
=
0
,
format
=
"%g"
,
format2
=
"%g"
,
cbar
=
cbar
,
cmap
=
cmap
,
notext
=
False
,
norm
=
norm
,
hold
=
False
,
margins
=
None
,
sub
=
None
)
if
(
bool
(
kwargs
.
get
(
"save"
,
False
))):
fig
.
savefig
(
str
(
kwargs
.
get
(
"save"
)),
dpi
=
None
,
facecolor
=
None
,
edgecolor
=
None
,
orientation
=
'portrait'
,
papertype
=
None
,
format
=
None
,
transparent
=
False
,
bbox_inches
=
None
,
pad_inches
=
0.1
)
pl
.
close
(
fig
)
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
...
...
@@ -6715,14 +6755,17 @@ class field(object):
A color map (default=None).
cbar : bool
Whether to show the color bar or not (default=True).
other : {scalar, ndarray, fiel
s
}
other : {scalar, ndarray, fiel
d
}
Object or tuple of objects to be added (default=None).
legend : bool
Whether to show the legend or not (default=False).
mono : bool
Whether to plot the monopol of the power spectrum or not
(default=True).
error : {scalar, ndarray, fiels}
save : string, *optional*
Valid file name where the figure is to be stored, by default
the figure is not saved (default: False).
error : {scalar, ndarray, field}
object indicating some confidence intervall (default=None).
iter : scalar
Number of iterations (default: 0).
...
...
@@ -6752,15 +6795,13 @@ class field(object):
"""
interactive
=
pl
.
isinteractive
()
if
(
not
interactive
):
pl
.
ion
()
pl
.
matplotlib
.
interactive
(
not
bool
(
kwargs
.
get
(
"save"
,
False
)))
if
(
"codomain"
in
kwargs
):
kwargs
.
__delitem__
(
"codomain"
)
self
.
domain
.
get_plot
(
self
.
val
,
codomain
=
self
.
target
,
**
kwargs
)
if
(
not
interactive
):
pl
.
ioff
()
pl
.
matplotlib
.
interactive
(
interactive
)
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...
...
@@ -9544,7 +9585,7 @@ class projection_operator(operator):
else
:
assign
=
self
.
domain
.
enforce_shape
(
assign
).
astype
(
np
.
int
)
assign
=
np
.
maximum
(
-
1
,
assign
)
## condensing all negative integers
## build indexing
## build indexing
## TODO: optimize
ind
=
[[]]
*
len
(
set
(
assign
.
flatten
(
order
=
'C'
)))
if
(
np
.
size
(
self
.
domain
.
dim
(
split
=
True
))
==
1
):
for
ii
in
range
(
self
.
domain
.
dim
(
split
=
True
)):
...
...
nifty_power.py
View file @
ca1c9734
...
...
@@ -500,6 +500,9 @@ def infer_power(m,domain=None,Sk=None,D=None,pindex=None,pundex=None,kindex=None
trB2
=
0
else
:
trB2
=
Sk
.
pseudo_tr
(
D
,
**
kwargs
)
## probing of the partial traces of D
if
(
np
.
any
(
trB2
<
0
)):
about
.
warnings
.
cprint
(
"WARNING: nonpositive value(s) in tr[DSk] reset to 0."
)
trB2
=
np
.
minimum
(
0
,
trB2
)
## power spectrum
numerator
=
2
*
q
+
trB1
+
perception
[
0
]
*
trB2
## non-bare(!)
denominator1
=
rho
+
2
*
(
alpha
-
1
+
perception
[
1
])
...
...
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