def ProcessVana(rnum, cycle): # Preparation of the V/Nd sphere run for SX normalization mantid.LoadRaw(Filename='/archive/NDXWISH/Instrument/data/cycle_' + cycle + '/WISH000' + str(rnum) + '.raw', OutputWorkspace='Vana', LoadMonitors='Separate') mantid.CropWorkspace(InputWorkspace='Vana', OutputWorkspace='Vana', XMin=6000, XMax=99000) mantid.NormaliseByCurrent(InputWorkspace='Vana', OutputWorkspace='Vana') mantid.ConvertUnits(InputWorkspace='Vana', OutputWorkspace='Vana', Target='Wavelength') # create Abs Correction for V shape = '''<sphere id="V-sphere"> <centre x="0.0" y="0.0" z="0.0" /> <radius val="0.0025"/> </sphere>''' mantid.CreateSampleShape('Vana', shape) mantid.SetSampleMaterial('Vana', SampleNumberDensity=0.0719, ScatteringXSection=5.197, AttenuationXSection=4.739, ChemicalFormula='V0.95 Nb0.05') mantid.AbsorptionCorrection(InputWorkspace='Vana', OutputWorkspace='Abs_corr', ElementSize=0.5) # SphericalAbsorption(InputWorkspace='WISH00038428', OutputWorkspace='Abs_corr_sphere', SphericalSampleRadius=0.25) # correct Vanadium run for absorption mantid.Divide(LHSWorkspace='Vana', RHSWorkspace='Abs_corr', OutputWorkspace='Vana_Abs') mantid.DeleteWorkspace('Vana') mantid.DeleteWorkspace('Abs_corr') # Smoot data with redius 3 mantid.SmoothNeighbours(InputWorkspace='Vana_Abs', OutputWorkspace='Vana_smoot', Radius=3) mantid.DeleteWorkspace('Vana_Abs') # SmoothData38428 mantid.SmoothData(InputWorkspace='Vana_smoot', OutputWorkspace='Vana_smoot1', NPoints=300) mantid.DeleteWorkspace('Vana_smoot')
def generate_vanadium_absorb_corrections(van_ws, output_filename): shape_ws = mantid.CloneWorkspace(InputWorkspace=van_ws) shape_ws = mantid.ConvertUnits(InputWorkspace=shape_ws, OutputWorkspace=shape_ws, Target="Wavelength") mantid.CreateSampleShape(InputWorkspace=shape_ws, ShapeXML='<sphere id="sphere_1"> <centre x="0" y="0" z= "0" />\ <radius val="0.005" /> </sphere>') absorb_ws = \ mantid.AbsorptionCorrection(InputWorkspace=shape_ws, AttenuationXSection="5.08", ScatteringXSection="5.1", SampleNumberDensity="0.072", NumberOfWavelengthPoints="25", ElementSize="0.05") mantid.SaveNexus(Filename=output_filename, InputWorkspace=absorb_ws, Append=False) common.remove_intermediate_workspace(shape_ws) return absorb_ws
def generate_vanadium_absorb_corrections(van_ws): raise NotImplementedError("Generating absorption corrections needs to be implemented correctly") # TODO are these values applicable to all instruments shape_ws = mantid.CloneWorkspace(InputWorkspace=van_ws) mantid.CreateSampleShape(InputWorkspace=shape_ws, ShapeXML='<sphere id="sphere_1"> <centre x="0" y="0" z= "0" />\ <radius val="0.005" /> </sphere>') calibration_full_paths = None absorb_ws = \ mantid.AbsorptionCorrection(InputWorkspace=shape_ws, AttenuationXSection="5.08", ScatteringXSection="5.1", SampleNumberDensity="0.072", NumberOfWavelengthPoints="25", ElementSize="0.05") mantid.SaveNexus(Filename=calibration_full_paths["vanadium_absorption"], InputWorkspace=absorb_ws, Append=False) common.remove_intermediate_workspace(shape_ws) return absorb_ws
def _generate_vanadium_absorb_corrections(calibration_full_paths, ws_to_match): # TODO are these values applicable to all instruments shape_ws = mantid.CloneWorkspace(InputWorkspace=ws_to_match) mantid.CreateSampleShape( InputWorkspace=shape_ws, ShapeXML='<sphere id="sphere_1"> <centre x="0" y="0" z= "0" />\ <radius val="0.005" /> </sphere>' ) absorb_ws = \ mantid.AbsorptionCorrection(InputWorkspace=shape_ws, AttenuationXSection="5.08", ScatteringXSection="5.1", SampleNumberDensity="0.072", NumberOfWavelengthPoints="25", ElementSize="0.05") mantid.SaveNexus(Filename=calibration_full_paths["vanadium_absorption"], InputWorkspace=absorb_ws, Append=False) remove_intermediate_workspace(shape_ws) return absorb_ws