[mcstas-users] monitor_nD renormalization
farhi
farhi at ill.fr
Thu Jun 1 22:46:46 CEST 2017
Hello Santiago,
you can also try my iFit from http://ifit.mccode.org, and proceed with:
>> a = iData('path_to_monitors');
>> renormalized = a/10;
much more complex stuff can be done. Look at the doc. You can re-export
the modified data sets in many formats.
Emmanuel.
Le 2017-06-01 18:13, Santiago Gómez a écrit :
> Dear Emmanuel,
>
> thank for your reply, I will try to implement that. Anyway, I have to
> renormalize all my monitor (about 10 or more), so I think the post
> processing option mentioned by Andrew is also good, I will explore which
> solution is most favorable for the way I am doing the different
> simulations.
>
> Best Regards
> Santiago
>
> On 2017-06-01 05:44, Emmanuel FARHI wrote:
>
>> Hello all, there is a way. Detector values are stored into a structure of type MCDETECTOR defined in _lib/share/mccode-r.h_, which can be retrieved e.g. in an instrument SAVE section. Then you can assemble an other data set to be exported as a 'normal' new monitor. TRACE COMPONENT BLAH = Monitor_nD(...) ... SAVE %{ /* get the detector structure */ MCDETECTOR det = MC_GETPAR(BLAH, detector); _/* then use any of: det.(field)_ _ double xmin,xmax; /* min max of axes */_ _ double ymin,ymax;_ _ double zmin,zmax;_ _ double intensity; /* integrated values for data block */_ _ double error;_ _ double events;_ _ double min; /* statistics for data block */_ _ double max;_ _ double mean;_ _ double centerX; /* statistics for axes */_ _ double halfwidthX;_ _ double centerY;_ _ double halfwidthY;_ _ int rank; /* dimensionaly of monitor, e.g. 0 1 2 3 */_ _ long m,n,p; /* dimensions of data block and along axes */_ _ double *p0, *p1, *p2; /* pointers to saved data, NULL when freed */_ _*/_ double
NEW_ARRAY = malloc(sizeof(double)*det.m*det.n); _/* do not free the array as it will be wrtten to disk */_ double factor = 10; for (i=0; i<det.n*det.m; i++) { NEW_ARRAY[i] = det.p1[i] * factor; /* in this example we just multiply by factor=10 */ } /* generate new detector, with only the intensity, no sigma nor ncount per pixel */ DETECTOR_OUT_1D(title,xlabel,ylabel, "new_signal",det.xmin,det.xmax,det.m, NULL,&NEW_ARRAY[0],NULL,"filename"); DETECTOR_OUT_2D(title,xlabel,ylabel, det.xmin,det.xmax,det.ymin,det.ymax,det.m,det.n, NULL,&NEW_ARRAY[0],NULL,"filename"); %} END Emmanuel. On 06/01/2017 09:39 AM, Andrew Jackson wrote: Is there any simple way t -- Emmanuel FARHI,www.ill.eu/computing/people/emmanuel-farhi [1] [1] |/ ____ |/ CS-Group ILL4/221, Institut Laue-Langevin (ILL) Grenoble ~@-/ oO -@~ 71 av des Martyrs,CS 20156,38042 Grenoble Cedex 9,France /_( __/ )_ Work :Tel (33/0) 4 76 20 71 35. Fax (33/0) 4 76 48 39 06 __U_/ Links: ------ [1]
http://www.ill.eu/computing/people/emmanuel-farhi [1]
--
FARHI Emmanuel <farhi at ill.fr>
Groupe DS/CS, ILL4/156, Tel (33) 4 76 20 71 35
ILL, Grenoble
Links:
------
[1] http://www.ill.eu/computing/people/emmanuel-farhi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20170601/fea7d92d/attachment.html>
More information about the mcstas-users
mailing list