summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOnderwaater <onderwaa@esrf.fr>2016-04-06 16:57:31 +0200
committerOnderwaater <onderwaa@esrf.fr>2016-04-06 16:57:31 +0200
commit2a572ec6e9120f6aa93c17af430aac8faeb3f833 (patch)
tree0da2cb3f1f81ea6ee2f29bb7c4c0b13a0b2e5cab
parent66847a9ab58b66008450efdfafafe51aefa942d7 (diff)
spec update bugfix
-rw-r--r--binoculars/backends/id03.py14
-rw-r--r--binoculars/plot.py2
-rwxr-xr-xscripts/binoculars-fitaid2
3 files changed, 15 insertions, 3 deletions
diff --git a/binoculars/backends/id03.py b/binoculars/backends/id03.py
index 5b9cc8c..3e4f324 100644
--- a/binoculars/backends/id03.py
+++ b/binoculars/backends/id03.py
@@ -470,7 +470,12 @@ class ID03Input(backend.InputBase):
UB = numpy.array(self.config.UB)
else:
UB = numpy.array(scan.header('G')[2].split(' ')[-9:], dtype=numpy.float)
- wavelength = float(scan.header('G')[1].split(' ')[-1])
+
+ wavelength = get_wavelength(scan.header('G'), 4, 4)
+ if wavelength is None or wavelength == 0:
+ raise errors.BackendError('No or incorrect wavelength specified in the specfile. Check #G4 4th value')
+
+ print wavelength
self.metadict['UB'] = UB
self.metadict['wavelength'] = wavelength
@@ -857,6 +862,13 @@ class GisaxsDetector(ID03Input):
return ret
+def get_wavelength(G, lineno, index):
+ for line in G:
+ if line.startswith('#G{0}'.format(lineno)):
+ return float(line.split(' ')[index])
+ return None
+
+
def load_matrix(filename):
if filename == None:
return None
diff --git a/binoculars/plot.py b/binoculars/plot.py
index dd16d4a..eb9a607 100644
--- a/binoculars/plot.py
+++ b/binoculars/plot.py
@@ -169,7 +169,7 @@ def plot(space, fig, ax, log=True, loglog=False, clipping=0.0, fit=None, norm=No
data = space.get()
mask = numpy.bitwise_or(~numpy.isfinite(data), data == 0)
gridx, gridy, gridz = tuple(grid[~mask] for grid in space.get_grid())
- im = ax.scatter(gridx, gridy, gridz, c=cmap(norm(data[~mask])), marker=', ', alpha=0.7, linewidths=0)
+ im = ax.scatter(gridx, gridy, gridz, c=cmap(norm(data[~mask])), marker=',' , alpha=0.7, linewidths=0)
#p1 = ax.plot_surface(gridx[0,:,:], gridy[0,:,:], gridz[0,:,:], facecolors=cmap(norm(space.project(0).get_masked())), shade=False, cstride=1, rstride=1)
#p2 = ax.plot_surface(gridx[:,-1,:], gridy[:,-1,:], gridz[:,-1,:], facecolors=cmap(norm(space.project(1).get_masked())), shade=False, cstride=1, rstride=1)
diff --git a/scripts/binoculars-fitaid b/scripts/binoculars-fitaid
index 08ca823..5da66dd 100755
--- a/scripts/binoculars-fitaid
+++ b/scripts/binoculars-fitaid
@@ -726,7 +726,7 @@ class FitWidget(QtGui.QWidget):
def fit(self, index, space, function):
print(index)
if not len(space.get_masked().compressed()) == 0:
- loc = get_loc(index)
+ loc = self.get_loc()
fit = function(space, loc = loc)
fit.fitdata.mask = space.get_masked().mask
self.database.save_data(index, 'fit', fit.fitdata)