[neutron-mc] Simple Question
Aaron M. Percival
percival at physics.queensu.ca
Wed Jan 10 22:19:27 CET 2007
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: neutron-mc-bounces at risoe.dk [mailto:neutron-mc-bounces at risoe.dk] 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.
> 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: neutron-mc-bounces at risoe.dk [mailto:neutron-mc-bounces at risoe.dk] 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
> neutron-mc at risoe.dk
> http://mailman.risoe.dk/mailman/listinfo/neutron-mc
>
>
>
>
> --
> What's up Doc ?
> --------------------------------------------
> Emmanuel FARHI, http://www.ill.fr/Computing/people/Farhi \|/ ____ \|/
> 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
> neutron-mc at risoe.dk
> http://mailman.risoe.dk/mailman/listinfo/neutron-mc
>
--
FARHI Emmanuel <farhi at ill.fr>
Groupe DS/CS, ILL4/156, Tel 04 76 20 71 35
ILL, Grenoble
_______________________________________________
neutron-mc mailing list
neutron-mc at risoe.dk
http://mailman.risoe.dk/mailman/listinfo/neutron-mc
More information about the mcstas-users
mailing list