-
Notifications
You must be signed in to change notification settings - Fork 67
08. News and updates
- Fixed issues #65, #66, which arose due to a recent format change adopted in the latest version of OpticStudio in the text files outputted by OpticStudio.
-
Added new APR (Automatic Push Refresh) mode for efficient interactivity with the lens in main Zemax window (LDE) from a Python shell. This mode avoids the repeated use of push and refresh commands to move a lens back and forth between the LDE and the DDE server. See a quick demo here
-
Added a new module called misc (import as pyzdde.misc). This module is intended to contain a collection of useful functions that make use of the core pyzdde functions.
-
Removed the redundant function
ipzCaptureWindow2()
-
Added several helper functions to directly modify lens parameters in the LDE like
zGetSemiDiameter()
,zGetThickness()
,zSetThickness()
,zGetRadius()
, etc. Other functions added includezGetMagnification()
,zGetAngularMagnification()
,ipzGetFieldData()
,zAnyOffAxisField()
, etc. -
Fixed bug in the function
zTiltDecenterElements()
. See issue 59. -
Fixed html based rich text display issue for displaying operand and button codes in Jupyter notebook.
-
Added useful fields to the
PSFinfo
metadata returned by the functionzGetPsf()
. See here for details. Thanks Ben
No significant update between 2.0.0 and 2.0.1. (The minor version number needed to be bumped in order to fix a README.rst rendering problem in the PyPI website)
-
Added the following NSC helper functions:
zSetNSCPositionTuple()
zInsertNSCSourceEllipse()
zInsertNSCSourceRectangle()
zInsertNSCEllipse()
zInsertNSCRectangle()
zInsertNSCDetectorRectangle()
zNSCDetectorClear()
-
Removed asymmetry in several function parameters names. PLEASE NOTE that this change has the potential of breaking existing code. However, I hope that in the long run these changes will be beneficial as it provides a much cleaner and uniform parameter-naming scheme. The following list shows the parameters that were renamed in several functions.
-
surfaceNumber
==>surfNum
-
objectNumber
==>objNum
-
surfNumber
==>surfNum
-
objNumber
==>objNum
-
detectorObjNum
==>detectNum
-
faceNumber
==>faceNum
-
paramNumber
==>paramNum
-
parameter
==>param
-
operandNumber
==>operNum
-
columnNumber
==>colNum
-
configNumber
==>configNum
-
bufferNumber
==>bufferNum
-
dataNumber
==>dataNum
-
windowNumber
==>windowNum
-
apertureValue
==>aperVal
-
settingsFileName
==>settingsFile
-
objNumSrc
==>srcNum
-
PyZDDE installable package available through PyPI
The default text encoding was changed from 'ascii' to 'unicode' to reflect the default behaviour of latest OpticStudio.
- Added a new module called
zfileutils
. This module shall contain all helper functions related to reading and writing to files used by OpticStudio, such asreadZRDFile()
,writeZRDFile()
,readBeamFile()
,writeBeamFile()
,gridSagFile()
, etc. See a brief description of the top level modules here. - New functions in
zdde
module:-
zTiltDecenterElements()
: function emulates the behavior ofTiltDecenterElements
lens modification feature of Zemax. -
gridSagFile()
andrandomGridSagFile()
: added tozfileutils
module, these helper functions can help quickly create grid sag surfaces with extensions .DAT or .GRD as described in the manual.
-
- Improvements to existing functions:
-
zGetPOP()
: modified such that the function also returns the surface number in thepopinfo
field. Also changed the names of input argumentsstart_surf
andend_surf
tostartSurf
andendSurf
. -
zImportExtraData()
: minor improvements to appropriately parse return value from Zemax.
-
- Several other improvements to code including:
- addition of mnemonic codes as PyZDDE class variables to specify parameters for functions such as
setSolve()
,getSolve()
that can be easily understood during code reading. - minor improvements in unittest module.
- addition of mnemonic codes as PyZDDE class variables to specify parameters for functions such as
This is a major release as PyZDDE is now feature complete with the addition of array tracing functions.
A separate and standalone array tracing module (pyzdde.arraytrace
) was added that can be used independently (and simultaneously if required) with the existing pyzdde.zdde
module. This module, which is useful for doing array ray tracing as described in Zemax manual, defines the DDE ray data structure using ctypes, and provides the following two main functions:
-
zArrayTrace()
-- The main function for calling Zemax for array ray tracing -
getRayDataArray()
-- Helper function that creates the ctypes ray data structure array, fills up the first element and returns the array
In addition to the above two functions, the following helper functions are provided that supports 5 different modes discussed in the Zemax manual
zGetTraceArray()
zGetTraceDirectArray()
zGetPolTraceArray()
zGetPolTraceDirectArray()
zGetNSCTraceArray()
The functions have been tested functionally, so I am quite confident about its reliability. I am sure the performance could be tweaked in future releases. There are two examples in "Examples/Scripts" folder that emulate the standard "ArrayDemo.c" and "NSCTraceDemo.c" code examples which are shipped with Zemax. The outputs from the Python code examples exactly match the outputs of the c examples supplied by Zemax. In addition, a script (parityAndSpeedTestOfArrayTracingFuncs.py) to compute the running time of the functions and verify the outputs of the helper functions has been added to "Examples/Misc" folder.
Thanks to Ian Rousseau and Julian Stürmer for their help on the array ray tracing module. Ian sent me a working code for tracing large number of rays sometime back, which gave me some crucial ideas about the current implementation. Julian, who was also successful in implementing array ray tracing using ctypes, communicated several ideas with me about the implementation.
We have also added a new function, zGetZernike()
that returns the Zernike Fringe, Standard, or Annular coefficients for the currently loaded lens file. It provides similar functionality as the ZPL command "GETZERNIKE".
- Function
zGetPolTraceDirect()
inpyzdde.zdde
fixed -- the parameterz
was getting assigned toy
during the creation of dde command, and the command itself was not accurate as it was missing the commas between the sub-commands. - There was similar problems (missing commas) with the function
zGetPolTrace()
that has been fixed.
- Functions
zGetNSCSettings()
,zGetPolTrace()
andzGetPolTraceDirect()
updated to returned Python namedtuple - Changed the field names of the namedtuples returned by the functions
zGetTrace()
andzGetTraceDirect()
fromerrorCode
toerror
andvigCode
tovig
.
The following functions (27) were added in this release:
-
zGetPSFCrossSec()
, -
zModifyFFTPSFSettings()
, -
zSetFFTPSFCrossSecSettings()
, -
zSetHuygensPSFCrossSecSettings()
, -
zModifyHuygensPSFCrossSecSettings()
, -
zGetPSF()
, -
zSetFFTPSFSettings()
, -
zModifyFFTPSFSettings()
, -
zSetHuygensPSFSettings()
, -
zModifyHuygensPSFSettings()
, -
zGetMTF()
, -
zSetFFTMTFSettings()
, -
zModifyFFTMTFSettings()
, -
zSetHuygensMTFSettings()
, -
zModifyHuygensMTFSettings()
, -
zGetImageSimulation()
, -
zSetImageSimulationSettings()
, -
zModifyImageSimulationSettings()
,
-
readBeamFile()
[thanks to @CatherineH (github)], -
writeBeamFile()
[(thanks to @CatherineH github)], -
zGetNumField()
, -
zGetNumSurf()
, -
zGetNumWave()
, -
zGetImageSpaceNA()
, -
zGetIndexPrimWave()
,
These functions (more shall be added in future) are utility functions to quickly create simple optical systems
-
zMakeIdealThinLens()
(inpyzdde.systems module
), -
zMakeIdealCollimator()
(inpyzdde.systems module
),
zCalculateHiatus()
to zGetHiatus()
- long parameter names for some functions were shortened for better interactivity.
- several internal helper functions (in addition to the above) were added to support the above functions.
- Added 3 functions for Physical Optics Propagation (POP) analysis. Big thanks to @CatherineH [github]. The functions added are
zGetPOP()
,zSetPOPSettings()
, andzModifyPOPSettings()
. - Although there were no API changes, there is a slight chance that code using earlier versions of PyZDDE may break. This is because of the code clean-up that has happened. Specifically, the parameter names of the following functions were shortened:
-
zGetMetaFile()
::settingsFileName
tosettingsFile
-
zGetTextFile()
::settingsFileName
tosettingsFile
-
zCalcuateHiatus()
::txtFileName2Use
totxtFile
-
zGetSeidelAberration()
::txtFileName2Use
totxtFile
-
ipzCaptureWindow()
::settingsFileName
tosettingsFile
-
- Added helper functions to easily and quickly create and close DDE communication link objects. Interface functions added include pyz.createLink(), pyz.closeLink() and link.close().
So now, instead of calling
ln = pyz.PyZDDE()
and thenln.zDDEInit()
, the user can just callpyz.createLink()
which will instantiate a PyZDDE object, initialize it and return the object. For closing communication the user can either callln.close()
(which is a method bound to the particular DDE link instance) or callpyz.closeLink(link=None)
. This method allows the user to close a particular link (if there are 2 simultaneous links) or close all live links. It is recommended to use these methods for creating and closing links as they are easy and quick to use and manages all the creation and cleaning of link objects for you. Note that existing programs will not break because internally these helper functions use the existing API for creating and closing DDE links. - Renamed
ipzCaptureWindow2()
toipzCaptureWindow()
becauseipzCaptureWindow2()
is a better function and was used most often. Again, as above, existing code usingipzCaptureWindow2()
will not break because the function remains defined and just re-directs calls toipzCaptureWindow()
. Renamed the low quality image capture function (originally named asipzCaptureWindow()
) toipzCaptureWindowLQ()
. - Code re-factoring in several places to make the logic better and more Pythonic.
- Several
zGetxxx
functions were modified to return namedtuples instead of tuples for better human understanding. (Not all functions are converted; this will be an ongoing process for some time) - Bug fix. A bug was introduced in the previous version (v0.7.5) in function
spiralSpot()
when the list comprehensions were converted to generator expressions for better memory efficiency. The generated values of 'theta' were getting consumed at twice the rate of consumption of 'r' since both 'r' and 'pXY' were requesting for 'theta' from the same source. It has been fixed.
- Added support for using Unicode text encoding in Zemax (using two module level functions
setTextEncoding
andgetTextEncoding
) - Fixed issue #24 link to support extended ASCII characters.
- API change of the function
zPushLens
: The argument "updateFlag" was changed to just "update". Less tying is good for interactive programming.
- Added support for Python 3.3 and above along with Python 2.7
- Removed using PyWin32 for DDEML communication. PyZDDE will only use ddeclient.
- Bug fix in functions
zGetSystemProperty
andzGetPolTraceDirect
.
- Added ability to set timeout value both globally to all functions for communicating with ZEMAX and individually for some functions which may require higher value of timeout.
- Moved dde request handling from PyWin32 to
dde_backup
module in pyzdde (this is now the default behavior) as PyWin32 dde requests didn't allow to change dde timeout value. - Couple of figure handling utility functions added for quick handling of image arrays.
- Added backup
dde
module that can be used by PyZDDE if pywin32'sdde
module results in import error.
- Feature addition - option to return pixel array of graphical analysis windows using
ipzCaptureWindow2
instead of embedding figure into an IPython notebook or QtConsole. - Couple of bug-fixes.
- Published Zemax knowledge-base article "Talking to ZEMAX from Python using PyZDDE"
This work by PyZDDE contributors is licensed under a Creative Commons Attribution 4.0 International License.
Based on a work at https://github.com/indranilsinharoy/PyZDDE.