[neutron-mc] Generate a source spectra from exp. file

Philip Wilk PWilk-neutron at zenspider.com
Mon Sep 1 15:44:31 CEST 2003


Ok, I figured it out. The instructions in the Filter_gen.comp header were a little cryptic and there is zero documentation on the component in the lib/doc/mcstas-components.pdf file.

The options are set at the top of the data file with a comment-line (starts with #) and can be: "k", "q", "wavevector", "omega", "e", "energy", "lamda" or "wavelength"; followed by "set", "add", or "multiply". You can separate the options with a space. You can also add "verbose" if you want. See the lib/data/HOPG.trm file line 7 as an example. 

The Filter_gen.comp has a typo of "lib/data/HOPG.trs" where it should be "lib/data/HOPG.trm", and also says:

* options: string that can contain (str)
*          "[ k p ]"      or "wavector" for file type 
*          "[ omega p]"   or "energy" 
*          "[ lambda p ]" or "wavelength"
*          "set"          to set the weight according to the table
*          "multiply"     to multiply (instead of set) the weight by factor
*          "add"          to add to current flux
*          "verbose"      to display additional informations

This seems to indicate you can also set the options from where you call the component. I do not fully understand what the "p" is for in "[ k p ]", "[ omega p]", and "[ lambda p ]".

Cheers,
Philip

Thus spake Philip Wilk (pwilk at zenspider.com):

>    It is not working for me. It seems to add to it, rather then set it.
>    I just put this at the top of the file right?
> 
>    # lambda set
> 
>    and it sets the options?
> 
>    Regards,
>    Philip
> 
>    ----- Original Message -----
> 
>    From: [1]Emmanuel Farhi
> 
>    To: [2]pwilk at zenspider.com ; [3]neutron-mc at risoe.dk
> 
>    Sent: Wednesday, August 27, 2003 11:07 AM
> 
>    Subject: [neutron-mc] Generate a source spectra from exp. file
> 
>      Yes, there is a solution to use an experimental profile for the
>      simulation source.
> 
>      First position a normal source (Source_flat or Source_gen, or ...).
>      Then, you may use the Filter_gen component (in the optics) to read
>      the contents a a file, with options="lambda, set weight". Then the
>      first column of the table is assumed to be the wavelength, and the
>      second should be the flux to set.
>      A rebinning/interpolation is done when loading the table. This will
>      set the weight of neutrons. You may also choose to multiply or add
>      to the existing weight.
>      The Filter_gen (McStas v1.7) is a replacement to the old
>      Flux_adapter.
> 
>      Just look at the MCSTASLIB/optics/Filter_gen component (or 'mcdoc
>      Filter_gen').
> 
>      pwilk wrote:
> 
>      Thanks for the quick reply! I'll give that a go.I think you are
>      right about the zero velocity neutrons.I have another quick
>      question for you: Is there an easy way to simulate a source from a
>      2D file of (measured) Intensity vs. Wavelength ?Cheers,Philip
> 
>    -----Original Message-----
>    From: farhi at ill.fr [[4]mailto:farhi at ill.fr]
>    Sent: Tuesday, August 26, 2003 3:18 PM
>    To: pwilk-radiochem at hahnium.com; neutron-mc at risoe.dk
>    Subject: Re: sqrt: DOMAIN error
> 
>      Hy Philip,
> 
>      You probably have some zero velocity neutrons or such huge
>      velocities that the square gets hawfull (before getting the sqrt),
>      else I can not figure out how the 'sqrt' can fail in the speed in
>      L_monitor.comp.
>      You may copy this component locally and change the line #76 so that
>      it tests the speed norm to be non zero or reasonable value (not
>      huge).
> 
>      You may also try replacing with the Monitor_nD(options="auto
>      lambda", filename="...")
> 
>      Cheers, Emmanuel.
> 
>      Philip Wilk wrote:
> 
>      Hi,
> 
>      I am using the new version 1.7
> 
>      I keep getting "sqrt: DOMAIN error"
> 
>      Just like I was getting with version 1.6.4 , should I be worried
>      about this?
>      It seems to be associated with the wavelength detector component.
> 
>      See example output:
> 
>      Detector: psd_begin_I=75.9887 psd_begin_ERR=0.0701353
>      psd_begin_N=3.65191e+06 "p
>      sd1.dat"
>      Detector: lambda_begin_I=75.9887 lambda_begin_ERR=0.0701353
>      lambda_begin_N=3.651
>      91e+06 "erg1.dat"
>      Detector: psd_middle_I=6.2552 psd_middle_ERR=0.017862
>      psd_middle_N=1.68387e+06 "
>      psd2.dat"
> 
>      sqrt: DOMAIN error
>      Detector: lambda_middle_I=6.2552 lambda_middle_ERR=0.017862
>      lambda_middle_N=1.68
>      387e+06 "erg2.dat"
>      Detector: psd_middle2_I=1.20321 psd_middle2_ERR=0.00418768
>      psd_middle2_N=1.08584
>      e+06 "psd3.dat"
>      Detector: lambda_middle2_I=1.20321 lambda_middle2_ERR=0.00418768
>      lambda_middle2_
>      N=1.08584e+06 "erg3.dat"
>      Detector: psd_end_I=0.65266 psd_end_ERR=0.002805 psd_end_N=389221
>      "psd4.dat"
>      Detector: lambda_end_I=0.65266 lambda_end_ERR=0.002805
>      lambda_end_N=389221
>      "erg4
>      .dat"
> 
>      Cheers,
>      Philip
> 
> --
> What's up Doc ?
> --------------------------------------------
> Emmanuel FARHI, [5]http://www.ill.fr/tas/people/Farhi.html   \|/ ____ \|/
> CS-Group ILL4/156, Institut Laue-Langevin (ILL) Grenoble  ~@-/ oO \-@~
> 6 rue J. Horowitz, BP 156, 38042 Grenoble Cedex 9,France  /_( \__/ )_\
> Work :Tel (33/0) 4 76 20 71 35. Fax (33/0) 4 76 20 76 48     \__U_/
> 
> 
> 
> --
> What's up Doc ?
> --------------------------------------------
> Emmanuel FARHI, [6]http://www.ill.fr/tas/people/Farhi.html   \|/ ____ \|/
> CS-Group ILL4/156, Institut Laue-Langevin (ILL) Grenoble  ~@-/ oO \-@~
> 6 rue J. Horowitz, BP 156, 38042 Grenoble Cedex 9,France  /_( \__/ )_\
> Work :Tel (33/0) 4 76 20 71 35. Fax (33/0) 4 76 20 76 48     \__U_/
> 
> References
> 
>    1. mailto:farhi at ill.fr
>    2. mailto:pwilk at zenspider.com
>    3. mailto:neutron-mc at risoe.dk
>    4. mailto:farhi at ill.fr
>    5. http://www.ill.fr/tas/people/Farhi.html
>    6. http://www.ill.fr/tas/people/Farhi.html



More information about the mcstas-users mailing list