From c508e28b7f4e6b29210dac30b2d0132072537940 Mon Sep 17 00:00:00 2001 From: erkn Date: Mon, 11 Nov 2024 20:53:06 +0100 Subject: [PATCH 1/2] potential fix for #1735 --- mcxtrace-comps/sources/Source_div_quasi.comp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/mcxtrace-comps/sources/Source_div_quasi.comp b/mcxtrace-comps/sources/Source_div_quasi.comp index 70e7f22245..8123cd2c4e 100644 --- a/mcxtrace-comps/sources/Source_div_quasi.comp +++ b/mcxtrace-comps/sources/Source_div_quasi.comp @@ -32,8 +32,8 @@ * %Parameters * xwidth: [m] Width of source * yheight: [m] Height of source -* focus_aw: [rad] Std. dev. (Gaussian) or maximal (uniform) horz. width divergence -* focus_ah: [rad] Std. dev. (Gaussian) or maximal (uniform) vert. height divergence +* focus_aw: [rad] Std. dev. (Gaussian) or maximal (uniform) horz. width divergence. focus_xw overrrides if it is more restrictive. +* focus_ah: [rad] Std. dev. (Gaussian) or maximal (uniform) vert. height divergence. focus_yh overrrides if it is more restrictive. * focus_xw: [m] Width of sampling window * focus_yh: [m] Height of sampling window * dist: [m] Downstream distance to place sampling target window @@ -174,24 +174,17 @@ INITIALIZE /*check if divergence limits are compatible with focus_xw, focus_yh*/ if(focus_xw!=0){ double maxdivh=atan((xwidth+focus_xw)/dist); - if (focus_aw>maxdivh){ + if (focus_aw>maxdivh || focus_aw==0 ){ focus_aw=maxdivh; - if (verbose){ - fprintf(stderr,"WARNING(%s): sampling width does not support full divergence. Adjusting to focus_aw=%g rad\n",NAME_CURRENT_COMP,focus_aw); - } } } if(focus_yh!=0){ double maxdivv=atan((yheight+focus_yh)/dist); - if (focus_ah>maxdivv){ + if (focus_ah>maxdivv || focus_ah==0 ){ focus_ah=maxdivv; - if (verbose){ - fprintf(stderr,"WARNING(%s): sampling height does not support full divergence. Adjusting to focus_ah=%g rad\n",NAME_CURRENT_COMP,focus_ah); - } } } - %} TRACE From 76bed956df4122d8efe3c662a926c4381191c6ed Mon Sep 17 00:00:00 2001 From: erkn Date: Thu, 14 Nov 2024 00:24:52 +0100 Subject: [PATCH 2/2] porting edits from the mcxtrace comp --- mcstas-comps/sources/Source_div_quasi.comp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/mcstas-comps/sources/Source_div_quasi.comp b/mcstas-comps/sources/Source_div_quasi.comp index e87936492b..550d869b67 100644 --- a/mcstas-comps/sources/Source_div_quasi.comp +++ b/mcstas-comps/sources/Source_div_quasi.comp @@ -35,8 +35,8 @@ * %P * xwidth: [m] Width of source * yheight: [m] Height of source -* focus_aw: [rad] Std. dev. (Gaussian) or maximal (uniform) horz. width divergence -* focus_ah: [rad] Std. dev. (Gaussian) or maximal (uniform) vert. height divergence +* focus_aw: [rad] Std. dev. (Gaussian) or maximal (uniform) horz. width divergence. focus_xw overrrides if it is more restrictive. +* focus_ah: [rad] Std. dev. (Gaussian) or maximal (uniform) vert. height divergence. focus_yh overrrides if it is more restrictive. * focus_xw: [m] Width of sampling window * focus_yh: [m] Height of sampling window * dist: [m] Downstream distance to place sampling target window @@ -178,20 +178,14 @@ INITIALIZE /*check if divergence limits are compatible with focus_xw, focus_yh*/ if(focus_xw!=0){ double maxdivh=atan((xwidth+focus_xw)/dist); - if (focus_aw>maxdivh){ + if (focus_aw>maxdivh || focus_aw==0 ){ focus_aw=maxdivh; - if (verbose){ - fprintf(stderr,"WARNING(%s): sampling width does not support full divergence. Adjusting to focus_aw=%g rad\n",NAME_CURRENT_COMP,focus_aw); - } } } if(focus_yh!=0){ double maxdivv=atan((yheight+focus_yh)/dist); - if (focus_ah>maxdivv){ + if (focus_ah>maxdivv || focus_ah==0 ){ focus_ah=maxdivv; - if (verbose){ - fprintf(stderr,"WARNING(%s): sampling height does not support full divergence. Adjusting to focus_ah=%g rad\n",NAME_CURRENT_COMP,focus_ah); - } } }