Find out how you can save time and energy using the Zemax Programming Language!
- 136 Topics
- 369 Replies
How to define a fiber output for a source Gaussian
I have a very simple question. How could I define a source Gaussian out from a single mode fiber, which core size is 4 micro, NA =0.12. I know the beam size (diameter) should be set to be MFD, how to put the parameter for position? should I put the parameter of the position as Rayleigh distance Zr? or should I use MFD/(2*NA)? Thanks for your answer in advance.
Quick access to peak to valley value in analysis-interferogram
Hi, I am trying to calculate peak to valley value showing on 'analysis-interferogram' window by ZPL, and use it in the merit function editor with ZPLM operand. But I have no idea how to directly get the peak to valley value using any kinds of pre-defind functions or else, so currently what I am doing is to save the text file of interferogram analysis result, then read back in, and extract the peak to valley value, then pass it using OPTRETURN. This process seems require a lot of time to calculate system by system during the optimization, so I want to find a quick method to obtain the peak to valley value, instead of what I am doing now. Thank you in advance. And I hope there is a clever way to do this.
Change source array radius of a source file by multi-configuration operands
Hi! I am trying to set up a system with different configurations of a light source. The light source is defined by a source file and set up as a circular array with a certain radius. I would like to change the radius of this circle between different configurations of the system. Is there a way to reach this radius parameter by a multi-configuration operand? The ZPL function SETNSCPROPERTY seems to have a way to reach in and do this. SETNSCPROPERTY (keywords) Sets properties of NSC objects. Syntax: SETNSCPROPERTY surface, object, code, face, value Code Property The following codes set values on the Sources tab of the Object Properties dialog. 112 Sets the array mode; 0 for none, 1 for rectangular, 2 for circular, 3 for hexapolar, and 4 for hexagonal. 165-166 Sets the array mode double precision arguments 1 and 2. I have tried to set this with the NPRO operand
How to use the GETTEXTFILE function with an NSC detector
Is there a way to to use the GETTEXTFILE function with an NSC detector? I’m running into the same issue, and couldn’t figure it out from the help page of the function. I’m currently using SAVEWINDOW from a detector window opened to the text tab and getting the same message.[Mod note: moved the post to a new forum thread.]
Some questions about when used the macro commnad SYSP to convert the field type
such as fist type i used the filed tpye is real image heightbut i want to convert the type to angle through the macro commandSYSP 100,0however it convert result is the field type is angle but the field datas is not changelike the filed data in No. 12 is 3.4mm in real image heightbut after convert the filed data in No. 12 is 3.4° in anglei want to get the results are similar ,the field datas follws the field type
how to make great use of CPU efficiency when use ZPLM to do tolerance analysis
Question1: I use ZPLM+MACRO to calculation edge spread size, and tolerance script to get tolerance result for edge spread size variation. But CPU only use 10%, so the computation time is very long. Even I choose the max core in tolerance analysis. Is there any setting I miss for macro operation to make better use of CPU? Question2: When I open Zemax file, it become very slow and need to waiting a long time to see it full open already. Why this issue happen? It was open fast before, and I use the same Zemax file on same computer.
How to create 'Chief ray solve' using ZPLM solve
Hi all,I’m facing a problem of applying ‘Chief ray solve’ for multiple configurations inside the multi-configuration editor. I was trying to use ‘Chief ray solve’ for Decenter and Tilt to one configuration and let other configurations ‘pick up’ the value of the first one. However, the ‘Chief ray solve’ for Decenter and Tilt in multi-configuration is grayed out. So I was wondering whether it is possible to create a ZPLM solve that is identical to the ‘Chief ray solve’ used in the lens data editor and applies it into the multi-configruaton editor? If this is possible, can anyone shares the logic behind the implementation of ‘Chief ray solve’ for decenter and tilt? ThanksBest wishes and Happy new year! Daoming
How to change settings in Ima for GETTEXTFILE
Hi, I am trying to calculate multimode fiber coupling efficiency by using Geometric Image Analysis through GETTEXTFILE, and I want to do this for different fields and wavelengths. I am trying to change field# and wavelength# by MODIFYSETTINGS, but looks like these two parameters are not allowed to be changed. Following is the list of parameters that MODIFYSETTINGS provides: I wonder if anyone knows how to make the changes so I can do this calculation using ZPL. Thanks!Jizuo
How can only OBJECT's Clear Semi-Diameter be enlarged?
How can only OBJECT's Clear Semi-Diameter be enlarged? I mean, I want to increase the size of the object's Clear Semi-Diameter without changing the size of the remaining Lens Surface. Can I know how with below System Explorer Setting? 1. Aperture Type "Float by Stop Size"2. Ray Aiming is "Paraxial"3. Convert Semi-Diameters to Circular Properties in the Lens Data Editor4. Change the field type to 'Object height'.
How to optimize POP by use merit function in ZPL?
I would like to write the Macro script of ZPL about how to optimize the POP by merit function like as “POPD” optimized operand1.Set the one surface of Thickness or parameter 1,2,3… as the value of 0.5mm, 0.6mm , 0.7mm to run a loop2.Set the someone surface “Thickness or parameter 1,2,3…..” as variable factor. 3.Execute to optimize the MF as POPD to run 10,15 circles as you want 4.In the end, shows the final optimized value to 1st step different cases you setEx. Surface 3 thickness as 0.5mm, 0.6mm, 0.7mmOptimized the surface 7 of thickness as variable factor by using POPD MFto get value under surface 3 as 0.5mm, 0.6mm, 0.7mm respectively.
How to iteratively change the clear semi-diameter of a component and save the resulting wavefront map to a file?
Hi everyone, I’ve recently started using OpticStudio. Currently, I’m trying to incrementally change the clear semi-diameter of a surface within my system. I know this can easily be achieved with a FOR loop.However, for each iteration, I hope to save the resulting wavefront map. Unfortunately, using GETTEXTFILE within a loop does not appear to work as intended, as the FOR loop seems to run as normal, but does not create the required files. I’ve attached my code. If there’s any mistakes or changes that need to be made so that the solver iterates over the semi-diameter values and saves the wavefront map at each step, just let me know. ! Setting the desired format.FORMAT 1 INTFOR i, 0, 6, 1 ! Reducing the clear semi-diameter by 5 lens units per iteration. CLR_SEMI_DIAM = 52 - i*5 ! Returning the new clear semi-diameter to the editor. SOLVERETURN CLR_SEMI_DIAM ! Setting the output filename. FLNM$ = "F:\LGS_104_Wavefront_Map_" + $STR(i) + ".txt" ! Writing the wavefront m
A macro for grid distortion using centroid and shown in image coordinate
This code calculates grid distortion based on centroid. The advantage is it works for systems where the chief ray cannot reach image surface. Note that, although chief ray doesn't need to reach image surface, there should still be some rays reaching the image surface. This only works when the field type is either Angle or Object Height. Another useful points of this tool is it shows data on image coordinate, not object coordinate as in the native Grid Distortion analysis.In the generated layout, you can see red and blue marks.Red marks are the centroid position of each sampled field. Blue marks are the 'reference' that serves as definition of 'no distortion'.Note Red marks are the ray-tracing result of your system and cannot be changed. However, the blue marks is defined by ABCD matrix, which can be user-defined. In other words, there is no a standard of 'no distortion'.The macro will automatically find a reasonable ABCD matrix just like the native Grid Distortion, but you can definit
ZPL Macro: Mapping Function Resolution Doesn't work
Hello,I’m new in OpticStudio and I’m trying to use the macro Mapping Function Resolution created by OpticStudio that we can find here and implement it in my OpticStudio simulation.The modified code is the following: ! Calculate Mapping Function and Resolution! Lorenz Martin, 4 Feb 2020! Get number of system wavelengthsnum_wav = SYPR(201)! Define wavelength rangemin_wav = WAVL(1)max_wav = WAVL(num_wav)delta_wav = 0.01num_wav_steps = INTE((max_wav - min_wav)/delta_wav) + 1! Define variablesDECLARE wavelengths, double, 1, num_wav_steps + 1DECLARE y_positions, double, 1, num_wav_steps + 1DECLARE wavelengths_for_d, double, 1, num_wav_stepsDECLARE d_wavelengths, double, 1, num_wav_stepsDECLARE d_y_positions, double, 1, num_wav_stepsDECLARE resolution, double, 1, num_wav_steps! Set MC operand to change Wavelength 1SETMCOPERAND 1, 0, "WAVE", 0! Loop to go through wavelength range and find position of beam on detector with respect to central wavelengthFOR i, 0, num_wav_steps, 1 wavelength = min
Saving ray data ZRD to a file in a loop
Hello together,I’m trying to save Ray Database ZRD to a file in a loop for each angle in the following script:...for angle, -10, 10, 2 x = NSDD (1,0,0,0) SETNSCPOSITION 1,2,6,angle PATHRAY$ = "Rayfile_" + $Str(angle) + ".ZRD" NSTR 1,0,1,1,1,1,1,1,PATHRAY$,"h133",1 UPDATE ALL PAUSE THREADSNEXT This just a part of my script, and exactly this part, namely the saving of ray database is not working. How can I save it, so I could have a few Ray Database files for different angles and open it later with the Ray Database Viewer? What is wrong here?Thank you in advance!CheersMax.
Exporting volume detector data
Hi, I'm quite new to Zemax and was wondering if someone could assist me with processing some volume detector data. I'm currently trying to reconstruct some data from the volume detector and display it in 3D using the Voxel Maker macro. However, the process tends to be quite slow and often crashes with large models. I've written a Matlab script that will pass a binary array and compute the 3D voxelization. However, I need a way of exporting all of the detector cross-sections from Zemax, so that they can be passed by the script. Does anyone know of a way I can do this? I know I can save the individual images seperately within the detector viewer, however, these images will contain the legend and axis titles. It will also be very time-consuming doing this for 100+ cross-sections. Any help would be greatly appreciated! Regards, Callum Here's the link to the macro I was using for reference: How to show Detector Volume data in 3-D · MyZemax
CodeV to opticsStudioConverter-ZPL latest file! Version: 2.06.4 ! August 28, 2019
Need to convert from codeV to Zemax. Can you please provide the latest CodeV to opticsStudioConverter.ZPL macro. The current file is working properly. Following error 0098 SCC C6 0 No mapping for command SCC 0098 Nothing to convert ! Version: 2.06.4 ! August 28, 2019 ! NOTE: This Macro constructs Zemax OS Optical system using Code V seq file 1333 PIK SCO S14 Z2 C8 SCO S14 Z1 C8 1.00162632102796 No mapping for command PIK 1333 Nothing to convert 1334 PIK SCO S14 Z2 C9 SCO S14 Z1 C9 1.00162632102796 No mapping for command PIK 1334 Nothing to convert 1335 PIK SCO S14 Z2 C10 SCO S14 Z1 C10 1.00162632102796 No mapping for command PIK 1335 Nothing to convert 1336 PIK SCO S14 Z2 C11 SCO S14 Z1 C11 1.00162632102796 No mapping for command PIK 1336 Nothing to convert 1337 PIK SCO S14 Z2 C12 SCO S14 Z1
delete solves in Zemax using ZPL
Hi Zemax Community, I have a quick question, is there a command for deleting all solves in the lens file using ZPL? I wasn’t able to find any resources. Would appreciate if someone can point me to the right resources or let me know what command I should use. Thanks![Mod note: moved to more appropriate forum for ZPL-related discussions.]
psf data values in um apart
when i use getpsf in zpl, the result mentioned that there are np data points, and spaced by micrometers apart. what does it mean? Is it the average position between the psf data points? also, the data spacing reduces as pupil sampling increases. do you have some references for me to better understand this results.
Already have an account? Login
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.