Commit 734df776 authored by Maximilian Beckers's avatar Maximilian Beckers
Browse files

made pyFFTW optional

parent df86bcb9
......@@ -4,8 +4,7 @@ import math
import gc
import os
import sys
import pyfftw
import multiprocessing
#Author: Maximilian Beckers, EMBL Heidelberg, Sachse Group
......@@ -530,20 +529,23 @@ def lowPassFilter(mapFFT, frequencyMap, cutoff, shape):
sizeMap = mapFFT.shape;
#get number of cpus
numCores = multiprocessing.cpu_count();
#do filtering of the map
filterMap = tanh_filter(frequencyMap, cutoff);
filteredftMap = filterMap*mapFFT;
#do ifft and get real parts
#filteredMap = np.fft.irfftn(filteredftMap, shape);
#filteredMap = np.real(filteredMap);
#do iverse FFT
fftObject = pyfftw.builders.irfftn(filteredftMap, shape, threads = numCores);
filteredMap = fftObject();
try: #optional with pyfftw
import pyfftw
import multiprocessing
# get number of cpus
numCores = multiprocessing.cpu_count();
fftObject = pyfftw.builders.irfftn(filteredftMap, shape, threads = numCores);
filteredMap = fftObject();
except:
filteredMap = np.fft.irfftn(filteredftMap, shape);
filteredMap = np.real(filteredMap);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment