import numpy as np
import sys
sys.path.append(r"C:\VLF-Python\VLFBatchEvaluation.py")
from VLFBatchEvaluation import*
path = r"C:\VLF-Python"
#############################################################
#default Value 
IndextobeFound = '1'
Search_Parameter='Stack #2 (Rectangular Grating) | Interface #1 (Rectangular Grating Interface) | Modulation Depth'     #default Search_Parameter Value of this program should be same as Search_Parameter of this program
Search_Parameter1='Stack #2 (Rectangular Grating) | Interface #1 (Rectangular Grating Interface) | Relative Slit Width' #default Search_Parameter1 Value of this program should be same as Search_Parameter1 of ParameterScan2D
Search_Parameter_array1=np.array((Search_Parameter,Search_Parameter1))
Set_default_Value_array=((0.00185,50))                                     # default Value while exporting Batch files from VirtualLab Fusion 
print(functionTest(path,IndextobeFound,Search_Parameter_array1,Set_default_Value_array))
####################################################################
IndextobeFound = '1'
Search_Parameter='Stack #2 (Rectangular Grating) | Interface #1 (Rectangular Grating Interface) | Modulation Depth'
Search_Parameter1='Stack #2 (Rectangular Grating) | Interface #1 (Rectangular Grating Interface) | Relative Slit Width'
Search_Parameter_array=np.array((Search_Parameter,Search_Parameter1))
# define varying range
gratingDepthMax = 0.010 # given in millimeter by default
gratingDepthMin = 0.0001 # given in millimeter by default
stepNumberDepth = 25
stepSizeDepth = (gratingDepthMax - gratingDepthMin) / (stepNumberDepth - 1)
slitWidthMax = 80 # given in %
slitWidthMin = 20 # given in %
stepNumberSlit = 15
stepSizeSlit = (slitWidthMax - slitWidthMin) / (stepNumberSlit - 1)
efficiencies = np.zeros((stepNumberDepth,stepNumberSlit))
gratingDepth_array = np.zeros((stepNumberDepth,stepNumberSlit))
slitWidth_array = np.zeros((stepNumberDepth,stepNumberSlit))
print(efficiencies)
# loop for input variables
for i in range(stepNumberDepth):
    #current value of variable
    gratingDepth = gratingDepthMin +  (i) * stepSizeDepth
    print("Modulation depth", gratingDepth)
    for j in range(stepNumberSlit):
        #current value of variable
        slitWidth = slitWidthMin +  (j) * stepSizeSlit
        print("fill factor", slitWidth)
       # Pass_Value=np.array((gratingDepth,slitWidth))
        Pass_Value=[gratingDepth,slitWidth]
        print("Pass_Value", Pass_Value)
        # call function
        efficiencies=[functionTest(path,IndextobeFound,Search_Parameter_array,Pass_Value)]

