Ticket #8488 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

ConvertToMD does not produces correct image any more

Reported by: Alex Buts Owned by: Alex Buts
Priority: major Milestone: Release 3.1
Component: Framework Keywords:
Cc: nick.draper@…, martyn.gigg@…, saviciat@… Blocked By:
Blocking: Tester: Andrei Savici

Description (last modified by Alex Buts) (diff)

If I produce MD image using the script below (the data for it are availible on the test server) and compare it with he image, produced by Horace, they look substantially different.

It was a time, where convert to MD was producing the images identical to Horace.

The workspaces contain identical number of events. Just appearance/arrangements are different.

P.S. Can not produce decent Mantid image as Sliceviewer SavePicture does not work any more. Ticket #8482 has been created to fix that.

# Sample script to build Mantid's combined MD workspace -- Horace sqw equivalent
config['defaultsave.directory']='/home/wkc26243/Fe400'
save_dir = config.getString('defaultsave.directory')
if len(save_dir) ==0 :
    config['defaultsave.directory']=os.getcwd()
    save_dir = config.getString('defaultsave.directory')
print "Data will be saved into: ",save_dir
config.appendDataSearchDir(save_dir)

print 'start\n'
cur_ws='wsn';
md_ws='mdws4D';
MDWSF='';


pars = dict();
pars['InputWorkspace']=''
pars['QDimensions']='Q3D'
pars['dEAnalysisMode']='Direct'
pars['Q3DFrames']='HKL'
pars['QConversionScales']='HKL'
pars['PreprocDetectorsWS']='preprDet'
pars['MinValues']='-7,-7,-7.,-72.0'
pars['MaxValues']='7.,7.,7.,382.0'
pars['SplitInto']=50
pars['MaxRecursionDepth']=1
pars['MinRecursionDepth']=1

for n in xrange(15052,15178+1):
	source = 'MAP'+str(n)+'.nxspe';
	target  = 'MDMAP'+str(n)+'.nxs';
	if not(os.path.exists(target )):
		print 'Converting ',source
		LoadNXSPE(Filename=source,OutputWorkspace=cur_ws)
		os.remove(source);
		SetUB(Workspace=cur_ws,a='2.87',b='2.87',c='2.87')
		# rotated by proper number of degrees around axis Y
		# AddSampleLog(Workspace=cur_ws,LogName='Psi',LogText=str(ic),LogType='Number Series')   -- sample log i shuld be already there 
		SetGoniometer(Workspace=cur_ws,Axis0='Psi,0,1,0,1')

		pars['InputWorkspace']=cur_ws;
		md_ws=ConvertToMD(**pars)

		SaveMD(md_ws,Filename=target  );
		DeleteWorkspace(md_ws);
		DeleteWorkspace(cur_ws);	
		
	if (len(MDWSF) == 0):
		MDWSF = target;
	else:
		MDWSF=MDWSF+','+target;


ws4D = MergeMDFiles(MDWSF,OutputFilename='fe400_8k.nxs',Parallel='0');
######################################################################


Attachments

MantidImage.png (73.7 KB) - added by Alex Buts 7 years ago.
Mantid image
HoraceImage.png (52.7 KB) - added by Alex Buts 7 years ago.
Horace Image

Change History

Changed 7 years ago by Alex Buts

Mantid image

Changed 7 years ago by Alex Buts

Horace Image

comment:1 Changed 7 years ago by Alex Buts

  • Cc russell.taylor@… removed
  • Description modified (diff)

comment:2 Changed 7 years ago by Alex Buts

  • Status changed from new to inprogress

comment:3 Changed 7 years ago by Alex Buts

  • Milestone changed from Backlog to Release 3.1

comment:4 Changed 7 years ago by Alex Buts

refs #8488 This should fix it

Par file has the azimuthal angle sign convention opposite to the one, used by nxspe. To avoid any confusion, nxspe should always use one (right hand side) convention for azimuthal angle.

Changeset: b8de0f6f2eb0172cab55b79466963a5582edaaad

comment:5 Changed 7 years ago by Alex Buts

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

Apparently, all differences were caused by different sign conventions between nxspe and par files.

to avoid any confusions, mantid will use its current convention event if par file is provided as data source.

the changes is trivial so testing easy to do through code review.

comment:6 Changed 7 years ago by Alex Buts

  • Status changed from verify to reopened
  • Resolution fixed deleted

comment:7 Changed 7 years ago by Alex Buts

  • Status changed from reopened to inprogress

refs #8488 should fix unit test

Changeset: c35bd1bc26603f9efd7eadb8c66ff281b467a3f1

comment:8 Changed 7 years ago by Alex Buts

refs #8488 should fix it.

Changeset: de464df6fa75053df8af83fa0e960a44004326ef

comment:9 Changed 7 years ago by Alex Buts

refs #8488 should fix unit test

but some thinking on what is actually happens in rings is needed

Changeset: f071fa104c9a76d5ae7882ea76229c8021d7b760

comment:10 Changed 7 years ago by Alex Buts

refs #8488 final remarks

the minor one. Apparently all looks right.

Changeset: 16ab04d4adc204d623b7d176a960a2b9e3f4740c

comment:11 Changed 7 years ago by Alex Buts

refs #8488 cpp check false positive suppressed

Changeset: 185eaef2666bd8e645a2cee8c32cc4823bad1976

comment:12 Changed 7 years ago by Alex Buts

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

There were not one but two issues here.

One with the opposite sign of the azimuthal angle in external ascii par file wrt. the one used anywhere in mantid and another one -- invalid average detectors angular size for the situation when detector's angle range passes through -Pi to Pi (due to simple summation/average this would give 0 instead of +Pi or -Pi which it should be)

Easiest way to test this is to reduce and saveNXSPE for ISIS inelastic instruments (with 4 to 1 internal map) and check if Mslice image using detectors from nxspe is equivalent to the image obtained using phx file. (issue 2) and in horace, image produced without par file is equivalent to the image, produced with par file (possible only with latest horace). I did that and it works.

If tester is unfamiliar with the reduction and above mentioned programs, code review would allow to check if the changes address the issues mentioned above.

comment:13 Changed 7 years ago by Andrei Savici

  • Status changed from verify to verifying
  • Tester set to Andrei Savici

comment:14 Changed 7 years ago by Andrei Savici

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/bugfix/8488_horace_ne_manitd'

Full changeset: 35088428256a40b13969d6386135572341c6192e

comment:15 Changed 7 years ago by Andrei Savici

Tested with some HYSPEC data. Everything seems fine

comment:16 Changed 6 years ago by Federico M Pouzols

  • Blocking 10637 added

comment:17 Changed 6 years ago by Federico M Pouzols

  • Blocking 10637 removed

comment:18 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 9332

Note: See TracTickets for help on using tickets.