Пример #1
0
import matplotlib.pyplot as plt

# Monkey patch in fftn and ifftn from pyfftw.interfaces.scipy_fftpack
fftpack.fft2 = pyfftw.interfaces.scipy_fftpack.fft2
fftpack.ifft2 = pyfftw.interfaces.scipy_fftpack.ifft2
fftpack.fft = pyfftw.interfaces.scipy_fftpack.fft
fftpack.ifft = pyfftw.interfaces.scipy_fftpack.ifft

# Turn on the cache for optimum performance
pyfftw.interfaces.cache.enable()

#parameters
N = 256
floatType = np.complex
twoQuads = True
p = nt.nearestPrime(N)
p = N

#-------------------------------
#load kspace data
#from scipy.io import loadmat

#load Cartesian data
#Attention: You must ensure the kspace data is correctly centered or not centered.
image = shepp_logan(N)
kspace = fftpack.fft2(image)
print("kSpace Shape:", kspace.shape)
kMaxValue = np.max(kspace)
kMinValue = np.min(kspace)
print("k-Space Max Value:", kMaxValue)
print("k-Space Min Value:", kMinValue)
Пример #2
0
from __future__ import print_function  # (at top of module)
import _libpath  #add custom libs
import finitetransform.numbertheory as nt  #local modules
import finitetransform.mojette as mojette
import finitetransform.radon as radon
import finitetransform.imageio as imageio  #local module
import finitetransform.farey as farey  #local module
import numpy as np

#parameters
N = 512
M = 2 * N
K = 1
twoQuads = True
print("N:", N, "M:", M)
p = nt.nearestPrime(M)
print("p:", p)
pDash = nt.nearestPrime(N)
print("p':", pDash)
#angles = mojette.angleSet_Finite(pDash, 2)
angles, lengths = mojette.angleSet_Symmetric(N, N, 1, True, K)
perpAngle = farey.farey(1, 0)
angles.append(perpAngle)
print("Number of Angles:", len(angles))
print("angles:", angles)

powerSpect = np.zeros((p, p))

#compute lines
print("Computing Finite lines...")
centered = True
# -*- coding: utf-8 -*-
"""
Test if nearest prime function works in NT
Created on Tue Oct 28 10:48:41 2014

@author: uqscha22
"""
import _libpath  #add custom libs
import finitetransform.numbertheory as nt

n = 98

print "Nearest prime to", n, "is", nt.nearestPrime(n)