Skip to content

Commit 5ac36b3

Browse files
committed
fix import of non-Q .xye/.chi that has a wavelength in header
1 parent 41b29e4 commit 5ac36b3

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

GSASII/GSASIIscriptable.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5100,12 +5100,13 @@ def HAPvalue(self, param=None, newValue=None, targethistlist='all'):
51005100
:param str param: is a parameter name, which can be 'Scale' or
51015101
'PhaseFraction' (either can be used for phase
51025102
fraction), 'Use', 'Extinction', 'LeBail', 'PO'
5103-
(for Prefered Orientation).
5103+
(for Preferred Orientation).
51045104
If not specified or invalid
51055105
an exception is generated showing the list of valid parameters.
5106-
At present, these HAP parameters cannot be access with this function:
5107-
'Size', 'Mustrain', 'HStrain', 'Babinet'. On request this
5108-
might be addressed in the future. Some of these values can be set via
5106+
At present, only these HAP parameters cannot be accessed with
5107+
this function: 'Size', 'Mustrain', 'HStrain', 'Babinet'.
5108+
This might be addressed in the future.
5109+
Some of these values can be set via
51095110
:meth:`G2Phase.set_HAP_refinements`.
51105111
:param newValue: the value to use when setting the HAP parameter for the
51115112
appropriate histogram(s). Will be converted to the proper type or

GSASII/imports/G2pwd_xye.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
'''
66

77
from __future__ import division, print_function
8-
import os.path as ospath
8+
import os.path
99
import numpy as np
1010
from .. import GSASIIobj as G2obj
1111
from .. import GSASIIpath
@@ -38,9 +38,10 @@ def ContentsValidator(self, filename):
3838
Qchi = False
3939
self.Wave = None
4040
fp = open(filename,'r')
41-
if '.chi' in filename:
41+
ext = os.path.splitext(filename)[1]
42+
if ext == '.chi':
4243
self.Chi = True
43-
if '.qchi' in filename:
44+
if ext == '.qchi':
4445
Qchi = True
4546
if2theta = False
4647
ifQ = False
@@ -83,7 +84,7 @@ def ContentsValidator(self, filename):
8384
gotCcomment = True
8485
continue
8586
if S[0] in ["'",'#','!']:
86-
if 'wavelength' in S and not self.Wave:
87+
if 'wavelength' in S and not self.Wave and '.q' in ext:
8788
wave = S.split()[2]
8889
if wave:
8990
try:
@@ -212,7 +213,7 @@ def Reader(self,filename, ParentFrame=None, **unused):
212213
self.powderentry[0] = filename
213214
#self.powderentry[1] = pos # bank offset (N/A here)
214215
#self.powderentry[2] = 1 # xye file only has one bank
215-
self.idstring = ospath.basename(filename)
216+
self.idstring = os.path.basename(filename)
216217
# scan comments for temperature
217218
Temperature = 300.
218219
for S in self.comments:

0 commit comments

Comments
 (0)