Comments (3)
Hi Ben,
Thanks very much for spreading the word.
I have seen these type of problems a few times before (that's the reason why I decided to put the "assert ret == 0" in order to localize the error. Although I don't have an exact solution, but I have noted a few things that could potentially result in this type of problem:
- The first thing to check would be that the text encoding between PyZDDE and Zemax is the same. To see the text encoding set in PyZDDE use
pyz.getTextEncoding()
, assuming you have doneimport pyzdde.zdde as pyz
at the beginning. To set the text encoding, usepyz.setTextEncoding()
. - If the filename(s) of the text or (especially) the .cfg file is very long (I don't have an estimate of how long). I have seen this problem when I tried to do "image simulation", and I have documented it (under the "NOTE" section at the beginning of this IPython notebook. Using a shorter name for the .cfg file generally works OK. In order to debug, I would copy the .cfg file to some temporary directory (e.g.
C:\tmp
), and provide a very short names (e.g.c:\tmp\tmp.txt
, andc:\tmp\<lens_filename.cfg>
) to ensure that the function works. Also, I would setkeepFile=True
to see what file has been dumped. - If step 2 works, fine then the problem could be due to long file name or due to access permission to a particular directory in Windows.
- If step 2 didn't work, then there could be a problem with the settings file (I understand that the likelihood of this is very small. Generally, if the .cfg file is not valid, Zemax is supposed to use the default .cfg file .... however, I have seen a problem like this when I tried to do "Image simulation". In that case, the error is generally sometime like
IOError: [Errno 2] No such file or directory: ...
- See if it related to #55 ().
I wish Zemax would have returned a more useful error code.
I hope that helps.
Best regards,
Indranil.
from pyzdde.
Hello Indranil,
Thanks much for the help! We already checked your first point and made sure the text encoding is correct. I think that you second point may be spot on because the path he's using is quite long, I'll suggest him to put the Zemax files somewhere else and see if it works well.
By the way, I tested a script using zGetPSF on yet another colleague's computer (did I tell you about spreading the word ;-) ), and found a small issue while trying to read the 2D psf_data. Indeed, the zdde regex is looking for number where the exponent contains 3 digits while for some reasons, the text file returned by zemax/OS on my other colleague's computer has only two digits. To prevent this I would suggest transforming the current pattern:
pat = (r'(-?\d.\d{4,6}[Ee][-+]\d{3}\s*)' + r'{{{num}}}'
.format(num=img_grid_x))
into:
pat = (r'(-?\d.\d{4,6}[Ee][-+]\d{2,3}\s*)' + r'{{{num}}}'
.format(num=img_grid_x))
Cheers,
Ben
from pyzdde.
Hi Ben,
Thanks very much for the suggestion on the regex pattern. I will update the code based on your suggestion. Till then I will keep this issue open.
Best regards,
Indranil.
from pyzdde.
Related Issues (20)
- Assembling zSetField return tuple in Opticstudio 17.5 broken HOT 1
- WindowsError: [Error 126]
- Problem getting RMS Field Map Data out as a Text File HOT 3
- which versions of zemax are compatible
- Error message : UTF-16 stream does not start with BOM HOT 1
- Error of zGetSurfaceData HOT 1
- Which Zemax version is required?
- Closing ZRD file before raising Exception in pyzdde.zfileutils.readZRDFile
- PyZDDE giving different results than Zemax HOT 3
- zSetField not working HOT 3
- Is the NOBJ(surface) command supported? HOT 1
- zSetNSCProperty(1, 1, 0, 86, "1,2,1") to set the wavelength shift string doesn't work HOT 11
- Is there a set glass data functionality? HOT 5
- Zemax subscription model breaks DDE - fixed promised by Zemax HOT 5
- zGetImageSimulation not working HOT 2
- Problem getting zGetZernike about list indices HOT 12
- ERROR: Unable to establish a conversation with server (err=0x400a). HOT 5
- GetPSF with OpticStudio 20.3.1
- ZBF file created with PyZDDE
- ImportError: bad magic number in 'pyzdde.arraytrace': b'\x03\xf3\r\n' HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyzdde.