# Optionally, tweak styles. mpl.rc('figure', figsize=(12, 9)) mpl.rc('image', cmap='gray') #%% '''Define some stuff related to infrastructure''' mytimestamp = datetime.now().strftime('%Y-%m-%d_%H-%M-%S') basepath = './' #'/projectnb/cislidt/diederich/muScat/Multiple-Scattering_Tensorflow/' resultpath = 'Data/DROPLETS/RESULTS/' tf.reset_default_graph() '''START CODE''' # Generate Test-Object ''' File which stores the experimental parameters from the Q-PHASE setup 2.) Read in the parameters of the dataset ''' matlab_pars = paras.MyParameter() matlab_pars.loadmat(mymatpath=experiments.matlab_par_file, mymatname=experiments.matlab_par_name) try: matlab_pars.Nz, matlab_pars.Nx, matlab_pars.Ny = experiments.mysize except: print("We don't need to adjust the parameters here!") matlab_pars.mysize = (matlab_pars.Nz, matlab_pars.Nx, matlab_pars.Ny ) # ordering is (Nillu, Nz, Nx, Ny) matlab_pars.shiftIcY = experiments.shiftIcY matlab_pars.shiftIcX = experiments.shiftIcX matlab_pars.dn = experiments.dn matlab_pars.NAc = experiments.NAc ''' 2.) Read in the parameters of the dataset ''' if (experiments.matlab_val_file.find('mat') == -1):
mytimestamp = datetime.now().strftime('%Y-%m-%d_%H-%M-%S') savepath = experiments.mysavepath + mytimestamp + '_' + '_PSFmodel_' + psf_model + experiments.regularizer + '_' + str( experiments.lambda_reg) + '_eps_' + str( experiments.myepstvval) + '_' + 'Shift_x-' + str( experiments.shiftIcX) + 'Shift_y-' + str( experiments.shiftIcY) tf_helper.mkdir(savepath) print('My path is: ' + savepath) ''' 1.) Read in the parameters of the dataset ''' experiments.result_fwd_bpm = '.\Data\Simulations\allAmp_simu_BPM.npy' np_meas = np.load(experiments.savepath_simu) # Generate Test-Object ''' File which stores the experimental parameters from the Q-PHASE setup 3.) Read in the parameters of the dataset ''' myparams = paras.MyParameter() myparams.loadExperiment(experiments) myparams.print() ''' MODELLING StARTS HERE''' tf.reset_default_graph() ''' Create the Model''' muscat = mus.MuScatModel(myparams, is_optimization=is_optimization) muscat.zernikefactors = experiments.zernikefactors muscat.zernikemask = experiments.zernikemask ''' Compute a first guess based on the experimental phase ''' if (is_obj_init_tikhonov): print('Object is initialized with precomputed RI-distribution') if (0): print('ATTENTION: SIDELOAD a GD result!')
tf.reset_default_graph() '''Choose between Born (BORN) or BPM (BPM)''' psf_modell = 'BPM' # 1st Born #psf_modell = 'Born' # MultiSlice #psf_modell = '3QDPC' #psf_modell = None is_mictype = 'BF' # BF, DF, DIC, PC tf.reset_default_graph() # need to figure out why this holds somehow true - at least produces reasonable results # Generate Test-Object ''' File which stores the experimental parameters from the Q-PHASE setup 2.) Read in the parameters of the dataset ''' myparams = paras.MyParameter(Nx=128, Ny=128, NAc=.25, Nz=2, dz=3) #myparams.loadmat(mymatpath = experiments.matlab_par_file, mymatname = experiments.matlab_par_name) myparams.print() ''' Create the Model''' muscat = mus.MuScatModel(myparams, is_optimization=is_optimization) #experiments.zernikefactors = np.array((0,0,0,0, -1.2058168e-04, -2.3622499e-03, -7.7374041e-02 ,-1.4900701e-02, -6.6282146e-04 ,-4.2013789e-04 , -1.2619525e+00)) experiments.zernikemask = np.ones(muscat.zernikemask.shape) obj_real = np.zeros(myparams.mysize) obj_real[ 0, :, :] = 1.33 + .01 * tf_go.generateSpeckle(mysize=myparams.Nx, D=20) obj_real[1, :, :] = 1.33 + myparams.dn * ( nip.rr(mysize=(myparams.Nx, myparams.Ny)) < 10) * (nip.rr( mysize=(myparams.Nx, myparams.Ny), freq='ftfreq'))