<html aria-label="message body">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
HI Rob, Markus
<div><br>
</div>
<div><br>
</div>
<div>The manual is unfortunately somewhat out-of-date wrt. Monitor_nD and uservars. Since McStas 3 you can no longer directly pass a value (i.e. log(something) to the user1 input. </div>
<div>Today uservars become part of the particle and identified / handled by a string symbol.</div>
<div><br>
<div><br>
</div>
<div>Building on Markus’ input, the easiest achievable option would be to </div>
<div><br>
</div>
<div>1) Use an instrument USERVAR to calculate your own value of log10(Q) based on time-of-flight of the individual neutron (let’s call it logQ)</div>
<div><br>
</div>
<div>2) Measure that uservar with Monitor_nD(user1=“logQ”, username1=“Log10(Q)”, options=“user1 limits=[-3 0] bins=90”)</div>
<div><br>
</div>
<div><br>
</div>
<div>The output routines of Monitor_nD are effectively the same as used in every other monitor, DETECTOR_OUT_0D … DETECTOR_OUT_2D  (list-mode is also a 2d block “with trimmings”)</div>
<div><br>
</div>
<div><br>
</div>
<div>Feel free to add an issue on GitHub about a wish for log-binning, then it could potentially come some time in the future...</div>
<div><br>
</div>
<div><br>
</div>
<div>Best</div>
<div>Peter</div>
<div><br>
</div>
<div><br id="lineBreakAtBeginningOfMessage">
<div><br>
<blockquote type="cite">
<div>On 22 Jan 2026, at 13.04, Robert Dalgliesh - STFC UKRI via mcstas-users <mcstas-users@mcstas.org> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">Hi Markus,<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">I can’t use the built in q monitors because they don’t take account of time-of-flight.<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">I’m writing monitors that essentially perform a TOF data reduction in mcstas to remove the step where you have to push the data through e.g. Mantid.<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">This route is much more efficient as it doesn’t result in large event mode files but relies on you not using the fact that mcstas inherently knows the direction of travel and wavelength
 of the neutron.<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">The downside is that you run into this sort of problem and you have to do a bunch of geometry calculations to work out where pixels are in real space.<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">That being said I can possibly use the output routines from monitor_nd….<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">I’ll take a look<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">Thanks for the reply<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">Rob<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><o:p> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><o:p> </o:p></div>
<div>
<div style="border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(225, 225, 225) currentcolor currentcolor; border-image: none; padding: 3pt 0cm 0cm;">
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><b><span lang="EN-US" style="font-family: Calibri, sans-serif;">From:</span></b><span lang="EN-US" style="font-family: Calibri, sans-serif;"><span class="Apple-converted-space"> </span>Markus
 APPEL <appel@ill.fr><span class="Apple-converted-space"> </span><br>
<b>Sent:</b><span class="Apple-converted-space"> </span>22 January 2026 08:27<br>
<b>To:</b><span class="Apple-converted-space"> </span>Dalgliesh, Robert (STFC,RAL,ISIS) <robert.dalgliesh@stfc.ac.uk>; mcstas-users@mcstas.org<br>
<b>Subject:</b><span class="Apple-converted-space"> </span>Re: [mcstas-users] logarithmic binning detector<o:p></o:p></span></div>
</div>
</div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><o:p> </o:p></div>
<div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">Hi Rob,<br>
not sure if it's what you want to achieve, but would it not be easier to monitor log10(Q) with limits from -3 to 0 and 90 linear bins?<br>
That should be simple with Monitor_nD and user variables (see section 9.8.7 of the Component Manual):<br>
<span style="font-family: "Courier New";">COMPONENT QMonitor = Monitor nD ( user1=log10(Q) , username1=”Log (Q)” , ....)</span><br>
<br>
Unless that's what you wanted to avoid for some reason.<br>
<br>
Best,<br>
Markus<br>
<br>
On 21/01/2026 13:09, Robert Dalgliesh - STFC UKRI via mcstas-users wrote:<span style="font-size: 12pt;"><o:p></o:p></span></div>
</div>
<blockquote style="margin-top: 5pt; margin-bottom: 5pt;">
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">Hi,<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">If I want to create a new detector with logarithmic binning is there an easy way to export the x array?<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">The way DETECTOR_OUT_1D works requires the binning scheme to be linear.<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"> <o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">I would like to define e.g. q bins<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">1e-3 to 1.0 with 8% binning so the bins are<span class="Apple-converted-space"> </span><o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"> <o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">[a,ab,ab^2,….] where a=1e-3 and b=1.08.<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"> <o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">Working out which bin to put data into is straightforward in the same way as linear bins but data output isn’t, due to the constraints of the function above.<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">In addition, the read function for mcstas plotting would need modification so I guess it will mean an additional function is required unless I’ve missed something.<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"> <o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">Obviously, I can write something that outputs the data and post process the x array but that’s not ideal.<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"> <o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;">Rob<o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"> <o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"> <o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"> <o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><span style="font-size: 8pt; font-family: Arial, sans-serif;">====================================================================</span><o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><span style="font-size: 8pt; font-family: Arial, sans-serif;">If you receive this email outside working hours then please do not feel obliged to reply</span><o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><span style="font-size: 8pt; font-family: Arial, sans-serif;">====================================================================</span><o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><span style="font-size: 8pt; font-family: Arial, sans-serif;">Dr. Robert Dalgliesh</span><o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><span style="font-size: 8pt; font-family: Arial, sans-serif;">Small Angle Scattering Group Leader</span><o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><span style="font-size: 8pt; font-family: Arial, sans-serif; color: rgb(51, 51, 51); background: white;">ISIS Neutron and Muon Source</span><span style="font-size: 8pt; font-family: Arial, sans-serif; color: rgb(51, 51, 51);"><br>
<span style="background: white;">Science and Technology Facilities Council</span><br>
<span style="background: white;">Building R3 1.29,<span class="Apple-converted-space"> </span></span></span><o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><span style="font-size: 8pt; font-family: Arial, sans-serif; color: rgb(51, 51, 51); background: white;">Rutherford Appleton Laboratory​​</span><span style="font-size: 8pt; font-family: Arial, sans-serif; color: rgb(51, 51, 51);">,<br>
<span style="background: white;">​Harwell Campus,<span class="Apple-converted-space"> </span></span></span><o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><span style="font-size: 8pt; font-family: Arial, sans-serif; color: rgb(51, 51, 51); background: white;">Didcot</span><span style="font-size: 8pt; font-family: Arial, sans-serif; color: rgb(51, 51, 51);"><br>
<span style="background: white;">​Oxfordshire,<span class="Apple-converted-space"> </span></span></span><o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><span style="font-size: 8pt; font-family: Arial, sans-serif; color: rgb(51, 51, 51); background: white;">OX11 0QX.  </span><o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><span style="font-size: 8pt; font-family: Arial, sans-serif; color: rgb(51, 51, 51); background: white;">UK</span><o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><span style="font-size: 8pt; font-family: Arial, sans-serif; color: rgb(51, 51, 51); background: white;">Tel: +44(0)1235-445687</span><o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><span style="font-size: 8pt; font-family: Arial, sans-serif; color: rgb(51, 51, 51); background: white;">Email:<span class="Apple-converted-space"> </span><a href="mailto:Robert.dalgliesh@stfc.ac.uk" style="color: blue; text-decoration: underline;">Robert.dalgliesh@stfc.ac.uk</a></span><o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"> <o:p></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><span style="font-size: 12pt;"><br>
<br>
<o:p></o:p></span></div>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";">_______________________________________________<o:p></o:p></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";">mcstas-users mailing list<o:p></o:p></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";"><a href="mailto:mcstas-users@mcstas.org" style="color: blue; text-decoration: underline;">mcstas-users@mcstas.org</a><o:p></o:p></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";"><a href="https://mailman2.mcstas.org/mailman/listinfo/mcstas-users" originalsrc="https://mailman2.mcstas.org/mailman/listinfo/mcstas-users" style="color: blue; text-decoration: underline;">https://mailman2.mcstas.org/mailman/listinfo/mcstas-users</a><o:p></o:p></pre>
</blockquote>
<div style="margin: 0cm; font-size: 11pt; font-family: Aptos, sans-serif;"><span style="font-size: 12pt;"><o:p> </o:p></span></div>
</div>
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">mcstas-users
 mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">mcstas-users@mcstas.org</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">https://mailman2.mcstas.org/mailman/listinfo/mcstas-users</span></div>
</blockquote>
</div>
<br>
</div>
</div>
</body>
</html>