<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi again,<br>
<br>
McStas computes the centre and width from the 1st and 2nd moment of
distributions. Matlab only re-use the values that McStas computes when
data files are saved to disk. So this is not the result of a fit. This
might explain the different results. Concerning the plots, which are
different, this is indeed strange to me.<br>
<br>
E.<br>
<br>
Aaron M. Percival wrote:
<blockquote cite="mid00ad01c734fd$067a5840$a21e0f82@amgap" type="cite">
<pre wrap="">Emmanuel,
Your explanation is clear and is certainly the logical way to set up the
bins. I compared the formula that you gave min+dx/2 and max-dx/2, with
dx=(max-min)/bins, to the numbers that the data file had in it (the one that
I converted from Matlab format to text using mcformat) and found the x-value
matched what they should be (i.e. the centre of each bin). My concern is
that the graphical data from Matlab seems a little off. As I mentioned
before the Gaussian centre and HWHM do not agree with the values that I
found in Origin using the same data. Also, and maybe more importantly, the
plots generated by Matlab seem 'skewed' from the ones generated by Origin.
It's difficult to explain what I mean by skewed, but the plot generated in
Matlab look more Maxwellian than Gaussian (i.e. sharper on one side), the
ones generated from Origin look almost Gaussian.
On the first point, my guess would be that the fitting functions used are
different, in that case, Origin's fit give the centre of the Gaussian where
I expect it to be, Matlab is about 2.5 degrees off.
As for the second point, I do not know why the plots themselves would have
different shapes. This seems very strange to me.
Aaron
-----Original Message-----
From: <a class="moz-txt-link-abbreviated" href="mailto:neutron-mc-bounces@risoe.dk">neutron-mc-bounces@risoe.dk</a> [<a class="moz-txt-link-freetext" href="mailto:neutron-mc-bounces@risoe.dk">mailto:neutron-mc-bounces@risoe.dk</a>] On
Behalf Of Emmanuel FARHI
Sent: Wednesday, January 10, 2007 3:54 PM
To: McStas users list at neutron.risoe.dk
Subject: RE: [neutron-mc] Simple Question
Hi again Aaron,
the difference comes from the way the axis is generated. Consider that the
data is stored into bins which have a given extent dx. The first left bin
value is min, the right last bin value is max. This means that the axis
values should better be the center of the bins for data analysis and
plotting. That's the way McStas plot the data. So you should generate the
bins between min+dx/2 and max-dx/2, with dx=(max-min)/bins.
E.
</pre>
<blockquote type="cite">
<pre wrap="">Emmanuel,
Your suggestion worked. I was able to convert the data file from Matlab
format to the McStas format (which seems to be simple text) using
mcformat.exe. I then used excel to import only the data columns (in this
case there was theta, counts, error and intensity). I took this data from
excel into Origin, and used Origin to perform analysis. I do notice in
doing this that the Gaussian fit found in Origin gives slightly different
values for X0 and dX (the variable McStas used in Matlab) for the centre
and
width of the curve respectively. The actual numbers are X0 = 99.852 dX =
6.024 (from Matlab) and X0 = 97.3, dX = 7.7, which as you can see is quite
significant.
Another interesting point to note is that the curve produced in Origin is
slightly different than the one produced in Matlab by mcplot, but they
should be produced from the same data.
Aaron.
_____
From: <a class="moz-txt-link-abbreviated" href="mailto:neutron-mc-bounces@risoe.dk">neutron-mc-bounces@risoe.dk</a> [<a class="moz-txt-link-freetext" href="mailto:neutron-mc-bounces@risoe.dk">mailto:neutron-mc-bounces@risoe.dk</a>] On
Behalf Of Emmanuel FARHI
Sent: Wednesday, January 10, 2007 10:48 AM
To: McStas users list at neutron.risoe.dk
Subject: Re: [neutron-mc] Simple Question
Hi AAron,
The idea is that axes are always regular, so that the min, max and number
of
steps is sufficient to generate the axis vector. The min and max is given
in
the 'xylimits' field of Matlab data structure, or on '# xylimits:' line of
PGPLOT data format file. The number of steps is written in the 'type'
field
and '# type:' line as well. Then that's really easy to generate the axes
with 'linspace' function in Matlab.
the best for you is to generate the data using the PGPLOT format. If you
do
not have PGPLOT you will not be able to plot it. Anyway you may use the
'mcformat' tool to convert it to e.g. Matlab format. You may also convert
-
still with mcformat - your Matlab data into PGPLOT if the simulation is
too
long to re-run.
E.
Aaron M. Percival wrote:
Good Day,
I have a simple question about exporting McStas data from Matlab to
another
platform. I'll give an example of what I want to do:
I have a type Monitor_nD detector with the following options set, options
=
"banana, theta, limits=[60,150], bins=100".
I'd like to take the data from this detector and export it to, say Origin
for further analysis. I've found in the detector file the array for the
data and the errors, however, I cannot find the array for the x-values (in
this case theta values). However, I did find something called stepx:
0.9091. Are the x-values generated by starting at (in this case) 60, then
increasing each increment by 0.9091, 100 times (since there are 100 bins)?
Regards,
Aaron M. Percival
*************************************************
Aaron M. Percival
M.Sc. Candidate
Dept. of Physics, Engineering Physics & Astronomy
Queen's University
Kingston, Ontario, Canada, K7L 3N6
Office: 613-533-6000 ext. 74789
Fax: 613-533-6463
*************************************************
_____
_______________________________________________
neutron-mc mailing list
<a class="moz-txt-link-abbreviated" href="mailto:neutron-mc@risoe.dk">neutron-mc@risoe.dk</a>
<a class="moz-txt-link-freetext" href="http://mailman.risoe.dk/mailman/listinfo/neutron-mc">http://mailman.risoe.dk/mailman/listinfo/neutron-mc</a>
--
What's up Doc ?
--------------------------------------------
Emmanuel FARHI, <a class="moz-txt-link-freetext" href="http://www.ill.fr/Computing/people/Farhi">http://www.ill.fr/Computing/people/Farhi</a> \|/ ____ \|/
CS-Group BP2/22, 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 48 39 06 \__U_/
_______________________________________________
neutron-mc mailing list
<a class="moz-txt-link-abbreviated" href="mailto:neutron-mc@risoe.dk">neutron-mc@risoe.dk</a>
<a class="moz-txt-link-freetext" href="http://mailman.risoe.dk/mailman/listinfo/neutron-mc">http://mailman.risoe.dk/mailman/listinfo/neutron-mc</a>
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
What's up Doc ?
--------------------------------------------
Emmanuel FARHI, <a class="moz-txt-link-freetext" href="http://www.ill.fr/Computing/people/Farhi">http://www.ill.fr/Computing/people/Farhi</a> \|/ ____ \|/
CS-Group BP2/22, 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 48 39 06 \__U_/
</pre>
</body>
</html>