Beispiel #1
0
                        
                        fi1.store_data(s)
                        fi1.write_to_file()
                        
                        # ----- start optimizing
                        opt_backend_1.update_PSB(optimi_1)
                        
                        stochagrad_1 = get_stochastic_grad(optimi_1, initialbundle, sample_param=sample_param)
                        opt_backend_1.stochagrad = stochagrad_1
                        
                        s1 = optimi_1.run()

plt.show()

#*******************************************************************************
'''


## V----------- plot the optimized system
#
## --- plot the bundles and draw the system
plotBundles(s, testbundle, sysseq, ax2, pn, up)
##
# --- draw spot diagrams
# plotSpotDia(osa, numrays, rays_dict, wavelength)


# get a look at the vars
ls=listOptimizableVariables(s, filter_status='variable', max_line_width=1000)

plt.show()
# --- set the plot setting

pn = np.array([1, 0, 0])
up = np.array([0, 1, 0])

fig = plt.figure(1)
ax1 = fig.add_subplot(211)
ax2 = fig.add_subplot(212)
ax1.axis('equal')
ax2.axis('equal')

# --- plot the bundles and draw the original system
# first it is necessary to copy the initialbundle, as it's gonna be changed
# inside of the seqtrace function (called inside of plotBundles)
testbundle = deepcopy(initialbundle)
plotBundles(s, initialbundle, sysseq, ax1, pn, up)

# IV ----------- optimization
# ----- define optimizable variables
#######################################NeuAnfang################################
fi1.setup_variables(s, elem1.name)

#######################################NeuEnde##################################


# --- define update function
def osupdate(my_s):
    #   Update all coordinate systems during run
    my_s.rootcoordinatesystem.update()

Beispiel #3
0
fi1.store_data(s)
fi1.write_to_file()  #am ende einmal in ne datei schreiben

## ----- start optimizing
opt_backend.update_PSB(optimi)
s = optimi.run()
print('ANZAHL FUNKTIONSAUFRUFE GESAMT:')
print(optimi.NoC)
#*******************************************************************************
#*******************************************************************************
#*******************************************************************************

# print the final simplex, which are the meritfunction values
# print("f simplex: ", opt_backend.res.final_simplex[1])
# print("iterNum = ", opt_backend.res.nit)
#
#
#
## V----------- plot the optimized system
#
## --- plot the bundles and draw the system
plotBundles(s, testbundle, sysseq, ax2, pn, up)
##
# --- draw spot diagrams
# plotSpotDia(osa, numrays, rays_dict, wavelength)

# get a look at the vars
ls = listOptimizableVariables(s, filter_status='variable', max_line_width=1000)

plt.show()