Ticket #7020 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Add switch to quantification foreground model to specify magnetic form factor

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: critical Milestone: Release 2.6
Component: Direct Inelastic Keywords:
Cc: Blocked By:
Blocking: Tester: Owen Arnold

Description (last modified by Nick Draper) (diff)

It should use a string containing the ion and also to be able to switch it off using the string "0"

Change History

comment:1 Changed 7 years ago by Martyn Gigg

Retrieve an ion by string containing both symbol & charge.

Refs #7020

Changeset: e0f183e57c04b274d359fef73c808238cdc52e00

comment:2 Changed 7 years ago by Martyn Gigg

Add form factor attribute to quantification models.

Allows the user to specify the form factor type or turn it off without coding a whole new model. Refs #7020

Changeset: 03d19c17ab13d058a4f38801a3e1408caf347739

comment:3 Changed 7 years ago by Martyn Gigg

Fix formFactor constant when turned off. Refs #7020

Changeset: a6d70797bf996ab7d02200134d4533a46f052179

comment:4 Changed 7 years ago by Martyn Gigg

  • Description modified (diff)
  • Summary changed from Add switch to quantification foreground model to specify magnetic form factor to Small modifications to aid in TobyFit/VATES comparison

comment:5 Changed 7 years ago by Martyn Gigg

  • Description modified (diff)

comment:6 Changed 7 years ago by Martyn Gigg

Retrieve an ion by string containing both symbol & charge.

Refs #7020

Changeset: efa754bb61208e4fd69f941d25606a5932b592bf

comment:7 Changed 7 years ago by Martyn Gigg

Add form factor attribute to quantification models.

Allows the user to specify the form factor type or turn it off without coding a whole new model. Refs #7020

Changeset: 1bfa6983398608d003801a5281f772c48814b171

comment:8 Changed 7 years ago by Martyn Gigg

Fix formFactor constant when turned off. Refs #7020

Changeset: f13a8a6fa9397d9f565cf195faf5f94c0797a94c

comment:9 Changed 7 years ago by Martyn Gigg

Retrieve an ion by string containing both symbol & charge.

Refs #7020

Changeset: efa754bb61208e4fd69f941d25606a5932b592bf

comment:10 Changed 7 years ago by Martyn Gigg

Add form factor attribute to quantification models.

Allows the user to specify the form factor type or turn it off without coding a whole new model. Refs #7020

Changeset: 1bfa6983398608d003801a5281f772c48814b171

comment:11 Changed 7 years ago by Martyn Gigg

Fix formFactor constant when turned off. Refs #7020

Changeset: f13a8a6fa9397d9f565cf195faf5f94c0797a94c

comment:12 Changed 7 years ago by Martyn Gigg

  • Status changed from new to accepted

comment:13 Changed 7 years ago by Martyn Gigg

Branch: feature/7020_quantification_formfactor_switch

Tester: The following script will form the basis of testing:


def create_cuboid_xml(xlength,ylength,zlength):
    xml = """<cuboid id="sample0">
<left-front-bottom-point x="%(xpt)f" y="-%(ypt)f" z="-%(zpt)f"  />
<left-front-top-point  x="%(xpt)f" y="-%(ypt)f" z="%(zpt)f"  />
<left-back-bottom-point  x="-%(xpt)f" y="-%(ypt)f" z="-%(zpt)f"  />
<right-front-bottom-point  x="%(xpt)f" y="%(ypt)f" z="-%(zpt)f"  />
</cuboid>
<algebra val="sample0" />
"""
    return xml % {"xpt": xlength/2.0,"ypt":ylength/2.0,"zpt":zlength/2.0}
 
 
ei = 300.
bins = [-30,3,279]
temperature = 6. 
chopper_speed = 600.
 
# Oriented lattice & goniometer.
alatt = 5.57
blatt = 5.51
clatt = 12.298
uvec = [9.700000e-03,9.800000e-03,9.996000e-01]
vvec = [9.992000e-01,-3.460000e-02,-4.580000e-02]
 
omega = 0.0
alpha = 0.0
beta = 0.0
gamma = 0.0
 
# sample dimensions
sx = 0.05 # horizontal
sy = 0.025 # up direction
sz = 0.04 # beam direction
 
# Crystal mosaic
eta_sig = 4.0
 
## 
## A fake data set for simulation purposes.
##
fake_data = CreateSimulationWorkspace(Instrument='MERLIN',BinParams=bins,UnitX='DeltaE')
 
##
## Required log entries, can be taken from real ones by placing an instrument parameter of the same
## name pointing to the log name
##
AddSampleLog(Workspace=fake_data, LogName='Ei',LogText=str(ei), LogType="Number")
AddSampleLog(Workspace=fake_data, LogName='temperature_log',LogText=str(temperature), LogType="Number")
AddSampleLog(Workspace=fake_data, LogName='chopper_speed_log',LogText=str(chopper_speed), LogType="Number")
AddSampleLog(Workspace=fake_data, LogName='eta_sigma',LogText=str(eta_sig), LogType="Number")
 
##
## Sample shape
##
CreateSampleShape(InputWorkspace=fake_data, ShapeXML=create_cuboid_xml(sx,sy,sz))
 
##
## Chopper & Moderator models. 
##
CreateModeratorModel(Workspace=fake_data,ModelType='IkedaCarpenterModerator',
                     Parameters="TiltAngle=32,TauF=2.7,TauS=0,R=0")
CreateChopperModel(Workspace=fake_data,ModelType='FermiChopperModel',
                   Parameters="AngularVelocity=chopper_speed_log,ChopperRadius=0.049,SlitThickness=0.0023,SlitRadius=1.3,Ei=Ei,JitterSigma=0.0")
 
##
## UB matrix
##
SetUB(Workspace=fake_data,a=alatt,b=blatt,c=clatt,u=uvec,v=vvec)
 
 
pis=0.0
AddSampleLog(Workspace=fake_data,LogName='psi',LogText=str(psi),LogType='Number')
SetGoniometer(Workspace=fake_data,Axis0="psi,0,1,0,1")
# Create the MD workspace
simulws = ConvertToMD(InputWorkspace=fake_data, QDimensions="Q3D", SplitInto=[3], SplitThreshold=100,
                      MinValues="-15,-15,-15,-30", MaxValues="25,25,25,279",OverwriteExisting=True)

# Run the simulation. The output is combined for each rotation into the simulated_ws
resol_model = "TobyFitResolutionModel"
xsec_model = "Strontium122"
parameters = "Seff=0.7,J1a=38.7,J1b=-5.0,J2=27.3,SJc=10.0,GammaSlope=0.08,MultEps=0,TwinType=0,MCLoopMin=10,MCLoopMax=10"
simulated_ws = SimulateResolutionConvolvedModel(InputWorkspace=simulws,
                                                ResolutionFunction=resol_model,
                                                ForegroundModel=xsec_model,
                                                Parameters=parameters)

The changes in this ticket add a new parameter, FormFactorIon, to the foreground models. It is a string that changes the ion used for the form factor calculation. The default value is "Fe2". Run the following tests:

  • Execute the script to produce the final workspace and rename 'simulated_ws' to 'simulated_ws_default'
  • Change the parameters string to
    parameters = "Seff=0.7,J1a=38.7,J1b=-5.0,J2=27.3,SJc=10.0,GammaSlope=0.08,MultEps=0,TwinType=0,MCLoopMin=10,MCLoopMax=10,FormFactorIon=Fe2"
    
  • Rerun the simulation and check that the output agrees with "simulated_ws_default". You can use CompareMDWorkspaces for this.
  • Setting FormFactorIon=0 sets the formfactor to 1 for all Q. Change the parameter to 0 and rerun the script. Verify that the output is different to the default.

comment:20 Changed 7 years ago by Martyn Gigg

  • Description modified (diff)
  • Summary changed from Small modifications to aid in TobyFit/VATES comparison to Add switch to quantification foreground model to specify magnetic form factor

comment:15 Changed 7 years ago by Martyn Gigg

Retrieve an ion by string containing both symbol & charge.

Refs #7020

Changeset: 030fd3077b80e9fafc456b3665453d029a49004b

comment:16 Changed 7 years ago by Martyn Gigg

Add form factor attribute to quantification models.

Allows the user to specify the form factor type or turn it off without coding a whole new model. Refs #7020

Changeset: aecb67e2c8ec4074cbccd14b53648414d6c38638

comment:17 Changed 7 years ago by Martyn Gigg

Fix formFactor constant when turned off. Refs #7020

Changeset: 33733b18b9ca9ed24b710e8737791f20a012200f

comment:18 Changed 7 years ago by Martyn Gigg

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

comment:19 Changed 7 years ago by Owen Arnold

  • Status changed from verify to verifying
  • Tester set to Owen Arnold

comment:20 Changed 7 years ago by Martyn Gigg

Retrieve an ion by string containing both symbol & charge.

Refs #7020

Changeset: eb3b5be5d7a29136df5e65793517bf51241a22d8

comment:21 Changed 7 years ago by Martyn Gigg

Add form factor attribute to quantification models.

Allows the user to specify the form factor type or turn it off without coding a whole new model. Refs #7020

Changeset: d1656d54f76963c86511dea53e102b2167df338c

comment:22 Changed 7 years ago by Martyn Gigg

Fix formFactor constant when turned off. Refs #7020

Changeset: 5c50133b356bd82e636d8b9e0ba06d94e0c4b80d

comment:23 Changed 7 years ago by Owen Arnold

  • Status changed from verifying to closed

This does what what the ticket describes, code looks fine, unit tests in place and testing description matches actual behaviour.

comment:24 Changed 7 years ago by Nick Draper

  • Component changed from Mantid to Framework

comment:25 Changed 7 years ago by Nick Draper

  • Component changed from Framework to Direct Inelastic
  • Description modified (diff)

comment:26 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 7866

Note: See TracTickets for help on using tickets.