Ticket #2237 (closed: fixed)

Opened 10 years ago

Last modified 5 years ago

Inelastic absolute units produces incorrect values from the GUI

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: major Milestone: Iteration 27
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Brett Tully

Description

When running the inelastic convert to energy with absolute units turned on from the GUI you get incorrect scaling factors calculated.

A script with the same information gives the correct answer though.

Attachments

Inelastic-Tab1.png (47.9 KB) - added by Martyn Gigg 10 years ago.
Direct inelastic tab 1
Inelastic-Tab2.png (51.6 KB) - added by Martyn Gigg 10 years ago.
Direct inelastic tab 2
Inelastic-Tab3.png (37.6 KB) - added by Martyn Gigg 10 years ago.
Direct inelastic tab 3

Change History

comment:1 Changed 10 years ago by Martyn Gigg

  • Status changed from new to accepted

comment:2 Changed 10 years ago by Martyn Gigg

Test script

import sys
import os
sys.path.append(os.environ['MANTIDPATH'])
from MantidFramework import *
mtd.initialise()

import time
from DirectEnergyConversion import setup_reducer


def iliad_abs(wb_run,sample_run,mono_van,ei_guess,rebin):
       
        try:
                n,r=lhs('both')
                wksp_out=r[0]
        except:
                wksp_out=str(sample_run)+'.spe'
       
       
        start_time=time.clock()
        reducer = setup_reducer('MARI')
        reducer.normalise_method = 'monitor-1'
        reducer.background = False
        reducer.fix_ei = False
        reducer.save_formats = ['.spe']
        #Set parameters for these runs
        reducer.map_file = 'mari_res.map'
        reducer.energy_bins = rebin
        #monovan info
        reducer.abs_map_file='mari_res.map'
        reducer.monovan_integr_range=[-40,40]
        #reducer.van_rmm =50.94
        reducer.van_mass=32.58
        #sample info
        reducer.sample_mass=5.00
        reducer.sample_rmm =109.00
       
        sample = sample_run
        white = wb_run
        mono=mono_van
# Note this isn't in the Mantid code yet
# The function definition looks like this

# def diagnose(sample_run, white_run, other_white = None, remove_zero=False,
#             tiny=1e-10, large=1e10, median_lo=0.1, median_hi=3.0, signif=3.3,
#             bkgd_threshold=5.0, bkgd_range=None, effic_var=1.1):
#
# Masking is then a MaskWorkspace that contains an accumulation of the results
        masking = reducer.diagnose(white, sample,other_white = None, remove_zero=False,
            tiny=1e-10, large=1e10, median_lo=0.1, median_hi=3.0, signif=3.3,
                bkgd_threshold=5.0, bkgd_range=None, variation=1.1)

        reducer.spectra_masks=masking
        #Run the conversion
        deltaE_wkspace = reducer.convert_to_energy(sample, ei_guess, white, mono,ei_guess,white)
        end_time=time.clock()
        results_name=str(sample)+'.spe'
        ei= (deltaE_wkspace.getSampleDetails().getLogData("Ei").value)
        print 'Incident energy found ',ei,' meV'
        print 'Elapsed time =',end_time-start_time, 's'
        #get the name that convert to energy will use
       
        if results_name<>wksp_out:
                RenameWorkspace(results_name,wksp_out)
       
        return mtd[wksp_out]


if __name__ == '__main__':
    iliad_abs(11060,11015,11001,11,[-11,0.05,10])

Changed 10 years ago by Martyn Gigg

Direct inelastic tab 1

Changed 10 years ago by Martyn Gigg

Direct inelastic tab 2

Changed 10 years ago by Martyn Gigg

Direct inelastic tab 3

comment:3 Changed 10 years ago by Martyn Gigg

To the tester:

The files attached to this ticket show the settings on the GUI that will match the script above. Running the script and the GUI should produce a workspace ending in '.spe' and comparing these with CheckWorkspacesMatch should give a successful result.

comment:4 Changed 10 years ago by Martyn Gigg

(In [8756]) Fix a bug with the inelastic GUI for absolute units which wasn't setting the integration region correctly. Fix a bug with the scripts if they were passed two ints for the sample and rmm mass that would divide to zero giving NANs in the data. Re #2237

comment:5 Changed 10 years ago by Martyn Gigg

(In [8757]) Remove some debugging code. Refs #2237

comment:6 Changed 10 years ago by Martyn Gigg

  • Status changed from accepted to verify
  • Resolution set to fixed

comment:7 Changed 10 years ago by Brett Tully

  • Status changed from verify to verifying
  • Tester set to Brett Tully

comment:8 Changed 10 years ago by Brett Tully

  • Status changed from verifying to closed

CheckWorksacesMatch successful as required. 1.1.9494

comment:9 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 3084

Note: See TracTickets for help on using tickets.