How to create new numpy array by using a function on every row with no loops
up vote
0
down vote
favorite
so I've got a project which asks of me to use a DFT function that I've built (on an array of size [N,1]) and use that function on an entire image of size [N,M].
I've been asked to do so using no loops and I can't figure it out.
Is there a way to use a function on each one of my rows which returns a new row and that way build a new numpy array without loops?
python-3.x image-processing computer-science
add a comment |
up vote
0
down vote
favorite
so I've got a project which asks of me to use a DFT function that I've built (on an array of size [N,1]) and use that function on an entire image of size [N,M].
I've been asked to do so using no loops and I can't figure it out.
Is there a way to use a function on each one of my rows which returns a new row and that way build a new numpy array without loops?
python-3.x image-processing computer-science
Sounds like you're looking fornumpy.apply_along_axis
– jwil
Nov 9 at 21:28
1
Hey, so numpy.apply_along_axis uses a for loop internally and is slow, I've already tested it and I wasn't very happy with the results.
– edan patt
Nov 9 at 21:30
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
so I've got a project which asks of me to use a DFT function that I've built (on an array of size [N,1]) and use that function on an entire image of size [N,M].
I've been asked to do so using no loops and I can't figure it out.
Is there a way to use a function on each one of my rows which returns a new row and that way build a new numpy array without loops?
python-3.x image-processing computer-science
so I've got a project which asks of me to use a DFT function that I've built (on an array of size [N,1]) and use that function on an entire image of size [N,M].
I've been asked to do so using no loops and I can't figure it out.
Is there a way to use a function on each one of my rows which returns a new row and that way build a new numpy array without loops?
python-3.x image-processing computer-science
python-3.x image-processing computer-science
asked Nov 9 at 21:26
edan patt
1
1
Sounds like you're looking fornumpy.apply_along_axis
– jwil
Nov 9 at 21:28
1
Hey, so numpy.apply_along_axis uses a for loop internally and is slow, I've already tested it and I wasn't very happy with the results.
– edan patt
Nov 9 at 21:30
add a comment |
Sounds like you're looking fornumpy.apply_along_axis
– jwil
Nov 9 at 21:28
1
Hey, so numpy.apply_along_axis uses a for loop internally and is slow, I've already tested it and I wasn't very happy with the results.
– edan patt
Nov 9 at 21:30
Sounds like you're looking for
numpy.apply_along_axis
– jwil
Nov 9 at 21:28
Sounds like you're looking for
numpy.apply_along_axis
– jwil
Nov 9 at 21:28
1
1
Hey, so numpy.apply_along_axis uses a for loop internally and is slow, I've already tested it and I wasn't very happy with the results.
– edan patt
Nov 9 at 21:30
Hey, so numpy.apply_along_axis uses a for loop internally and is slow, I've already tested it and I wasn't very happy with the results.
– edan patt
Nov 9 at 21:30
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233469%2fhow-to-create-new-numpy-array-by-using-a-function-on-every-row-with-no-loops%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Sounds like you're looking for
numpy.apply_along_axis
– jwil
Nov 9 at 21:28
1
Hey, so numpy.apply_along_axis uses a for loop internally and is slow, I've already tested it and I wasn't very happy with the results.
– edan patt
Nov 9 at 21:30