Skip to content

Commit 0445d08

Browse files
committed
Fix pyFAI version processing.
Compared parsed versions do not compare version strings. Former-commit-id: 0bf1aaf715cc4d0f0778591aecf5c4a4db1044aa
1 parent f3fa036 commit 0445d08

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

dpx/srxplanargui/calibration.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@
4545
else:
4646
missingpyFAI = True
4747

48+
# determine option name for calibrant used in pyFAI-calib
49+
# The current option is "-c", but it was "-S" in 0.9.3.
50+
pyFAIcalib_opt_calibrant = '-c'
51+
if not missingpyFAI:
52+
from pkg_resources import parse_version
53+
if parse_version(pyFAI.version) <= parse_version('0.9.3'):
54+
pyFAIcalib_opt_calibrant = '-S'
55+
del parse_version
56+
57+
4858
class CalibrationHandler(Handler):
4959

5060
def closed(self, info, is_ok):
@@ -138,10 +148,7 @@ def callPyFAICalibration(self, image=None, dspacefile=None):
138148

139149
calicmd = [self.pythonbin, self.caliscript]
140150
calicmd.extend(['-w', str(self.wavelength)])
141-
if pyFAI.version <= '0.9.3':
142-
calicmd.extend(['-S', str(dspacefile)])
143-
else:
144-
calicmd.extend(['-c', str(dspacefile)])
151+
calicmd.extend([pyFAIcalib_opt_calibrant, str(dspacefile)])
145152
calicmd.extend(['-p', str(ps[0]) + ',' + str(ps[1])])
146153
calicmd.extend([str(image)])
147154

0 commit comments

Comments
 (0)