rms = np.sqrt(np.mean(arr[mask==1]**2)) arr.tofile(unwrapped_file,format='%f') arr.resize(int(xsize),int(ysize)) mask.resize(int(xsize),int(ysize)) # Saves surface image toimage(arr).save(image_file) return (filename+','+str(rms)) if __name__ == '__main__': # Get path path = diropenbox('Pick directory to process',default=r'd:\phase') path = win32api.GetShortPathName(path) path_raw, path_images, filenames = get_path(path, filetype = 'unwrapped') algorithm_exe = fileopenbox('Pick algorithm exe to use',default=r'd:\phase') ''' # Check if qual or mcut, both require mode to be choosen arg ='' algorithm_exe = fileopenbox('Pick algorithm exe to use',default=r'd:\phase') if re.search('mcut',algorithm_exe) or re.search('qual',algorithm_exe): mode = choicebox('mcut and qual need a mode, choose mode below','Choose mode',\ ['min_grad','min_var','max_corr', 'max_pseu']) arg = ' -mode '+mode ''' # Setup dimensions of array from %path%/debug.csv in col x row format xsize, ysize, data = unwrap_setup(path) # Setup mask
from multiprocessing import Pool #from Tkinter import * # TFI from calc_phase import calc_phase from mask import get_mask from wrapped_phase import get_phase, get_path if __name__ == '__main__': #path = diropenbox('Pick directory to process',default=r'c:\phase') path = r'C:\Users\jsaredy\Desktop\4 1_20130710' path = r'C:\Users\jsaredy\Desktop\run3' path_raw, path_images, filenames = get_path(path, 'h5') first_file = os.path.join(path,filenames[0]) mask,coord = get_mask(first_file, border=2) mask = mask[coord[0]:coord[1],coord[2]:coord[3]] #coord [0] = x_min, [1] = x_max, [2] = y_min, [3] = y_max deb = '' #for filename in filenames: # deb = get_phase(filename, path, path_raw, path_images, mask, coord, deb) pool = Pool() A=[] for filename in filenames: A.append((filename, path, path_raw, path_images, mask, coord)) zz = time.clock() imap1 = pool.imap(get_phase,A) #imap1 = map(get_phase,A)