FFT of a 2d array with NAN












0















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)









share|improve this question

























  • 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
















0















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)









share|improve this question

























  • 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














0












0








0








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)









share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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



















  • 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












1 Answer
1






active

oldest

votes


















0














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.






share|improve this answer


























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    0














    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.






    share|improve this answer






























      0














      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.






      share|improve this answer




























        0












        0








        0







        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.






        share|improve this answer















        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.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 25 '18 at 19:48

























        answered Nov 25 '18 at 19:42









        hotpaw2hotpaw2

        61.9k1072132




        61.9k1072132
































            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            這個網誌中的熱門文章

            Xamarin.form Move up view when keyboard appear

            Post-Redirect-Get with Spring WebFlux and Thymeleaf

            Anylogic : not able to use stopDelay()