diff --git a/Code/Mantid/scripts/reduction/instruments/sans/sans_reduction_steps.py b/Code/Mantid/scripts/reduction/instruments/sans/sans_reduction_steps.py
index 260bdd3..12ebbe3 100644
|
a
|
b
|
class SampleGeomCor(ReductionStep): |
| 750 | 750 | ORNL only divides by thickness, in the absolute scaling step |
| 751 | 751 | |
| 752 | 752 | """ |
| 753 | | def execute(self, reducer, workspace): |
| 754 | | """ |
| 755 | | Divide the counts by the volume of the sample |
| 756 | | """ |
| 757 | | self.geo = reducer._sample_run.geometry |
| 758 | | assert( issubclass(self.geo.__class__, GetSampleGeom)) |
| | 753 | def __init__(self): |
| | 754 | self.volume = 1.0 |
| | 755 | |
| | 756 | def calculate_volume(self, reducer): |
| | 757 | geo = reducer.get_sample().geometry |
| | 758 | assert( issubclass(geo.__class__, GetSampleGeom)) |
| 759 | 759 | |
| 760 | 760 | try: |
| 761 | | if self.geo.shape == 'cylinder-axis-up': |
| | 761 | if geo.shape == 'cylinder-axis-up': |
| 762 | 762 | # Volume = circle area * height |
| 763 | 763 | # Factor of four comes from radius = width/2 |
| 764 | | volume = self.geo.height*math.pi |
| 765 | | volume *= math.pow(self.geo.width,2)/4.0 |
| 766 | | elif self.geo.shape == 'cuboid': |
| | 764 | volume = geo.height*math.pi |
| | 765 | volume *= math.pow(geo.width,2)/4.0 |
| | 766 | elif geo.shape == 'cuboid': |
| 767 | 767 | # Flat plate sample |
| 768 | | volume = self.geo.width |
| 769 | | volume *= self.geo.height*self.geo.thickness |
| 770 | | elif self.geo.shape == 'cylinder-axis-along': |
| | 768 | volume = geo.width |
| | 769 | volume *= geo.height*geo.thickness |
| | 770 | elif geo.shape == 'cylinder-axis-along': |
| 771 | 771 | # Factor of four comes from radius = width/2 |
| 772 | 772 | # Disc - where height is not used |
| 773 | | volume = self.geo.thickness*math.pi |
| 774 | | volume *= math.pow(self.geo.width, 2)/4.0 |
| | 773 | volume = geo.thickness*math.pi |
| | 774 | volume *= math.pow(geo.width, 2)/4.0 |
| 775 | 775 | else: |
| 776 | | raise NotImplemented('Shape "'+self.geo.shape+'" is not in the list of supported shapes') |
| | 776 | raise NotImplemented('Shape "'+geo.shape+'" is not in the list of supported shapes') |
| 777 | 777 | except TypeError: |
| 778 | | raise TypeError('Error calculating sample volume with width='+str(self._width) + ' height='+str(self._height) + 'and thickness='+str(self._thickness)) |
| 779 | | |
| 780 | | ws = mtd[workspace] |
| 781 | | ws /= volume |
| | 778 | raise TypeError('Error calculating sample volume with width='+str(geo.width) + ' height='+str(geo.height) + 'and thickness='+str(geo.thickness)) |
| | 779 | |
| | 780 | return volume |
| | 781 | |
| | 782 | def execute(self, reducer, workspace): |
| | 783 | """ |
| | 784 | Divide the counts by the volume of the sample |
| | 785 | """ |
| | 786 | if not reducer.is_can(): |
| | 787 | # it calculates the volume for the sample and may or not apply to the can as well. |
| | 788 | self.volume = self.calculate_volume(reducer) |
| | 789 | |
| | 790 | ws = mtd[str(workspace)] |
| | 791 | ws /= self.volume |
| 782 | 792 | |
| 783 | 793 | class StripEndZeros(ReductionStep): |
| 784 | 794 | # ISIS only |