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!')
                obj_guess_filename = 'myrefractiveindex.h5'
                obj_guess = data.import_realdata_h5(
                    filename=obj_guess_filename,
                    matname='phase, abs0',
                    is_complex=False)
            else:
if (configs.matlab_val_file.find('mat') == -1):
    matlab_val = np.load(configs.matlab_val_file)
else:
    matlab_val = data.import_realdata_h5(filename=configs.matlab_val_file,
                                         matname=configs.matlab_val_name,
                                         is_complex=True)

if (np.mod(matlab_val.shape[0], 2) == 1):
    matlab_val = matlab_val[0:matlab_val.shape[0] - 1, :, :]

matlab_val = matlab_val + configs.mybackgroundval
#roisize=50
#roicenter = np.array((215,201))
#matlab_val = np.flip(matlab_val,0 )#[0:100,roicenter[0]-roisize:roicenter[0]+roisize,roicenter[1]-roisize:roicenter[1]+roisize],0)
''' Create the Model'''
muscat = mus.MuScatModel(matlab_pars, is_optimization=configs.is_display)

# Correct some values - just for the puprose of fitting in the RAM
muscat.Nx, muscat.Ny, muscat.Nz = matlab_val.shape[1], matlab_val.shape[
    2], matlab_val.shape[0]
muscat.shiftIcY = configs.shiftIcY
muscat.shiftIcX = configs.shiftIcX
muscat.dn = configs.dn
muscat.NAc = configs.NAc
''' Adjust some parameters to fit it in the memory '''
muscat.mysize = (muscat.Nz, muscat.Nx, muscat.Ny
                 )  # ordering is (Nillu, Nz, Nx, Ny)

# introduce zernike factors here
muscat.zernikefactors = configs.zernikefactors
muscat.zernikemask = configs.zernikemask
Beispiel #3
0
is_optimization_psf = False
is_flip = False
is_measurement = False
mysubsamplingIC=0
psf_modell ='corr'#'corr' # None # 'sep'

tf.reset_default_graph()

''' File which stores the experimental parameters from the Q-PHASE setup 
    1.) Read in the parameters of the dataset ''' 
matlab_par_name = 'myParameter'  #'./Data/DROPLETS/myParameterNew.mat';matname='myParameterNew'    #'./Data/DROPLETS/myParameterNew.mat'   
matlab_par_file = './Data/DROPLETS/S19_multiple/Parameter.mat'; matname='myParameter'
matlab_pars = data.import_parameters_mat(filename = matlab_par_file, matname=matlab_par_name)

''' Create the Model'''
muscat = mus.MuScatModel(matlab_pars, is_optimization=is_optimization)
muscat.Nx,muscat.Ny = int(np.squeeze(matlab_pars['Nx'].value)), int(np.squeeze(matlab_pars['Ny'].value))
zernikefactors = np.array((0,0,0,0,0,0,0,0,0.0,0.0,0.0)) # 7: ComaX, 8: ComaY, 11: Spherical Aberration
zernikemask = np.array(np.abs(zernikefactors)>0)*1#!= np.array((0, 0, 0, 0, 0, 0, , 1, 1, 1, 1))# mask which factors should be updated
muscat.shiftIcX = 0 # has influence on the XZ-Plot - negative values shifts the input wave (coming from 0..end) to the left
muscat.shiftIcY = 0 # has influence on the YZ-Plot - negative values shifts the input wave (coming from 0..end) to the left
muscat.NAc = .1
muscat.NAo = .95


dn = .105 #(1.437-1.3326)#/np.pi
myfac = 1 #- 1e-6


#muscat.NAo = .95
#muscat.dz = 0.1625*2#muscat.lambda0/4
Beispiel #4
0
# In[7]:

# This is the place to load data
''' File which stores the experimental parameters from the Q-PHASE setup 
    1.) Read in the parameters of the dataset '''
matlab_pars = data.import_parameters_mat(filename=matlab_par_file)
print
''' 2.) Read in the parameters of the dataset '''
# matlab_val = data.import_realdata_h5(filename = matlab_val_file, matname='allAmpSimu', is_complex=True)

# # Initiate the MuScat (Multiple Scattering) Object

# In[8]:
''' Create the Model'''
mm = mus.MuScatModel(matlab_pars, optimize, my_learningrate, my_keep_prob,
                     tv_lambda, obj_reg_lambda,
                     gr_lambda)  # First initiliaze it

# ## Compute the System's properties (e.g. Pupil function/Illumination Source, K-vectors, etc.)

# In[ ]:
''' Compute the systems model'''
mm.computeSys()

# Now load data which has been saved previously (Optional!)

# In[ ]:

# Load Copute the systems model
#if(load_data):
#    mm.loadData()