-
-
September 25, 2024 at 3:58 pmzu1Subscriber
Dear Zemax Support Team,
I hope this message finds you well. I am currently working on a project involving the design and numerical simulation of metalenses using Zemax and MATLAB. The design phase involves saving phase data from the Zemax simulation, which is later used in a numerical script to generate the metalens in MATLAB.
The link to example file by lumerical: https://optics.ansys.com/hc/en-us/articles/360042097313-Small-Scale-Metalens-Field-Propagation
I have the MATLAB file from this example that contains the phase data being saved from Zemax, but I am unsure of the specific method or format used to extract and save the data from Zemax. The phase data I currently have from the example file in MATLAB is as follows:
- Phase matrix: 571 x 571 (double)
- X data: 571 x 1 (double)
- Y data: 571 x 1 (double)
Could you please provide guidance on:
- How this phase data was likely saved from Zemax into MATLAB?
- Weather it is Surface Phase or Surface Sag
- What steps or scripts were used to extract this information from the design, particularly the 571 x 571 phase matrix and the corresponding X and Y data?
This information will help me reproduce the workflow and proceed with my analysis.
Thank you for your support. I look forward to your guidance.
Best regards,
Zaka
-
September 26, 2024 at 4:06 pmNiki PapachristouAnsys Employee
Hi Zaka,
Thank you for reaching out to us!
I believe that for this example the target phase map was pre-created by MATLAB using the ZOS-API MATLAB Interactive Connection, and then the created .mat file was loaded to Lumerical by the stitch_nearfield_ZOS_R100um.lsf script. This means that we connected to OpticStudio from MATLAB using the ZOS-API, pulled the polynomial coefficients to MATLAB, created the target phase map in MATLAB, and saved the data as a native .mat file, which can be read by Lumerical using the matlabload function. Even though it is possible to follow this way using MATLAB, I would suggest to directly re-create the target phase profile in Lumerical instead, as done in the other stitch_nearfield_R11um.lsf example, because the size of the generated .mat file rapidly increases with the size of the metalens, so while the MATLAB workflow works smoothly in case of smaller scale metalenses, it will be problematic for larger scale metalenses over the 1 mm semi-diameter size. Involving MATLAB and the ZOS-API connection is not necessary for the workflow, the same results can be achieved by re-creating the phase profile in Lumerical based on the phase equation and polynomial coefficients from Zemax.Â
That said, if you are interested, I am attaching the MATLAB script for your reference.Â
You may find further help for connectiong MATLAB to OpticStudio via the ZOS-API here:
How to connect to the ZOS-API with the Interactive Extension using MATLAB – Knowledgebase (zemax.com)I believe that the data you are looking for are coming from the Surface Phase.
Unfortunately, currently I am not able to provide you with the exact script to use, but I am hoping you can built one from your side based on my above response.
I hope that was helpful, let me know if I can be of further assistance.
Kind Regards,
Niki
Â
Â
-
October 4, 2024 at 10:01 amzu1Subscriber
Thanks for your response. I just took the text data of the phase from Zemax and used Matlab to save it in the format as done in the example.
-
- You must be logged in to reply to this topic.
- Difference between answers in version 2024 and 2017 lumerical mode solution
- Errors Running Ring Modulator Example on Cluster
- INTERCONNECT – No results unless rerun simulation until it gives any
- Import material .txt file with script
- Trapezoidal ring
- Help for qINTERCONNECT
- Issues with getting result from interconnent analysis script
- Topology Optimization Error
- Edge Coupler EME Example Issue
- The two modes overlap the integral
-
1191
-
513
-
488
-
225
-
209
© 2024 Copyright ANSYS, Inc. All rights reserved.