FFT of a 2d array with NAN
I'm trying to apply FFT on a 2D array with NAN. I don't want to replace the NAN values with anything. Is there a way to apply FFT and ignore the NAN values?
arr=np.array([[1, 2, 3], [4, NAN, 6], [1, 2, NAN]])
f=np.fft.fft2(arr)
2d fft nan
add a comment |
I'm trying to apply FFT on a 2D array with NAN. I don't want to replace the NAN values with anything. Is there a way to apply FFT and ignore the NAN values?
arr=np.array([[1, 2, 3], [4, NAN, 6], [1, 2, NAN]])
f=np.fft.fft2(arr)
2d fft nan
How would you expect an FFT that "ignores NAN" to behave? As if those were zeros? Also, any reason why you don't want to replace the NAN values? Do you simply want to preserve your source, or do you have memory constraints that would make a temporary copy where NAN are replaced impractical?
– SleuthEye
Nov 24 '18 at 2:55
add a comment |
I'm trying to apply FFT on a 2D array with NAN. I don't want to replace the NAN values with anything. Is there a way to apply FFT and ignore the NAN values?
arr=np.array([[1, 2, 3], [4, NAN, 6], [1, 2, NAN]])
f=np.fft.fft2(arr)
2d fft nan
I'm trying to apply FFT on a 2D array with NAN. I don't want to replace the NAN values with anything. Is there a way to apply FFT and ignore the NAN values?
arr=np.array([[1, 2, 3], [4, NAN, 6], [1, 2, NAN]])
f=np.fft.fft2(arr)
2d fft nan
2d fft nan
edited Nov 24 '18 at 22:44
SleuthEye
10.8k22046
10.8k22046
asked Nov 23 '18 at 13:22
NedoNedo
1
1
How would you expect an FFT that "ignores NAN" to behave? As if those were zeros? Also, any reason why you don't want to replace the NAN values? Do you simply want to preserve your source, or do you have memory constraints that would make a temporary copy where NAN are replaced impractical?
– SleuthEye
Nov 24 '18 at 2:55
add a comment |
How would you expect an FFT that "ignores NAN" to behave? As if those were zeros? Also, any reason why you don't want to replace the NAN values? Do you simply want to preserve your source, or do you have memory constraints that would make a temporary copy where NAN are replaced impractical?
– SleuthEye
Nov 24 '18 at 2:55
How would you expect an FFT that "ignores NAN" to behave? As if those were zeros? Also, any reason why you don't want to replace the NAN values? Do you simply want to preserve your source, or do you have memory constraints that would make a temporary copy where NAN are replaced impractical?
– SleuthEye
Nov 24 '18 at 2:55
How would you expect an FFT that "ignores NAN" to behave? As if those were zeros? Also, any reason why you don't want to replace the NAN values? Do you simply want to preserve your source, or do you have memory constraints that would make a temporary copy where NAN are replaced impractical?
– SleuthEye
Nov 24 '18 at 2:55
add a comment |
1 Answer
1
active
oldest
votes
No. An FFT will propagate any unknown input to every output. This because in a transform such as a DFT, every output value directly depends on every input value, and thus can not be computed without known values for every input.
Or, an alternate answer is Yes: If any input to an FFT is an NaN, just output the FFT result as an appropriately sized array completely filled with NaNs.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f53447518%2ffft-of-a-2d-array-with-nan%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
No. An FFT will propagate any unknown input to every output. This because in a transform such as a DFT, every output value directly depends on every input value, and thus can not be computed without known values for every input.
Or, an alternate answer is Yes: If any input to an FFT is an NaN, just output the FFT result as an appropriately sized array completely filled with NaNs.
add a comment |
No. An FFT will propagate any unknown input to every output. This because in a transform such as a DFT, every output value directly depends on every input value, and thus can not be computed without known values for every input.
Or, an alternate answer is Yes: If any input to an FFT is an NaN, just output the FFT result as an appropriately sized array completely filled with NaNs.
add a comment |
No. An FFT will propagate any unknown input to every output. This because in a transform such as a DFT, every output value directly depends on every input value, and thus can not be computed without known values for every input.
Or, an alternate answer is Yes: If any input to an FFT is an NaN, just output the FFT result as an appropriately sized array completely filled with NaNs.
No. An FFT will propagate any unknown input to every output. This because in a transform such as a DFT, every output value directly depends on every input value, and thus can not be computed without known values for every input.
Or, an alternate answer is Yes: If any input to an FFT is an NaN, just output the FFT result as an appropriately sized array completely filled with NaNs.
edited Nov 25 '18 at 19:48
answered Nov 25 '18 at 19:42
hotpaw2hotpaw2
61.9k1072132
61.9k1072132
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2f53447518%2ffft-of-a-2d-array-with-nan%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
How would you expect an FFT that "ignores NAN" to behave? As if those were zeros? Also, any reason why you don't want to replace the NAN values? Do you simply want to preserve your source, or do you have memory constraints that would make a temporary copy where NAN are replaced impractical?
– SleuthEye
Nov 24 '18 at 2:55