1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 <2016> 2017 2018 2019 2020 2021 2022 2023 2024 2025 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 <2016> 2017 2018 2019 2020 2021 2022 2023 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: Script BOY IntensityGraph to show areaDetector output of variable size |
From: | Phil Atkin <[email protected]> |
To: | "Pearson, Matthew R." <[email protected]> |
Cc: | "[email protected] list" <[email protected]> |
Date: | Thu, 21 Apr 2016 10:58:08 +0100 |
Perfect. Thanks very much! Phil On 20/04/2016 18:04, Pearson, Matthew R. wrote:
Click the ‘Rules’ value for the Intensity Widget, then click the ‘+’ icon. Enter a name for the rule, followed by selecting the actual property that the rule will change (eg. Data Width). In the ‘Input PVs’ list add the PV name (e.g.. $(P):ArraySize0_RBV) and make sure that the trigger is set to ‘Yes’. This will ensure the rule will run when the PV changes. Then in the ‘Expressions’ list, type in ‘pv0’ in the right field, then ‘true’ in the left field. Also make sure the ‘Output Expression’ is ticked. To verify the rule, click the ‘See Generated Script’ button. I get: importPackage(Packages.org.csstudio.opibuilder.scriptUtil); var pv0 = PVUtil.getDouble(pvs[0]); if(true) widget.setPropertyValue("data_width",pv0); else widget.setPropertyValue("data_width",2560); (where the 2560 is what I set the property to default to). When you have multiple input PVs, the variable names in the Expressions list are pv0, pv1, pv2, etc. Cheers, MattOn Apr 20, 2016, at 12:04 PM, Phil Atkin <[email protected]> wrote: Thanks to both of you. Could one of you give me a pointer on how to create such a rule? Thanks Phil On 20/04/2016 16:56, Pearson, Matthew R. wrote:Hi Phil, We do the same as Bruno mentions. Data Height (ArraySize1_RBV) Data Width (ArraySize0_RBV) where the PVs are from the StdArray plugin. In addition you’ll also need to have additional rules for setting the X and Y axis Min and Max values. These rules use the PVs from the detector driver that knows about binning and ROI selection: X Axis Min - (MinX_RBV) Y Axis Min - (MinY_RBV) X Axis Max (MinX_RBV + ArraySizeX_RBV) Y Axis Max (MinY_RBV + ArraySizeY_RBV) We also use a another rule that defines the maximum intensity (the Maximum property) based on a PV. Then we have a Scaled Slider widget to change the intensity. Cheers, Matt Data Acquisition and Control Engineer Spallation Neutron Source Oak Ridge National LabOn Apr 20, 2016, at 9:26 AM, Bruno Martins <[email protected]> wrote: Hi Phil, You can create two rules, for the data_width and data_height properties, that look at the $(P)ArraySize0_RBV and $(P)ArraySize1_RBV PV's HTH, Bruno On Wed, Apr 20, 2016 at 6:44 AM, Phil Atkin <[email protected]> wrote: Thanks Gabriela, - but I guess my question was ambiguous. If I understand correctly, your script adjusts the height of the IntensityGraph widget so that its aspect ratio matches the image. But the IntensityGraph will not display anything at all unless I set its Data Height and Data Width properties to match the attached array. Do you have something to accomplish this? Also: I have no idea how to actually attach the code or make it run at an appropriate time. Can you point me at documentation that describes this? Thanks Phil On 20/04/2016 11:34, [email protected] wrote: this is the very simple python script that I use: from org.csstudio.opibuilder.scriptUtil import PVUtil imageWidget = display.getWidget('Image') imageXSizeWidget = display.getWidget('X-Size') imageYSizeWidget = display.getWidget('Y-Size') try : imageXSizePV = imageXSizeWidget.getPV() imageYSizePV = imageYSizeWidget.getPV() nImageRows = PVUtil.getLong(imageYSizePV) nImageColumns = PVUtil.getLong(imageXSizePV) imageWidget.setPropertyValue('graph_area_width', 512) imageWidget.setPropertyValue('graph_area_height', (512.0/nImageColumns)*nImageRows) except : pass Phil Atkin <[email protected]> ha scritto: Hi, I'm using BOY IntensityGraph to show a (stdArray) output image from an areaDetector driver/plugin. The size of my array changes quite a bit. Can someone tell me (in laborious detail if necessary, please) how to set up scripts or "embedded rules" on the IntensityGraph to cope with a variable-sized image? Thanks! Phil