Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with saving NSC Detector text file #79

Open
shbhuk opened this issue Dec 13, 2017 · 6 comments · May be fixed by #104
Open

Issues with saving NSC Detector text file #79

shbhuk opened this issue Dec 13, 2017 · 6 comments · May be fixed by #104

Comments

@shbhuk
Copy link

shbhuk commented Dec 13, 2017

Hi,
This is following issue #71
I get the following error on trying to use

self.ln.zGetDetectorViewer(displayData=True,settingsFile=settingsFile,txtFile=txtfile,keepFile=True,timeout=600)



C:\Users\shbhu\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\pyzdde\zfileutils.py in readDetectorViewerTextFile(pyz, textFileName, displayData)
    649     >>> info, gridData = zfu.readDetectorViewerTextFile(pyz, textFileName, True)
    650     """
--> 651     line_list = pyz._readLinesFromFile(pyz._openFile(textFileName))
    652     # Meta data
    653     detNumSurfNumPat = r'Detector\s*\d{1,4}\s*,\s*NSCG\sSurface\s*\d{1,4}'
C:\Users\shbhu\AppData\Local\Enthought\Canopy\edm\envs\User\lib\site-packages\pyzdde\zdde.py in _openFile(fileName)
  12143     global _global_use_unicode_text
  12144     if _global_use_unicode_text:
> 12145         f = open(fileName, u'rb')
  12146     else:
  12147         f = open(fileName, 'r')
FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/shbhu/Desktop/test.txt' 

I checked the source code, and this function which GetDetectorViewer() calls -

 ret = self.zGetTextFile(textFileName, 'Dvr', cfgFile, getTextFlag,
                               timeout)

This function runs without error and returns 0. However it is not creating the textFile. Thus the zfileutils are giving an error.

This sends the following DDE command -


            cmd = 'GetTextFile,"{tF}",{aT},"{sF}",{fl:d}'.format(tF=textFileName,
                                    aT=analysisType,sF=settingsFile,fl=flag)
            reply = self._sendDDEcommand(cmd, timeout)

This command runs without error and returns 'OK' when I call it -
cmd = 'GetTextFile,"{tF}",{aT},"{sF}",{fl:d}'.format(tF=loc+'test.txt', aT='Dvr',sF='',fl=0)

However, there is no file generated in the directory specified by 'loc'

@shbhuk
Copy link
Author

shbhuk commented Dec 13, 2017

ln.zSaveDetector(1,det_zmxobj_no,fileName=txtfile[:-4]+'.ddr') returns 0 but no .DDR file is created.

Seems to be related?

ln.zSaveDetector(1,det_zmxobj_no,fileName='test.ddr') creates a file called Zemaxtest.ddr in
'C:/Users/shbhu/Documents/'

I am using Zemax 17 and Python 3.5

@shbhuk
Copy link
Author

shbhuk commented Jan 22, 2018

Hi @indranilsinharoy , Did you get time to look at this?

@indranilsinharoy
Copy link
Collaborator

Hi @shbhuk ,

Unfortunately, since I moved to a new job, I don't have a Zemax license right now. Therefore, I hope someone else with a Zemax key can resolve your issue. I'm very sorry.

Best Regards,
Indranil.

@shbhuk
Copy link
Author

shbhuk commented Feb 1, 2018

Hi @indranilsinharoy ,
Best of luck with your new job.

Shubham

jrphysics added a commit to jrphysics/PyZDDE that referenced this issue Nov 3, 2020
Change number of digits in exponential (can be less than 3).

This fixes xzos#71 xzos#79.
@jrphysics
Copy link

jrphysics commented Nov 3, 2020

@shbhuk This is caused by the number of digits in the exponential for intensity / power values. The code is looking for 3 to 8, while some people have just 2.

@indranilsinharoy The ethernal license problem! I've sent a PR #103.

@shbhuk
Copy link
Author

shbhuk commented Nov 5, 2020

Great, thanks!

@jrphysics jrphysics linked a pull request Nov 20, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants