Skip to content

Commit

Permalink
Added new geometry algorith. This refs #10448
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Oct 28, 2014
1 parent 524ed8c commit fc14b26
Showing 1 changed file with 35 additions and 34 deletions.
Expand Up @@ -5,6 +5,7 @@
import os.path
import sys
import math
from reduction.instruments.reflectometer import wks_utility

PRECISION = 0.020

Expand Down Expand Up @@ -63,6 +64,8 @@ class sfCalculator():
y_axis_error_ratio = None
x_axis_ratio = None

is_nexus_detector_rotated_flag = True

def __init__(self, numerator=None, denominator=None,
tof_range=None):

Expand Down Expand Up @@ -223,8 +226,8 @@ def _calculateFinalYAxis(self, bNumerator=True):
nexus_file_numerator = file
print '----> loading nexus file: ' + nexus_file_numerator
EventDataWks = LoadEventNexus(Filename=nexus_file_numerator)
# OutputWorkspace='EventDataWks')
# mt1 = mtd['EventDataWks']

self.is_nexus_detector_rotated_flag = wks_utility.isNexusTakeAfterRefDate(EventDataWks.getRun().getProperty('run_start').value)

proton_charge = self._getProtonCharge(EventDataWks)
print '----> rebinning '
Expand Down Expand Up @@ -403,33 +406,23 @@ def _createIntegratedWorkspace(self,
# y_error_axis[y, :] += ((InputWorkspace.readE(index)[:]) *
# (InputWorkspace.readE(index)[:]))

#case 1
print 'using case 1'
for x in range(304):
for y in y_range:
index = int(y+x*256)
# y_axis[y, :] += InputWorkspace.readY(index)[:]
y_axis[y, :] += InputWorkspace.readY(index)[:]
y_error_axis[y, :] += ((InputWorkspace.readE(index)[:]) *
(InputWorkspace.readE(index)[:]))

## case 2
# for x in range(304):
# for y in range(256):
# index = int(x+y*304)
## y_axis[y, :] += InputWorkspace.readY(index)[:]
# y_axis[y, :] += InputWorkspace.readY(index)[:]
# y_error_axis[y, :] += ((InputWorkspace.readE(index)[:]) *
# (InputWorkspace.readE(index)[:]))


# for x in range(self.alpha_pixel_nbr):
# for y in range(256):
# index = int(self.beta_pixel_nbr * x + y)
## y_axis[y, :] += InputWorkspace.readY(index)[:]
# y_axis[y, :] += InputWorkspace.readY(index)[:]
# y_error_axis[y, :] += ((InputWorkspace.readE(index)[:]) *
# (InputWorkspace.readE(index)[:]))
if self.is_nexus_detector_rotated_flag:
for x in range(256):
for y in y_range:
index = int(y+x*304)
# y_axis[y, :] += InputWorkspace.readY(index)[:]
y_axis[y, :] += InputWorkspace.readY(index)[:]
y_error_axis[y, :] += ((InputWorkspace.readE(index)[:]) *
(InputWorkspace.readE(index)[:]))

else:
for x in range(304):
for y in y_range:
index = int(y+x*256)
# y_axis[y, :] += InputWorkspace.readY(index)[:]
y_axis[y, :] += InputWorkspace.readY(index)[:]
y_error_axis[y, :] += ((InputWorkspace.readE(index)[:]) *
(InputWorkspace.readE(index)[:]))

# #DEBUG
# f=open('/home/j35/myASCIIfromCode.txt','w')
Expand Down Expand Up @@ -539,11 +532,19 @@ def _removeBackground(self,
nbr_tof = len(tof_axis)-1

# make big array of data
data = zeros((256,nbr_tof))
error = zeros((256,nbr_tof))
for x in range(256):
data[x,:] = InputWorkspace.readY(x)[:]
error[x,:] = InputWorkspace.readE(x)[:]
if self.is_nexus_detector_rotated_flag:
data = zeros((304,nbr_tof))
error = zeros((304,nbr_tof))
for x in range(304):
data[x,:] = InputWorkspace.readY(x)[:]
error[x,:] = InputWorkspace.readE(x)[:]

else:
data = zeros((256,nbr_tof))
error = zeros((256,nbr_tof))
for x in range(256):
data[x,:] = InputWorkspace.readY(x)[:]
error[x,:] = InputWorkspace.readE(x)[:]

peak_array = zeros(nbr_tof)
peak_array_error = zeros(nbr_tof)
Expand Down

0 comments on commit fc14b26

Please sign in to comment.