Exemplo n.º 1
0
    else:
      args=p.parse_args()
      if not hasVersion(args.hdfname): addVersionStamp(args.hdfname,'1.4.1')
  elif 'genSQE' in sys.argv:
    p.description='Loads Sassena output (HDF5 file) and generates a Nexus file containing S(Q,E) in a Workspace2D.' # update help message
    for action in p._actions:
      if action.dest=='service': action.help='substitue SERVICE by genSQE' # update help message
    p.add_argument('hdfname',            help='path to sassena output hdf5 files for the incoherent factors. If more than one file is passed, enclosed then in quotes and separate them with space(s). The output S(Q,E) will be the Fourier transform of the summ of the incoherent factors.')
    p.add_argument('nxsname',            help='path to output Nexus file')
    p.add_argument('--wsname',           help='root name for the GroupWorkspace created when Sassena output is loaded')
    p.add_argument('--indexes',          help='space separated list of workspace indexes to keep. Example: --indexes "2 4 6 8". If not declared, all indexes are kept')
    p.add_argument('--rebinQ',           help='useful when reported experimental S(Q,E) was obtained integrating over different [Q-dQ,Q+dQ] ranges. Format is "Qmin Qwidth Qmax".')
    p.add_argument('--scale',            help='scale S(Q,E) by this factor. Default=1.0',default=1.0,type=float)
    p.add_argument('--LoadSassena',      help='certain arguments for the algorithm. Example --LoadSassena="TimeUnit:0.1"')
    p.add_argument('--SassenaFFT',       help='certain arguments for the algorithm. Example: --SassenaFFT="FTTonlyRealPart:True,DetailedBalance:True,Temp:290"')
    p.add_argument('--NormaliseToUnity', help='certain arguments for the algorithm. Example: --NormaliseToUnity="RangeLower:-50.0,RangeUpper:50.0"')
    p.add_argument('--SaveNexus',        help='certain arguments for the algorithm. Example: --SaveNexus="Title:some title here"')
    # Check if help message is requested
    if '-explain' in sys.argv:
      p.parse_args(args=('-h',))
    else:
      args=p.parse_args()
      indexes=[]
      if args.indexes: indexes=[int(i) for i in args.indexes.split()]
      genSQE(args.hdfname, args.nxsname, wsname=args.wsname, indexes=indexes, rebinQ=args.rebinQ, scale=args.scale,
             LoadSassena=getDictFromArgparse('LoadSassena',args),
             SassenaFFT=getDictFromArgparse('SassenaFFT',args),
             SaveNexus=getDictFromArgparse('SaveNexus',args),
             NormaliseToUnity=getDictFromArgparse('NormaliseToUnity',args)
             )
Exemplo n.º 2
0
   for action in p._actions:
     if action.dest=='service': action.help='substitue "service" with "lowTresolution"' # update help message
   p.add_argument('--model',help='name of the file containing the model beamline string')
   p.add_argument('--simulated',help='name of the nexus file containing the simulated S(Q,E)')
   p.add_argument('--resolution',help='name of the nexus file containing the resolution function. This will be used to produce an elastic line.')
   p.add_argument('--convolved',help='name of the output nexus file')
   p.add_argument('--expdata',help='optional, experimental nexus file. If passed, output convolved will be binned as expdata.')
   p.add_argument('--costfile',help='optional, file to store cost. If passed, the cost of comparing convolved and expdata will be saved.')
   p.add_argument('--Fit', help='certain arguments for the Mantid Fit algorithm. Example: --Fit="StartX=-50.0,EndX=50.0"')
   if '-explain' in sys.argv:
     p.parse_args(args=('-h',))
   else:
     args=p.parse_args()
     lowTResolution(args.model, args.simulated, args.resolution, args.convolved,
                    expdata=args.expdata, costfile=args.costfile,
                    Fit=getDictFromArgparse('Fit',args)
                    )
 elif 'modelBEC' in sys.argv:
   p.description='Assemble the background, elastic line and convolution of the resolution with the simulated S(Q,E) according to model (b0+b1*E  +  e0*exp(-e1*Q^2)*Elastic(E)  +  c0*Resolution(E)xSimulated(Q,E)). Output to a Nexus file'
   for action in p._actions:
     if action.dest=='service': action.help='substitue "service" with "modelBEC"' # update help message
   p.add_argument('--model',help='name of the file containing the model beamline string')
   p.add_argument('--resolution',help='name of the nexus file containing the resolution function. This will be used to produce an elastic line.')
   p.add_argument('--convolved',help='Nexus file containing the convolution of the simulated S(Q,E) with the resolution.')
   p.add_argument('--qvalues',help='Single-column file containing list of Q-values.')
   p.add_argument('--assembled',help='output Nexus file containing the assembled S(Q,E) of the beamline model and the simulated S(Q,E)')
   p.add_argument('--expdata',help='optional, experimental nexus file. If passed, output convolved will be binned as expdata.')
   p.add_argument('--costfile',help='optional, file to store cost. If passed, the cost of comparing convolved and expdata will be saved.')
   if '-explain' in sys.argv:
     p.parse_args(args=('-h',))
   else: