Creates a new fit parameter in the list of fit parameters. The parameters passed to this procedure have the following meaning:
list: the SCOUT list with the object the fit parameter of which is to be created
1 Materials
2 | Layer stacks |
3 | Spectra list |
4 Master parameter list
object: the index of the object in the list. The objects are counted 1, 2, 3, ...
subobject: if the object has subobjects this parameter specifies the index of the wanted subobject. This can be, for example, a susceptibility in the list of susceptibilities of a dielectric function model.
subsubobject: if the subobject has again subobjects of its own, this is the index of the wanted subobject.
parameter: the index of the parameter to be selected as fit parameter. If you are not sure about the index of a parameter you can drag the object to the fit parameter list and see which parameters are created in which order. The 'create_fit_parameter' OLE command uses exactly the same number and sequence of parameters.
Here is a simple example making use of the create_fit_parameter command:
'Excel VisualBasic demo of a remote fitting procedure using OLE automation
'This object is the SCOUT automation object
Public scout As Object
Public Sub fit()
'Create the OLE server
Set scout = CreateObject("scout_98.scoutole")
'Load a pre-configured configuration with a suitable reflectance spectrum and spectral range
scout.configuration_file = "c:\test\ole_test.sc2"
'Show SCOUT on the screen
scout.Show
'Clear the layer stack - we will build up a new one in a moment
scout.clear_layer_stack (1)
'Clear the list of materials - materials will be taken from the database
scout.clear_material_list
'Create a thick layer with 2 mm thickness and fill it with BK7 glass, a material named "Glass Type BK7" must be in the database
Call scout.add_layer_definition_on_top(1, "Thick layer" + Chr(9) + "Glass Type BK7" + Chr(9) + "0.2")
'Create a thin silver filme on top of the glass substrate, take the material "Ag model" from the database
Call scout.add_layer_definition_on_top(1, "Thin film" + Chr(9) + "Ag model" + Chr(9) + "0.000001")
'Load a measured spectrum into the first spectrum object, using standard format
Call scout.load_experiment(1, "C:\test\ag_10.std", 1)
'Clear the list of fitparameters
scout.clear_fit_parameters
'From the list of layer stacks, take the first object
'and then the second subobject. This is the silver layer.
'Select parameter 1 as fit parameter (this is the thickness)
Call scout.create_fit_parameter(2, 1, 2, 0, 1)
'From the list of materials, take the 3rd object which is the silver model
'(initially there was vacuum, then glass has been taken from the database,
'and finally, as 3rd object, the Ag model was loaded).
'Take the first susceptibility which is the Drude model.
'Take the 2nd parameter of the Drude model which is the damping constant and select
'it as fit parameter.
Call scout.create_fit_parameter(1, 3, 1, 0, 2)
'Set boundaries for the damping constant which is fit parameter 2 now (after the layer thickness).
scout.fit_parameter_value_min(2) = 100
scout.fit_parameter_value_max(2) = 10000
'The silver model contains several Brendel oscillators in the list of susceptibilities.
'Take the 2nd, 3rd, 4th and 5th susceptibility and select for each one parameter
'2 as fit parameter, i.e. the oscillator strength.
'This is just for demonstration - it is not really reasonable to vary these parameters in the fit.
Call scout.create_fit_parameter(1, 3, 2, 0, 2)
Call scout.create_fit_parameter(1, 3, 3, 0, 2)
Call scout.create_fit_parameter(1, 3, 4, 0, 2)
Call scout.create_fit_parameter(1, 3, 5, 0, 2)
'Select - just for demonstration - parameter #1 of the first spectrum in the list of spectra.
'This is the angle of incidence of the reflectance spectrum.
Call scout.create_fit_parameter(3, 1, 0, 0, 1)
'Select - also for demonstration only - the first master parameter as fitparameter.
Call scout.create_fit_parameter(4, 1, 0, 0, 1)
'Re-compute the model and update the main view
scout.update_data
scout.update_plot
'Start the fit
scout.start
'Start a waiting loop which will finish when SCOUT stops its fit (or you as a user
'press the STOP button in SCOUT.
While scout.fitting = True
'Wait for 1 second
Application.Wait Now + TimeSerial(0, 0, 1)
Wend
'Write results to a worksheet range
'fit parameter #1 is the thickness
Range("results").Offset(1, 1) = scout.fit_parameter_value(1)
'export the real part of the refractive index of the Ag model at 1000 nm wavelength
Range("results").Offset(1, 2) = scout.refractive_index(3, 10000000 / 1000)
'export the imaginary part of the refractive index of the Ag model at 1000 nm wavelength
Range("results").Offset(1, 3) = scout.kappa(3, 10000000 / 1000)
End Sub