[mcstas-users] Multiple samples in a single mcstas instrument?
Peter Kjær Willendrup
pkwi at fysik.dtu.dk
Thu Jul 11 09:17:47 CEST 2019
Hi Uli,
Erik managed to beat me to it! :-)
I would do more or less the same:
1) SPLIT by a bigger amounts, e.g. samples * 10 (samples already allow SPLITS, and now you have a N of these)
2) partition the interval [0 1] corresponding to the number of samples and then rand01() in an EXTEND to randomly choose between them using a WHEN on each
3) One thing to remember:
If getting the intensity “right” i.e. the same as what you would get running each sample alone, I would then do a p *= nsamples; in an EXTEND.
Cheers,
Peter
On 11 Jul 2019, at 08.58, Erik B Knudsen <erkn at fysik.dtu.dk<mailto:erkn at fysik.dtu.dk>> wrote:
Dear Uli,
It can be done if that is what you _really_ want to do, but I would not
recommend it. The solution would be more complicated and likely error
prone than using an intermediary MCPL-file. Also - you would have
rewrite less of the instrument file that way.
If you really want to do this here's a pseudocode solution for two
samples that you could easily extend to more:
You'd have to also set parameters for samples and decalre the variable
samplec - but you knew that :-).
<snip>
COMPONENT a0 = Arm()
AT(0,0,0) RELATIVE something
EXTEND
%{
samplec==0
%}
SPLIT 2 COMPONENT a1 = Arm()
AT(0,0,0) RELATIVE a0
EXTEND
%{
samplec++;
%}
COMPONENT sans1 = Sans_SAMPLE(x=X,...)
WHEN (samplec==1) AT(0,0,0) RELATIVE a1
COMPONENT sans2 = Sans_SAMPLE(y=Y,...)
WHEN sample==2) AT(0,0,0) RELATIVE a1
COMPONENT det1 = PSD_monitor(filename="file1")
WHEN(samplec==1) AT(0,0,L) RELATIVE a1
COMPONENT det2 = COPY(det1)(filename="file2")
WHEN(samplec==2) AT(0,0,L) RELATIVE a2
<snip>
cheers
Erik
On 10/07/2019 21:33, Wildgruber, Christoph U. wrote:
Hi,
I read the manual and somehow I think it could be done but I could not
figure out how…
So here is what I want to do:
I have SANS instrument and want to compare it’s neutron optical performance
for several pairs of sample models. To avoid using virtual sources and minimize the
overall runtime I thought it might be possible to have a loop or something equivalent which
runs the sample & detector part of the instrument multiple times for the same neutrons
arriving at the sample position with a different scattering model.
All other parameters in the sample are the same.
Any suggestions?
Thanks,
Uli
_______________________________________________
mcstas-users mailing list
mcstas-users at mcstas.org<mailto:mcstas-users at mcstas.org>
https://mailman2.mcstas.org/mailman/listinfo/mcstas-users
--
Erik Bergbäck Knudsen, Research Engineer | DTU | morituri
NEXMAP, DTU Fysik, DK-2800 Kgs. Lyngby, Denmark |<>-<>| te
phone: (+45) 2132 6655 |<>-<>| salutant
_______________________________________________
mcstas-users mailing list
mcstas-users at mcstas.org<mailto:mcstas-users at mcstas.org>
https://mailman2.mcstas.org/mailman/listinfo/mcstas-users
Peter Kjær Willendrup
Forskningsingeniør, Specialkonsulent
Næstformand for DTU Fysik LSU
DTU Physics
[cid:b6339554-7f28-441d-9f31-5944f811397c at win.dtu.dk]
Technical University of Denmark
[cid:e108e480-fcab-46e2-9531-b38165079572 at win.dtu.dk]
Department of Physics
Fysikvej
Building 307
DK-2800 Kongens Lyngby
Direct +45 2125 4612
Mobil +45 2125 4612
Fax +45 4593 2399
pkwi at fysik.dtu.dk<mailto:pkwi at fysik.dtu.dk>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20190711/98c71716/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 58 bytes
Desc: image001.gif
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20190711/98c71716/attachment-0002.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.gif
Type: image/gif
Size: 1055 bytes
Desc: image002.gif
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20190711/98c71716/attachment-0003.gif>
More information about the mcstas-users
mailing list