Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VATES simple interface ScatterMode does not work on file-based workspaces #10926

Closed
abuts opened this issue Aug 7, 2014 · 3 comments
Closed
Assignees
Labels
Framework Issues and pull requests related to components in the Framework Stale This label is automatically applied to issues that are automatically closed by the stale bot

Comments

@abuts
Copy link
Member

abuts commented Aug 7, 2014

This issue was originally TRAC 10084

Run script below and create the MD workspace (this may take a while and should be tried on a machine with not less then 8Gb of RAM)

Then load this workspace in memory (or keep the simulated one) and try to look at it using VATES simple interface, scatter mode. Usually it works fine (though I've observed some not always reproducible errors -- may be somebody else can reliably reproduce it).

Then delete this workspace and load it file-based. Scattering mode shows nothing despite giving impression that it does something.

It should show something or at least tell that it can not handle file based workspaces. The things it showing should be discussed in wider context of scattering mode work on MD-histo workspaces or on the MDEventWorkspace headers.

Script to produce test file:

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}


data_path=os.path.dirname(os.path.realpath(__file__))
config.appendDataSearchDir(data_path)



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',
                            DetectorTableFilename='MER14263.raw')
#                                      DetectorTableFilename='MER06398.raw')

##
## 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)


##
## Sample rotation. Simulate a 1-10 degree rotation
##
rotmax = 10
for i in range(0, rotmax+1):
    psi = i*1.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")

    # 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,
                            AppendToExisting=True)


simulated_file = 'mer300meV_sim_mantid_1-10.nxs'
SaveMD(InputWorkspace=simulated_ws,Filename=simulated_file)

@abuts
Copy link
Member Author

abuts commented May 15, 2015

@peterfpeterson (2015-05-15T17:40:59):
Review and see if this should just be closed.

@abuts abuts added the Framework Issues and pull requests related to components in the Framework label Jun 3, 2015
@stale
Copy link

stale bot commented Feb 24, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you feel this is incorrect please comment to keep it alive, with a reason why.

To prevent closure, e.g. for long-term planning issues, add the "Never Stale" label.

@stale stale bot added the Stale This label is automatically applied to issues that are automatically closed by the stale bot label Feb 24, 2021
@stale
Copy link

stale bot commented Mar 3, 2021

This issue has been closed automatically. If this still affects you please re-open this issue with a comment so we can look into resolving it.

@stale stale bot closed this as completed Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework Issues and pull requests related to components in the Framework Stale This label is automatically applied to issues that are automatically closed by the stale bot
Projects
None yet
Development

No branches or pull requests

2 participants