[mcstas-users] monitor_nD renormalization

Andrew Jackson andrew.jackson at esss.se
Thu Jun 1 11:41:00 CEST 2017


Hi Emmanuel,

Very handy - good to know. I shall be making use of this method for sure!

Andrew
______________________________________
Andrew Jackson
Instrument Scientist - Small Angle Scattering
Deputy Head of Neutron Instruments Division
European Spallation Source, P.O Box 176, SE-221 00 Lund, Sweden
Adjunct Associate Professor (Adjungerad Lektor)
Physical Chemistry, Lund University, P.O. Box 124, SE-221 00, Lund, Sweden

Phone: +46 46 888 3015
Mobile: +46 72 179 2015
E-mail: a<mailto:andrew.jackson at esss.se>ndrew.jackson at esss.se

www.esss.se


From: mcstas-users <mcstas-users-bounces at mcstas.org> on behalf of Emmanuel FARHI <farhi at ill.fr>
Organization: Institut Laue-Langevin
Date: Thursday 1 June 2017 at 10:44
To: "mcstas-users at mcstas.org" <mcstas-users at mcstas.org>, "sgomez at cab.cnea.gov.ar" <sgomez at cab.cnea.gov.ar>
Subject: Re: [mcstas-users] monitor_nD renormalization


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<http://www.ill.eu/computing/people/emmanuel-farhi> \|/ ____ \|/

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_/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20170601/4cd3ef4f/attachment.html>


More information about the mcstas-users mailing list