Skip to content
GitLab
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
e672d725
Commit
e672d725
authored
Sep 12, 2018
by
Reimar Leike
Browse files
made los_response backwards coompatible to numpy 1.11
parent
10edc16d
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty5/library/los_response.py
View file @
e672d725
...
...
@@ -39,7 +39,7 @@ def _gaussian_error_function(x):
def
_comp_traverse
(
start
,
end
,
shp
,
dist
,
lo
,
mid
,
hi
,
erf
):
ndim
=
start
.
shape
[
0
]
nlos
=
start
.
shape
[
1
]
inc
=
np
.
full
(
len
(
shp
),
1
)
inc
=
np
.
full
(
len
(
shp
),
1
,
dtype
=
np
.
int64
)
for
i
in
range
(
-
2
,
-
len
(
shp
)
-
1
,
-
1
):
inc
[
i
]
=
inc
[
i
+
1
]
*
shp
[
i
+
1
]
...
...
@@ -63,7 +63,7 @@ def _comp_traverse(start, end, shp, dist, lo, mid, hi, erf):
dmin
+=
1e-7
dmax
-=
1e-7
if
dmin
>=
dmax
:
# no intersection
out
[
i
]
=
(
np
.
full
(
0
,
0
),
np
.
full
(
0
,
0.
))
out
[
i
]
=
(
np
.
full
(
0
,
0
,
dtype
=
np
.
int64
),
np
.
full
(
0
,
0.
))
continue
# determine coordinates of first cell crossing
c_first
=
np
.
ceil
(
start
[:,
i
]
+
dir
*
dmin
)
...
...
@@ -79,12 +79,12 @@ def _comp_traverse(start, end, shp, dist, lo, mid, hi, erf):
tmp
=
np
.
arange
(
start
=
c_first
[
j
],
stop
=
dmax
,
step
=
abs
(
1.
/
dir
[
j
]))
cdist
=
np
.
append
(
cdist
,
tmp
)
add
=
np
.
append
(
add
,
np
.
full
(
len
(
tmp
),
step
))
add
=
np
.
append
(
add
,
np
.
full
(
len
(
tmp
),
step
,
dtype
=
np
.
int64
))
idx
=
np
.
argsort
(
cdist
)
cdist
=
cdist
[
idx
]
add
=
add
[
idx
]
cdist
=
np
.
append
(
np
.
full
(
1
,
dmin
),
cdist
)
cdist
=
np
.
append
(
cdist
,
np
.
full
(
1
,
dmax
))
cdist
=
np
.
append
(
np
.
full
(
1
,
dmin
,
dtype
=
np
.
int64
),
cdist
)
cdist
=
np
.
append
(
cdist
,
np
.
full
(
1
,
dmax
,
dtype
=
np
.
int64
))
corfac
=
np
.
linalg
.
norm
(
dir
*
dist
)
cdist
*=
corfac
wgt
=
np
.
diff
(
cdist
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment