Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Indranil,
I've added some functionalities to the zDDE library, which might be of interest. The functionalities include:
1) The addition of a property to check the current connection status
2) I ran into problems with some command that are based on writing the result to a text file and then reading the textfile (such as zGetZernike()). On some computers, the decimal separators in these files are commas in stead of points. This resulted in ValueErrors, for instance in
meta.append(float(_re.search(r'\d{1,3}\.\d{4,8}', meta_line).group()))
in line 9790 of the zdde code.
To circumvent this valueError, I added the function
checkDecimalSeparators(string)
to pyzdde/zfileutils.py and implemented it in the _getDecodedLineFromFile() function in pyzdde/zdde.py.The function uses the regular expression
'((?<=\d)|(?<=\A)|(?<=-)|(?<=\s))'
to search for commas in strings that represent decimal separators and replace them by points.It will do perform the following conversions:
'0,0' --> '0.0'
',0' --> '.0'
' ,0' --> ' .0'
'-,0' --> '-.0'
It will not perform the following conversions:
'1,' --> 1.
'a,1' --> a.1
'1,a' -->1.a
'a,a' --> 'a.a'
'a,' --> 'a.'
',a' --> '.a
' ,a' --> ' .a
I've updated the regex twice in additional commits, if necessary, it can be updated for different behavior.
3) I updated zGetZernike() to handle instances where the Zernikes cannot be traced. For now, I chose to return a namedTuple filled with np.NaN on these occurrences, where the tuple is filled with the maximum amount of Zernike coefficients that you can acquire (37 for fringe, 231 for standard and annular Zernikes), in order to circumvent loops from running into errors.
Kind regards,
Luc