<jupyter_start><jupyter_text>Function iadftview SynopseGenerate optical Fourier Spectrum from DFT data.- **g = iadftview(F)**    - **OUTPUT**        - **g**: Image.     - **INPUT**        - **F**: Image. n-dimensional DFT complex data. DescriptionGenerate the logarithm of the magnitude of F, shifted so that the origin stays at the center ofthe image. The objective of this function is to provide DFT spectrum visualization.<jupyter_code>import numpy as np

def dftview(F):
    import ia898.src as ia

    FM = ia.dftshift(np.log(np.abs(F)+1))
    return ia.normalize(FM).astype(np.uint8)<jupyter_output><empty_output><jupyter_text>Examples<jupyter_code>testing = (__name__ == "__main__")

if testing:
    import numpy as np
    import sys,os
    ia898path = os.path.abspath('../../')
    if ia898path not in sys.path:
        sys.path.append(ia898path)
    import ia898.src as ia<jupyter_output><empty_output><jupyter_text>Example 1<jupyter_code>if testing:
    import matplotlib.image as mpimg
    import numpy.fft as FFT
    f = mpimg.imread('../data/cameraman.tif')
    ia.adshow(f, "Original 2D image - Cameraman")
    F = FFT.fft2(f)
    Fv = ia.dftview(F)
    ia.adshow(Fv, "Cameraman DFT optical spectrum")<jupyter_output><empty_output><jupyter_text>Equation$$ \begin{matrix}    Gaux &=& \log(|F_{xc,yc}| + 1)\\xc     &=& \lfloor W/2 \rfloor \\yc     &=& \lfloor H/2 \rfloor\\ G &=& Gaux|_0^{255}\end{matrix} $$<jupyter_code>if testing:
    print('testing dftview')
    print(repr(ia.dftview(np.array([[10+6j,20+5j,30+4j],[40+3j,50+2j,60+1j]]))) == repr(np.array(
          [[254, 190, 226],
           [146,   0, 86]],np.uint8)))<jupyter_output>testing dftview
True
{'fraction_non_alphanumeric': 0.15223880597014924, 'fraction_numerical': 0.036417910447761194, 'mean_word_length': 3.72112676056338, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '262826', 'license': 'MIT', 'n_tokens_mistral': 669, 'n_tokens_neox': 615, 'n_words': 139, 'path': 'src/dftview.ipynb', 'repo_name': 'jeancarlosvp/Image_Processing', 'size': '1675'}