From 94ab1a41980e5ae9605b791b6185fb333887bfd5 Mon Sep 17 00:00:00 2001 From: mwyman <mwyman@anl.gov> Date: Wed, 27 Nov 2024 16:03:45 -0600 Subject: [PATCH] Double CRL system working --- .../op/ui/pydev_transfocator_double_more.ui | 83 ++- 100idPyApp/op/ui/pydev_transfocator_help.ui | 191 ++++++ .../op/ui/pydev_transfocator_inset_bits_2.ui | 629 ++++++++++++++++++ .../__pycache__/pyCRL_system.cpython-311.pyc | Bin 40425 -> 40857 bytes 100idPyApp/python/pyCRL_system.py | 40 +- IOC_vs_XS_double.ipynb | 411 +++++++++++- 6 files changed, 1318 insertions(+), 36 deletions(-) create mode 100644 100idPyApp/op/ui/pydev_transfocator_help.ui create mode 100644 100idPyApp/op/ui/pydev_transfocator_inset_bits_2.ui diff --git a/100idPyApp/op/ui/pydev_transfocator_double_more.ui b/100idPyApp/op/ui/pydev_transfocator_double_more.ui index 586f8e7..38f280f 100644 --- a/100idPyApp/op/ui/pydev_transfocator_double_more.ui +++ b/100idPyApp/op/ui/pydev_transfocator_double_more.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>1610</width> - <height>698</height> + <height>951</height> </rect> </property> <property name="windowTitle"> @@ -122,7 +122,7 @@ <x>-10</x> <y>40</y> <width>1611</width> - <height>651</height> + <height>901</height> </rect> </property> <widget class="caCartesianPlot" name="cacartesianplot"> @@ -157,7 +157,7 @@ <widget class="caRelatedDisplay" name="carelateddisplay_48"> <property name="geometry"> <rect> - <x>1470</x> + <x>810</x> <y>620</y> <width>120</width> <height>29</height> @@ -238,7 +238,7 @@ <widget class="caRelatedDisplay" name="carelateddisplay_50"> <property name="geometry"> <rect> - <x>1340</x> + <x>680</x> <y>620</y> <width>120</width> <height>29</height> @@ -553,7 +553,78 @@ <string>P=$(P),CRL=$(CRL)</string> </property> <property name="filename" stdset="0"> - <string notr="true">pydev_transfocator_inset_bits.ui</string> + <string notr="true">pydev_transfocator_inset_bits_2.ui</string> + </property> + </widget> + <widget class="caCartesianPlot" name="cacartesianplot_3"> + <property name="geometry"> + <rect> + <x>970</x> + <y>630</y> + <width>631</width> + <height>251</height> + </rect> + </property> + <property name="TitleX"> + <string notr="true">Config Index</string> + </property> + <property name="TitleY"> + <string notr="true">Inv Focal length (1/m)</string> + </property> + <property name="channels_1" stdset="0"> + <string>;$(P)$(CRL):2:invF</string> + </property> + <property name="color_1"> + <color> + <red>0</red> + <green>0</green> + <blue>255</blue> + </color> + </property> + <property name="YAxisType" stdset="0"> + <enum>caCartesianPlot::log10</enum> + </property> + </widget> + <widget class="caRelatedDisplay" name="carelateddisplay_52"> + <property name="geometry"> + <rect> + <x>30</x> + <y>830</y> + <width>122</width> + <height>45</height> + </rect> + </property> + <property name="label"> + <string notr="true">- Help</string> + </property> + <property name="foreground"> + <color> + <red>228</red> + <green>228</green> + <blue>228</blue> + </color> + </property> + <property name="background"> + <color> + <red>53</red> + <green>132</green> + <blue>0</blue> + </color> + </property> + <property name="labels"> + <string>Alternate UI</string> + </property> + <property name="files"> + <string>pydev_transfocator_help.ui</string> + </property> + <property name="args"> + <string>P=$(P),F=$(F),N=$(N)</string> + </property> + <property name="stackingMode" stdset="0"> + <enum>caRowColMenu::Menu</enum> + </property> + <property name="removeParent" stdset="0"> + <string>false</string> </property> </widget> <zorder>cainclude_3</zorder> @@ -571,6 +642,8 @@ <zorder>carelateddisplay_51</zorder> <zorder>cainclude_4</zorder> <zorder>cainclude_5</zorder> + <zorder>cacartesianplot_3</zorder> + <zorder>carelateddisplay_52</zorder> </widget> </widget> </widget> diff --git a/100idPyApp/op/ui/pydev_transfocator_help.ui b/100idPyApp/op/ui/pydev_transfocator_help.ui new file mode 100644 index 0000000..cd49134 --- /dev/null +++ b/100idPyApp/op/ui/pydev_transfocator_help.ui @@ -0,0 +1,191 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Form</class> + <widget class="QWidget" name="Form"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>677</width> + <height>1029</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QVBoxLayout" name="verticalLayout" stretch="1,20"> + <item> + <widget class="caFrame" name="caframe_8"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>941</width> + <height>16777215</height> + </size> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <property name="background"> + <color> + <red>0</red> + <green>53</green> + <blue>132</blue> + </color> + </property> + <property name="backgroundMode"> + <enum>caFrame::Filled</enum> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>5</number> + </property> + <property name="leftMargin"> + <number>10</number> + </property> + <property name="topMargin"> + <number>2</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>2</number> + </property> + <item> + <widget class="caLabel" name="calabel"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>941</width> + <height>16777215</height> + </size> + </property> + <property name="font"> + <font> + <family>Verdana</family> + <pointsize>26</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>PyDev Transfocator Help</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="fontScaleMode"> + <enum>ESimpleLabel::Height</enum> + </property> + <property name="foreground"> + <color> + <red>228</red> + <green>228</green> + <blue>228</blue> + </color> + </property> + <property name="background"> + <color alpha="0"> + <red>160</red> + <green>160</green> + <blue>164</blue> + </color> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QTextBrowser" name="textBrowser"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="html"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Mono/Local</span> (Control): </p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> <span style=" font-weight:600;">Mono</span>: use Mono energy (PV needs to be condfigured in filter IOC startup file</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> <span style=" font-weight:600;">Local</span>: manually enter energy (in keV)</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Lookup Table Energy</span> (RBV): energy used in calculating attenuation lookup table</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Focal Size</span>(Control/RBV): desired focal size/actual focal size (based on available lenses). </p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Focal Size Index</span> (Control/RBV): index of desired focal size from lookup table (after table is sorted by increasing focal power [inverse focal length])</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Coarse Focal Power Increment</span>: goes to next higher/lower CRL1 configuration in terms of focal power. CRL2 adjusted to remain on lookup tables configuration space</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Fine Focal Power Increment</span>: goes to next higher/lower CRL2 configuration in terms of focal power. CRL1 is left unchanged. System is moved off of lookup table's configuration space so focal size must be re-calculated.</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Thickness error Flag</span>: incorporates error in lens thickness measurments in optics calculations</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Verbose Flag</span>: prints output to IOC console</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Thickness error Flag</span>: incorporates error in lens thickness measurments in optics calculations</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Preview Index</span>: Returns focal size value for given lookup table index</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">CRL1/CRL2 Indices</span> (RBVs):</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 10-bit: binary configuration based on desired/actual focal size controls</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Ind. Control: binary configuration based on lens controls</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Readbacks: binary configuration based on lens readbacks</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Slits</span>: Readbacks of slit sizes in front of each optical element along with name of PVs</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Plots</span>:</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Focal Size</span> - sorted by focal power</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Focal power</span> - both CRL1 and CRL2 (sorted)</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">SYNC</span>: when lenses actuated externally , SYNC button can be used to update focal size RBV (maybe?)</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Stacks info</span>: stack material, count, diameter for each CRL system</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Testing Screen</span>: quick access to energy and slits PVs used in testing</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Notes:</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">-If lens individually controlled and then focal size control used, it may be necessary to set the focal size an extra time for the lens configuration to update correctly</p></body></html></string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>caFrame</class> + <extends>QFrame</extends> + <header>caFrame</header> + <container>1</container> + </customwidget> + <customwidget> + <class>caLabel</class> + <extends>QLabel</extends> + <header>caLabel</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/100idPyApp/op/ui/pydev_transfocator_inset_bits_2.ui b/100idPyApp/op/ui/pydev_transfocator_inset_bits_2.ui new file mode 100644 index 0000000..92862a5 --- /dev/null +++ b/100idPyApp/op/ui/pydev_transfocator_inset_bits_2.ui @@ -0,0 +1,629 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>413</width> + <height>207</height> + </rect> + </property> + <property name="windowTitle"> + <string>MainWindow</string> + </property> + <widget class="QWidget" name="centralwidget"> + <widget class="QWidget" name="gridLayoutWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>411</width> + <height>201</height> + </rect> + </property> + <layout class="QGridLayout" name="gridLayout" rowstretch="1,1,1,1,1,1,1,1" columnstretch="1,1,1"> + <property name="horizontalSpacing"> + <number>5</number> + </property> + <property name="verticalSpacing"> + <number>0</number> + </property> + <property name="margin"> + <number>5</number> + </property> + <item row="7" column="2"> + <widget class="caLineEdit" name="caLineEdit_19"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + </font> + </property> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="channel" stdset="0"> + <string notr="true">$(P)$(CRL):fSize_preview</string> + </property> + <property name="foreground"> + <color> + <red>10</red> + <green>0</green> + <blue>184</blue> + </color> + </property> + <property name="background"> + <color> + <red>200</red> + <green>200</green> + <blue>200</blue> + </color> + </property> + <property name="colorMode"> + <enum>caLineEdit::Static</enum> + </property> + <property name="precision"> + <number>3</number> + </property> + <property name="precisionMode"> + <enum>caLineEdit::Channel</enum> + </property> + <property name="fontScaleMode" stdset="0"> + <enum>caLineEdit::None</enum> + </property> + <property name="formatType"> + <enum>caLineEdit::engr_notation</enum> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="caLineEdit" name="caLineEdit_18"> + <property name="font"> + <font> + <pointsize>13</pointsize> + </font> + </property> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="channel" stdset="0"> + <string notr="true">$(P)$(CRL):2:lensConfig_BW</string> + </property> + <property name="foreground"> + <color> + <red>10</red> + <green>0</green> + <blue>184</blue> + </color> + </property> + <property name="background"> + <color> + <red>200</red> + <green>200</green> + <blue>200</blue> + </color> + </property> + <property name="colorMode"> + <enum>caLineEdit::Static</enum> + </property> + <property name="fontScaleMode" stdset="0"> + <enum>caLineEdit::None</enum> + </property> + </widget> + </item> + <item row="6" column="2"> + <widget class="caLineEdit" name="caLineEdit_20"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + </font> + </property> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="channel" stdset="0"> + <string notr="true">$(P)$(CRL):thickerr_flag_RBV</string> + </property> + <property name="foreground"> + <color> + <red>10</red> + <green>0</green> + <blue>184</blue> + </color> + </property> + <property name="background"> + <color> + <red>200</red> + <green>200</green> + <blue>200</blue> + </color> + </property> + <property name="colorMode"> + <enum>caLineEdit::Static</enum> + </property> + <property name="precision"> + <number>3</number> + </property> + <property name="precisionMode"> + <enum>caLineEdit::User</enum> + </property> + <property name="fontScaleMode" stdset="0"> + <enum>caLineEdit::None</enum> + </property> + <property name="formatType"> + <enum>caLineEdit::compact</enum> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="caLabel" name="calabel_20"> + <property name="text"> + <string>10-bit</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="fontScaleMode"> + <enum>ESimpleLabel::WidthAndHeight</enum> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="caLabel" name="calabel_24"> + <property name="font"> + <font> + <pointsize>14</pointsize> + </font> + </property> + <property name="text"> + <string>Readbacks</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="fontScaleMode"> + <enum>ESimpleLabel::WidthAndHeight</enum> + </property> + </widget> + </item> + <item row="7" column="1"> + <widget class="caTextEntry" name="catextentry_14"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="channel" stdset="0"> + <string notr="true">$(P)$(CRL):previewIndex</string> + </property> + <property name="background"> + <color> + <red>115</red> + <green>223</green> + <blue>255</blue> + </color> + </property> + <property name="colorMode"> + <enum>caLineEdit::Static</enum> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="caLineEdit" name="caLineEdit_11"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + </font> + </property> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="channel" stdset="0"> + <string notr="true">$(P)$(CRL):1:lenses</string> + </property> + <property name="foreground"> + <color> + <red>10</red> + <green>0</green> + <blue>184</blue> + </color> + </property> + <property name="background"> + <color> + <red>200</red> + <green>200</green> + <blue>200</blue> + </color> + </property> + <property name="colorMode"> + <enum>caLineEdit::Static</enum> + </property> + <property name="fontScaleMode" stdset="0"> + <enum>caLineEdit::None</enum> + </property> + <property name="formatType"> + <enum>caLineEdit::decimal</enum> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="caLineEdit" name="caLineEdit_21"> + <property name="font"> + <font> + <pointsize>13</pointsize> + </font> + </property> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="channel" stdset="0"> + <string notr="true">$(P)$(CRL):2:lensConfig_RBV</string> + </property> + <property name="foreground"> + <color> + <red>10</red> + <green>0</green> + <blue>184</blue> + </color> + </property> + <property name="background"> + <color> + <red>200</red> + <green>200</green> + <blue>200</blue> + </color> + </property> + <property name="colorMode"> + <enum>caLineEdit::Static</enum> + </property> + <property name="fontScaleMode" stdset="0"> + <enum>caLineEdit::None</enum> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="caLabel" name="calabel_35"> + <property name="text"> + <string>Thickness error flag</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="fontScaleMode"> + <enum>ESimpleLabel::WidthAndHeight</enum> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="caLabel" name="calabel_32"> + <property name="text"> + <string>CRL 1</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="fontScaleMode"> + <enum>ESimpleLabel::WidthAndHeight</enum> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="caChoice" name="caChoice_1"> + <property name="channel" stdset="0"> + <string notr="true">$(P)$(CRL):verbosity</string> + </property> + <property name="foreground"> + <color> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </property> + <property name="background"> + <color> + <red>115</red> + <green>223</green> + <blue>255</blue> + </color> + </property> + <property name="colorMode"> + <enum>caChoice::Static</enum> + </property> + <property name="stackingMode" stdset="0"> + <enum>caChoice::Column</enum> + </property> + <property name="endBit"> + <number>1</number> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="caLineEdit" name="caLineEdit_17"> + <property name="font"> + <font> + <pointsize>13</pointsize> + </font> + </property> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="channel" stdset="0"> + <string notr="true">$(P)$(CRL):1:lensConfig_BW</string> + </property> + <property name="foreground"> + <color> + <red>10</red> + <green>0</green> + <blue>184</blue> + </color> + </property> + <property name="background"> + <color> + <red>200</red> + <green>200</green> + <blue>200</blue> + </color> + </property> + <property name="colorMode"> + <enum>caLineEdit::Static</enum> + </property> + <property name="fontScaleMode" stdset="0"> + <enum>caLineEdit::None</enum> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="caLabel" name="calabel_27"> + <property name="font"> + <font> + <pointsize>14</pointsize> + </font> + </property> + <property name="text"> + <string>Ind. Control</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="fontScaleMode"> + <enum>ESimpleLabel::WidthAndHeight</enum> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="caLabel" name="calabel_34"> + <property name="text"> + <string>Verbose Console?</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="fontScaleMode"> + <enum>ESimpleLabel::WidthAndHeight</enum> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="caLineEdit" name="caLineEdit_12"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>13</pointsize> + </font> + </property> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="channel" stdset="0"> + <string notr="true">$(P)$(CRL):2:lenses</string> + </property> + <property name="foreground"> + <color> + <red>10</red> + <green>0</green> + <blue>184</blue> + </color> + </property> + <property name="background"> + <color> + <red>200</red> + <green>200</green> + <blue>200</blue> + </color> + </property> + <property name="colorMode"> + <enum>caLineEdit::Static</enum> + </property> + <property name="fontScaleMode" stdset="0"> + <enum>caLineEdit::None</enum> + </property> + <property name="formatType"> + <enum>caLineEdit::decimal</enum> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="caChoice" name="caChoice_2"> + <property name="channel" stdset="0"> + <string notr="true">$(P)$(CRL):thickerr_flag</string> + </property> + <property name="foreground"> + <color> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </property> + <property name="background"> + <color> + <red>115</red> + <green>223</green> + <blue>255</blue> + </color> + </property> + <property name="colorMode"> + <enum>caChoice::Static</enum> + </property> + <property name="stackingMode" stdset="0"> + <enum>caChoice::Column</enum> + </property> + <property name="endBit"> + <number>1</number> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="caLabel" name="calabel_30"> + <property name="text"> + <string>Preview Index</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="fontScaleMode"> + <enum>ESimpleLabel::WidthAndHeight</enum> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="caLineEdit" name="caLineEdit_16"> + <property name="font"> + <font> + <pointsize>13</pointsize> + </font> + </property> + <property name="text"> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="channel" stdset="0"> + <string notr="true">$(P)$(CRL):1:lensConfig_RBV</string> + </property> + <property name="foreground"> + <color> + <red>10</red> + <green>0</green> + <blue>184</blue> + </color> + </property> + <property name="background"> + <color> + <red>200</red> + <green>200</green> + <blue>200</blue> + </color> + </property> + <property name="colorMode"> + <enum>caLineEdit::Static</enum> + </property> + <property name="fontScaleMode" stdset="0"> + <enum>caLineEdit::None</enum> + </property> + </widget> + </item> + <item row="4" column="0"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="2"> + <widget class="caLabel" name="calabel_33"> + <property name="text"> + <string>CRL 2</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="fontScaleMode"> + <enum>ESimpleLabel::WidthAndHeight</enum> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </widget> + <customwidgets> + <customwidget> + <class>caChoice</class> + <extends>QWidget</extends> + <header>caChoice</header> + </customwidget> + <customwidget> + <class>caTextEntry</class> + <extends>caLineEdit</extends> + <header>caTextEntry</header> + </customwidget> + <customwidget> + <class>caLabel</class> + <extends>QLabel</extends> + <header>caLabel</header> + </customwidget> + <customwidget> + <class>caLineEdit</class> + <extends>QLineEdit</extends> + <header>caLineEdit</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/100idPyApp/python/__pycache__/pyCRL_system.cpython-311.pyc b/100idPyApp/python/__pycache__/pyCRL_system.cpython-311.pyc index 90560fc94dbf5fb50aa6e9e7f841e386c9950bc9..e501454f0c39b1e6d070d9826c3c61eb64552409 100644 GIT binary patch delta 1448 zcmZ`&Z){Ul6o2=%ufDaf?M92NW&J}}W-&w9=+KSPW-Br?Iwl=%b_>k7$H+QbScjc# z1-8N1C^d9BL_1(QgMX&MFnNhCXaeyQ>OQ=Z`=Owi8A%jFv_ws&@q_nue}d87+;?Bj zJ-^?%zjN-n_dlb@uG5<L)oLY0#wYQb{q;vb*4$!ISoog(L$2g$UUQL-Qmy%r;q}5V z>Sr1BtKigKqS-aJiLRt8=@M?Q)HKmoX}Eu&8UEsxFdWQd2BTC!4ztl!u(d7+eu{GN zWT_JRf*hm^RzTpCiP=sNIa1IiZ$%xa<mHt_N0yuk=z(m(TwsZuKkp6|M`>Q(NlTK$ zMazMOhe5ZTZbDERUVq$To7j@FY`~TcBXZ2<Cs(A{g0xDV(8bC}%F|{WHan*pu(^EN zjw@<!Zo(Dy*!=v+ws>u#`*eL;tBXg+`>@4%OY0Q1&a|T#JGM^q*tPR!H+D5($L@q2 z=UOLpsob?`TM@QBGp)n6M-c0=jX=&Rlbc4hb7{3Uu_@*s@h^9-a3%Z!jdp_nl@MJk zgJ7Zxl#x0(8dSn%Qx42V^79lVYevdn8a!j5U?8#%jx}rGSTKj?8L*b>;p>PRF>pJw zUN#S~fTO2~2@t9Zb~RfUuSCzY3q@DV$0HG0=n6hglixxd;k}-}5gm5JTStoEt0NB- zdr0-WFTm%$HTBjfCeb^}`MT;-tSPP1#w$g(WqhS*X};mao(6Gu6ZX7FEHYDu7Hnt{ z4K1@qGd6CV(qUuS6puG=ztN31@4!YcRQFYurR@%EfAlu&<Tfx@kZeeCYnH1UjQ0s> z4t7PIjD;jgXS=Jz&%t*CobX|EMy42)RR0Lk{u1^^8!oHG_8l<QKZ7n4QYl;+SevcH zVV0ucL5UfP>x>}rYfqR}B;aEU<$*5MDt4j$UV_-5?_VsMSHM$s`EX~D6KYTB5vvS) z2r(Rj&XaA5HzftrfKRSrDkj=4x<N72$n;JYUOW!LA+JU{LPoyd5{RPSfNvuO5KpLK zFL?uFiKiLaVHJ^fs6Y?b2C}kX@2Pdj4|gN0^W;*>3kv63Vl?4q6iW=(i88bs@_c%5 z4OgL!&_BF-T}O!D_o~%b-Dqt;7`A$RUTaB(HS8u)?x;fhdRnvo){@>V+W22|DM42g zH2g4p$bVT%?HaNAsf?21a-}8+NKMco`WmtCWwEUt`}Rwwr6XksU_(GO1n#oxvs{cz z?0MHSDaQ`!;W)OY>@I9~rC2v+-6HFTiIG)xq45{Q!l2mLj2qj<{Q=zADVc@AlqrNw zA<-1N%jKQ*#=J?>N3zLnxVUn<0T)-L9M#xSo#H&0^N5Qx!@%1^`EcO19Oz7(hD)cv zM4t-5*clpK7ygVZWN7AU;yyy(2tSXWr_nuO=-d|w%?Z!FPSZ3c6THb1gvy0uV@*hF uX9_da(&B}C=e?S3C`08ii>t8Z!a>?yqe4X)>i^e=+5O*_@rKJtMgIX%`0*0} delta 1165 zcmZ`&eMnnZ6o2<7FO7LGX3qHW^2~?E6|I&Um%16E&L%312-evY!)BaGHzqaRqMN3s zQd*lvE3M5btL-cl%C;0LWW2%(rP~;kIgs(vU6|YG(82zYjuDwM#`eeVQ#(57E{AjP zJs<D>&iS2p<#W7t7w3Ph*XtO%?sv4msf~Y<|3Hh5N~_vUwK~oOOTiH_N*nq%7OhFH z!W$TunWbNf@(<(R5NsX|z%-|a+JFug_we9~aF7?%Lti8hdWQ<oKKOK~8kt~qsC36} zkiLpEs_|b8;NiVpqGfJ8E7lOPCaEUc(q+L+gnb!Igy%C};`9=sEvcT-&DKxlFLV0Y z!s*6j<D7B6Y(XT|%@2fTS!iCiR1nKfw53h@arh=iFT<JlBKU6%rc^65jCKNF!h<a( zuxy+eWZ_`U3O|kNkOmG$iYcrTdMb}u4ZEm!m(mAig{gO}qo8|4wS8CgR(73JFffDM zW2<75P)x*7K5pluE!2Lz%+u|&IUq7#0t4gUXnHZj48IEv@s1X;;<{trwOuP`m~qQm z|Ft67dgu!$@w`HJDp|o#1ivi!S4<XSs>>7-)Ba4DG_(^_2Q0<i)`xt-Y$bWNBFoze zZ<l%de_H@eCnWSMte<eQ0tJT^`e>27<eyklX(kjbKSR|ihl*6T!|SJ(P>#mdL;vaL z;H8OTs0rwdVeF=5jBL%scAeKX;OHw-sYVQ74HU!u(|aL0wi~?zLopGYlP|!+qz>+l zDT9z_46{#7FUC9BQvn`MCaYm(@{yj4dgu$$h@!rSZ_k7@R~3XZxD(|C?zD=CwdtN) zfjg>OK_WK6K*C=TPkV^9E@QlHy5qTRCDvBBm+)~K`UQom-}@1zJ**y~45iFQNT2OM zonT3c@W-GYdSgcDKWk^7a9iN!B@Xq#>ZB1qOSYmtsVULYeZX&f<5<+TMWoC20~a|m z8hk4fJ~9?`99JR?Pe#<cY!I7zyECmozd=EqWO6!&e@5XqsPNmj=q0{a=}sjp1c?xo zh2TT2{sKSE&%XAdC#@z`FJ>znNo8YJ>mpj0taZWpM9G2BwL`LfK<?@xUH!_zK9Dts zh&d#iLv#!-_@;ex<^@&SOKRQOswPs^l;xWV-z-0t91H7-QZS@a&~@%>BuS>3a~R!~ zK02>ap+#xo;u=EVNtfX&Mk`YN`(GloA#Gm9nEpJ{pI00RHApod97YBkYtJ$NDlc4| k_i-&bCXd}#(xdrfxW&Vv-8tszdVR~j@ju?^e%iEu0FPvUsQ>@~ diff --git a/100idPyApp/python/pyCRL_system.py b/100idPyApp/python/pyCRL_system.py index 895f524..47fc29f 100644 --- a/100idPyApp/python/pyCRL_system.py +++ b/100idPyApp/python/pyCRL_system.py @@ -160,7 +160,7 @@ class focusingSystem(): #----------------------------------------------------------------------> #initialize dictionary for crl indices of current state - self.indexSorted = 0 + self.indexSorted = {'1':0, '2':0} if self.sysType is SYSTEM_TYPE.doubleCRL: self.index = {'1':0,'2':0} else: @@ -568,11 +568,15 @@ class focusingSystem(): Label of optical element ''' if self.verbose: print(f'Setting {oe} to index {sortedIndex}') - self.indexSorted = int(sortedIndex) - self.index[oe] = self.sorted_invF_index[oe][self.indexSorted] - if oe == '1' and self.sysType == SYSTEM_TYPE.doubleCRL: - self.index['2'] = self.index1to2_sorted[self.indexSorted] - + self.indexSorted[oe] = int(sortedIndex) + if oe == '1': + self.index['1'] = self.sorted_invF_index['1'][self.indexSorted['1']] + if self.sysType == SYSTEM_TYPE.doubleCRL: + self.indexSorted['2'] = self.index1to2_sorted[self.indexSorted['1']] + self.index['2'] = self.sorted_invF_index['2'][self.indexSorted['2']] + elif oe == '2': + self.index['2'] = self.sorted_invF_index['2'][self.indexSorted['2']] + # Update PVs if oe == '2': self.setFocalSizeActual(offTable = True) @@ -614,15 +618,15 @@ class focusingSystem(): # XS approach -- can handle nan but in pydev application don't have a good # way to "transmit" errors (i.e. no solution found) to user. indices, _ = find_levels(self.lookupTable, self.focalSize, direction='forward') - self.indexSorted = indices[0] - if self.verbose: print(f'1/f-sorted config index found at {self.indexSorted}') + self.indexSorted['1'] = indices[0] + if self.verbose: print(f"1/f-sorted config index found at {self.indexSorted['1']}") - self.index['1'] = self.sorted_invF_index['1'][self.indexSorted] + self.index['1'] = self.sorted_invF_index['1'][self.indexSorted['1']] if self.verbose: print(f"CRL 1 config index found at {self.index['1']}") if self.sysType == SYSTEM_TYPE.doubleCRL: - print(self.indexSorted) - self.index['2'] = self.index1to2_sorted[self.indexSorted] + self.indexSorted['2'] = self.index1to2_sorted[self.indexSorted['1']] + self.index['2'] = self.sorted_invF_index['2'][self.indexSorted['2']] if self.verbose: print(f"CRL 2 config index found at {self.index['2']}") @@ -647,7 +651,7 @@ class focusingSystem(): ''' if self.verbose: print(f'Setting actual focal size') if not offTable: - self.focalSize_actual = self.lookupTable[self.indexSorted] + self.focalSize_actual = self.lookupTable[self.indexSorted['1']] else: self.focalSize_actual = calc_2xCRL_focus(self.index['1'], self.index['2'], self.radii['1'], self.mat['1'], @@ -669,11 +673,11 @@ class focusingSystem(): Updates optical element config PVs for which stacks need to be in/out ''' if self.verbose: print(f'Setting lens configuration PV for CRL 1') - self.config['1'] = self.configs['1'][self.index['1']] + self.config['1'] = self.index['1'] pydev.iointr('new_lenses_1', int(self.config['1'])) if self.sysType == SYSTEM_TYPE.doubleCRL: if self.verbose: print(f'Setting lens configuration PV for CRL 2') - self.config['2'] = self.configs['2'][self.index['2']] + self.config['2'] = self.index['2'] pydev.iointr('new_lenses_2', int(self.config['2'])) @@ -682,11 +686,11 @@ class focusingSystem(): Description; Updates optical elements config index PVs ''' - if self.verbose: print(f'Setting lens configuration RBV for CRL 1: {self.indexSorted}') - pydev.iointr('new_index_1', int(self.indexSorted)) + if self.verbose: print(f"Setting lens configuration index RBV for CRL 1: {self.indexSorted['1']}") + pydev.iointr('new_index_1', int(self.indexSorted['1'])) if self.sysType == SYSTEM_TYPE.doubleCRL: - if self.verbose: print(f'Setting lens configuration RBV for CRL 2: {self.indexSorted}') - pydev.iointr('new_index_2', int(self.indexSorted)) + if self.verbose: print(f"Setting lens configuration index RBV for CRL 2: {self.indexSorted['2']}") + pydev.iointr('new_index_2', int(self.indexSorted['2'])) def updateFocalSizeRBVs(self): ''' diff --git a/IOC_vs_XS_double.ipynb b/IOC_vs_XS_double.ipynb index fafca05..d1a83b4 100644 --- a/IOC_vs_XS_double.ipynb +++ b/IOC_vs_XS_double.ipynb @@ -508,7 +508,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 43, "id": "07e34dff-84dd-48d7-bc91-6ed16507ccf5", "metadata": {}, "outputs": [], @@ -593,16 +593,16 @@ " FWHM2H_atsample = (FWHM2H**2 + (aperL2H*dq2/q2)**2)**0.5\n", " FWHM2V_atsample = (FWHM2V**2 + (aperL2V*dq2/q2)**2)**0.5\n", "\n", - " print(\"====================================================================\")\n", - " print(f\"Energy: {energy_keV} keV\")\n", - " print(f\"CRL1 configuration index is {index1} or {index_to_binary_list(index1, L1_Feq.size)}\")\n", - " print(f\"CRL1 f is {1/L1_invF:.2f} m, focus at q1 = {q1:.2f} m ({q1-(d_Stof-d_StoL1):.2f} m from sample)\")\n", - " print(f\"CRL2 configuration index is {index2} or {index_to_binary_list(index2, L2_Feq.size)}\")\n", - " print(f\"CRL2 f is {1/L2_invF:.2f} m\")\n", - " print(f\"Focal size is {FWHM2H*1.0e6:.2f} μm x {FWHM2V*1.0e6:.2f} μm at the focal point ({dq2*1e3:.1f} mm from sample)\")\n", - " print(f\"Beam size is {FWHM2H_atsample*1.0e6:.2f} μm x {FWHM2V_atsample*1.0e6:.2f} μm at sample position\")\n", - "\n", - " return\n" + " # print(\"====================================================================\")\n", + " # print(f\"Energy: {energy_keV} keV\")\n", + " # print(f\"CRL1 configuration index is {index1} or {index_to_binary_list(index1, L1_Feq.size)}\")\n", + " # print(f\"CRL1 f is {1/L1_invF:.2f} m, focus at q1 = {q1:.2f} m ({q1-(d_Stof-d_StoL1):.2f} m from sample)\")\n", + " # print(f\"CRL2 configuration index is {index2} or {index_to_binary_list(index2, L2_Feq.size)}\")\n", + " # print(f\"CRL2 f is {1/L2_invF:.2f} m\")\n", + " # print(f\"Focal size is {FWHM2H*1.0e6:.2f} μm x {FWHM2V*1.0e6:.2f} μm at the focal point ({dq2*1e3:.1f} mm from sample)\")\n", + " # print(f\"Beam size is {FWHM2H_atsample*1.0e6:.2f} μm x {FWHM2V_atsample*1.0e6:.2f} μm at sample position\")\n", + "\n", + " return (FWHM2H_atsample*FWHM2V_atsample)**0.5\n" ] }, { @@ -1258,14 +1258,399 @@ "id": "eb475749-4777-44d0-bda8-7430a2f0918e", "metadata": {}, "source": [ - "# Off table lookup calculation comparison" + "# IOC to XS calc comparison\n", + "Testing that indexing is consistent" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 47, "id": "518d09f8-dbb5-4a0c-b6ae-f2dc1b8688de", "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "IOC actual fSize 1.549050969632956e-06\n", + "CRL configs: 386 and 450\n", + "XS code fSize: 2.973983449945341e-06\n" + ] + } + ], + "source": [ + "energy = 16000.0 # Energy in eV\n", + "energy_keV = energy/1000.0 # Energy in keV\n", + "wl = 1239.84 / (energy * 10**9)\n", + "sigmaH = (sigmaH_e**2 + wl*L_und/2/np.pi/np.pi)**0.5\n", + "sigmaV = (sigmaV_e**2 + wl*L_und/2/np.pi/np.pi)**0.5\n", + "sigmaHp = (sigmaHp_e**2 + wl/L_und/2)**0.5\n", + "sigmaVp = (sigmaVp_e**2 + wl/L_und/2)**0.5\n", + "\n", + "flag_HE = True\n", + "slit1_H = 500.0e-6 # H slit size before CRL 1\n", + "slit1_V = 300.0e-6 # V slit size before CRL 1\n", + "slit2_H = 500.0e-6 # H slit size before CRL 2\n", + "slit2_V = 300.0e-6 # V slit size before CRL 2\n", + "\n", + "epics.caput(\"100idPyCRL:testSSH1.VAL\", slit1_H)\n", + "epics.caput(\"100idPyCRL:testSSV1.VAL\", slit1_V)\n", + "epics.caput(\"100idPyCRL:testSSH2.VAL\", slit2_H)\n", + "epics.caput(\"100idPyCRL:testSSV2.VAL\", slit2_V)\n", + "epics.caput(\"100idPyCRL:CRL:thickerr_flag\", flag_HE)\n", + "epics.caput(\"100idPyCRL:CRL:EnergySelect\",0)\n", + "epics.caput(\"100idPyCRL:testMonoE.VAL\",float(energy_keV))\n", + "\n", + "lookup_table, L1_inF_list_sort_indices, index1to2 = Zoom_CRL2D_lookup()\n", + "\n", + "time.sleep(0.5)\n", + "epics.caput(\"100idPyCRL:CRL:focalSize\",'0.0000015')\n", + "time.sleep(0.5)\n", + "print(f'IOC actual fSize {epics.caget(\"100idPyCRL:CRL:fSize_actual\")}')\n", + "crl1 = epics.caget(\"100idPyCRL:CRL:1:lenses\")\n", + "crl2 = epics.caget(\"100idPyCRL:CRL:2:lenses\")\n", + "print(f'CRL configs: {crl1} and {crl2}')\n", + "print(f'XS code fSize: {Zoom_CRL2D_focuscal(crl1, crl2)}')" + ] + }, + { + "cell_type": "markdown", + "id": "58d9d25b-13a6-4b0f-a712-14142befcb7f", + "metadata": {}, + "source": [ + "Looks like things aren't lining up..." + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "id": "9fa7faed-ccf0-4c94-9e94-61eb4927ab0e", + "metadata": {}, + "outputs": [], + "source": [ + "# Beamline input block\n", + "energy = 16000.0 # Energy in eV\n", + "energy_keV = energy/1000.0 # Energy in keV\n", + "wl = 1239.84 / (energy * 10**9)\n", + "sigmaH = (sigmaH_e**2 + wl*L_und/2/np.pi/np.pi)**0.5\n", + "sigmaV = (sigmaV_e**2 + wl*L_und/2/np.pi/np.pi)**0.5\n", + "sigmaHp = (sigmaHp_e**2 + wl/L_und/2)**0.5\n", + "sigmaVp = (sigmaVp_e**2 + wl/L_und/2)**0.5\n", + "\n", + "flag_HE = True\n", + "slit1_H = 500.0e-6 # H slit size before CRL 1\n", + "slit1_V = 300.0e-6 # V slit size before CRL 1\n", + "slit2_H = 500.0e-6 # H slit size before CRL 2\n", + "slit2_V = 300.0e-6 # V slit size before CRL 2\n", + "\n", + "lookup_table, L1_inF_list_sort_indices, index1to2 = Zoom_CRL2D_lookup()" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "id": "c7e81db4-7d0e-49c8-8e6f-d8c83b5a27b9", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.549050969632956e-06\n", + "386\n", + "450\n" + ] + } + ], + "source": [ + "ind = 385\n", + "print(f'{lookup_table[ind]}')\n", + "print(f'{L1_inF_list_sort_indices[ind]}')\n", + "print(f'{index1to2[ind]}')" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "id": "c92ce294-f916-4c95-8a0f-13aa6048fe9b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "38" + ] + }, + "execution_count": 58, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "np.nanargmin(np.abs(np.asarray(lookup_table)-Zoom_CRL2D_focuscal(L1_inF_list_sort_indices[ind], index1to2[ind])))" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "id": "303d93de-18a1-4f1a-87e0-08a6a1316ce7", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "38" + ] + }, + "execution_count": 56, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "np.nanargmin(np.abs(np.asarray(lookup_table)-Zoom_CRL2D_focuscal(386,450)))" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "id": "bfdf5fd8-af3c-4edb-b22c-c5caf571082d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2.973753657172478e-06" + ] + }, + "execution_count": 57, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "lookup_table[38]" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "id": "c5895d0f-473f-4f17-bf48-a21b7058f785", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "======== Find size at focus ========================================\n", + "Energy: 16.0 keV\n", + "CRL1 configuration index in sorted list is 377\n", + "CRL1 configuration index is 377 or [1, 0, 0, 1, 1, 1, 1, 0, 1, 0]\n", + "CRL1 f is 3.08 m, focus at q1 = 3.27 m (-11.03 m from sample)\n", + "CRL2 configuration index in sorted list is 452\n", + "CRL2 configuration index is 452 or [0, 0, 1, 0, 0, 0, 1, 1, 1, 0]\n", + "CRL2 f is 2.58 m\n", + "Focal size is 1.76 μm x 1.29 μm at the focal point (7.9 mm from sample)\n", + "======== Find size at sample =======================================\n", + "CRL1 configuration index in sorted list is 385\n", + "CRL1 configuration index is 386 or [0, 1, 0, 0, 0, 0, 0, 1, 1, 0]\n", + "CRL1 f is 3.01 m, focus at q1 = 3.20 m (-11.10 m from sample)\n", + "CRL2 configuration index in sorted list is 450\n", + "CRL2 configuration index is 451 or [1, 1, 0, 0, 0, 0, 1, 1, 1, 0]\n", + "CRL2 f is 2.59 m\n", + "Beam size is 1.81 μm x 1.32 μm at the sample position)\n" + ] + } + ], + "source": [ + "Zoom_CRL2D_control(0.0000015)" + ] + }, + { + "cell_type": "markdown", + "id": "80692d2c-f449-4248-87c3-82d2948df21b", + "metadata": {}, + "source": [ + "Matching \"control\" but not focuscal?" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "id": "8fe407df-ebab-448c-bd02-f046cae679f5", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1.549050969632956e-06" + ] + }, + "execution_count": 60, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Zoom_CRL2D_focuscal(386, 451)" + ] + }, + { + "cell_type": "markdown", + "id": "21e15f8d-e8f0-4a4e-99fe-07cf766af5a5", + "metadata": {}, + "source": [ + "Not quite --> looks like IOC is reporting 10-bit config for CRL1 but sorted index for CRL2 --> correct needed to index sorted_invF_index['2'] with index1to2_sorted[indexSorted] to get lens configuration" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "id": "a4193f6d-6312-4388-94b5-f7b35539c61a", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "IOC actual fSize 8.016234618405476e-06\n", + "CRL configs: 178 and 698\n", + "XS code fSize: 8.016234618405506e-06\n" + ] + } + ], + "source": [ + "energy = 16000.0 # Energy in eV\n", + "energy_keV = energy/1000.0 # Energy in keV\n", + "wl = 1239.84 / (energy * 10**9)\n", + "sigmaH = (sigmaH_e**2 + wl*L_und/2/np.pi/np.pi)**0.5\n", + "sigmaV = (sigmaV_e**2 + wl*L_und/2/np.pi/np.pi)**0.5\n", + "sigmaHp = (sigmaHp_e**2 + wl/L_und/2)**0.5\n", + "sigmaVp = (sigmaVp_e**2 + wl/L_und/2)**0.5\n", + "\n", + "flag_HE = True\n", + "slit1_H = 500.0e-6 # H slit size before CRL 1\n", + "slit1_V = 300.0e-6 # V slit size before CRL 1\n", + "slit2_H = 500.0e-6 # H slit size before CRL 2\n", + "slit2_V = 300.0e-6 # V slit size before CRL 2\n", + "\n", + "epics.caput(\"100idPyCRL:testSSH1.VAL\", slit1_H)\n", + "epics.caput(\"100idPyCRL:testSSV1.VAL\", slit1_V)\n", + "epics.caput(\"100idPyCRL:testSSH2.VAL\", slit2_H)\n", + "epics.caput(\"100idPyCRL:testSSV2.VAL\", slit2_V)\n", + "epics.caput(\"100idPyCRL:CRL:thickerr_flag\", flag_HE)\n", + "epics.caput(\"100idPyCRL:CRL:EnergySelect\",0)\n", + "epics.caput(\"100idPyCRL:testMonoE.VAL\",float(energy_keV))\n", + "\n", + "lookup_table, L1_inF_list_sort_indices, index1to2 = Zoom_CRL2D_lookup()\n", + "\n", + "time.sleep(0.5)\n", + "epics.caput(\"100idPyCRL:CRL:focalSize\",'0.000008')\n", + "time.sleep(0.5)\n", + "print(f'IOC actual fSize {epics.caget(\"100idPyCRL:CRL:fSize_actual\")}')\n", + "crl1 = epics.caget(\"100idPyCRL:CRL:1:lenses\")\n", + "crl2 = epics.caget(\"100idPyCRL:CRL:2:lenses\")\n", + "print(f'CRL configs: {crl1} and {crl2}')\n", + "print(f'XS code fSize: {Zoom_CRL2D_focuscal(crl1, crl2)}')" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "id": "eeb78b22-0a25-47e3-a046-2f4c53a7c1ec", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "======== Find size at focus ========================================\n", + "Energy: 16.0 keV\n", + "CRL1 configuration index in sorted list is 175\n", + "CRL1 configuration index is 173 or [1, 0, 1, 1, 0, 1, 0, 1, 0, 0]\n", + "CRL1 f is 6.66 m, focus at q1 = 7.65 m (-6.65 m from sample)\n", + "CRL2 configuration index in sorted list is 704\n", + "CRL2 configuration index is 706 or [0, 1, 0, 0, 0, 0, 1, 1, 0, 1]\n", + "CRL2 f is 1.57 m\n", + "Focal size is 10.80 μm x 6.02 μm at the focal point (10.6 mm from sample)\n", + "======== Find size at sample =======================================\n", + "CRL1 configuration index in sorted list is 176\n", + "CRL1 configuration index is 178 or [0, 1, 0, 0, 1, 1, 0, 1, 0, 0]\n", + "CRL1 f is 6.65 m, focus at q1 = 7.62 m (-6.68 m from sample)\n", + "CRL2 configuration index in sorted list is 698\n", + "CRL2 configuration index is 698 or [0, 1, 0, 1, 1, 1, 0, 1, 0, 1]\n", + "CRL2 f is 1.59 m\n", + "Beam size is 10.72 μm x 5.99 μm at the sample position)\n" + ] + } + ], + "source": [ + "Zoom_CRL2D_control(0.000008)" + ] + }, + { + "cell_type": "markdown", + "id": "d5d40ba4-b755-4360-aa79-2c581fe3233b", + "metadata": {}, + "source": [ + "much better...\n", + "\n", + "# What next?\n", + "\n", + "Check that off-lookup-table moves match up" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "id": "acd0ca79-ad6f-4664-8584-56de1a59d5e6", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "For configs: 178 and 704, IOC yeilds 7.839122984830116e-06 focal size\n", + "XS code fSize: 7.839122984830116e-06\n" + ] + } + ], + "source": [ + "crl1 = epics.caget(\"100idPyCRL:CRL:1:lenses\")\n", + "crl2 = epics.caget(\"100idPyCRL:CRL:2:lenses\")\n", + "fSize = epics.caget(\"100idPyCRL:CRL:fSize_actual\")\n", + "print(f'For configs: {crl1} and {crl2}, IOC yeilds {fSize} focal size')\n", + "print(f'XS code fSize: {Zoom_CRL2D_focuscal(crl1, crl2)}')" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "id": "d618af46-42f9-44fc-8b7f-5ed541f662fa", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "For configs: 222 and 518, IOC yeilds 8.177871564000929e-06 focal size\n", + "XS code fSize: 8.177871564000929e-06\n" + ] + } + ], + "source": [ + "crl1 = epics.caget(\"100idPyCRL:CRL:1:lenses\")\n", + "crl2 = epics.caget(\"100idPyCRL:CRL:2:lenses\")\n", + "fSize = epics.caget(\"100idPyCRL:CRL:fSize_actual\")\n", + "print(f'For configs: {crl1} and {crl2}, IOC yeilds {fSize} focal size')\n", + "print(f'XS code fSize: {Zoom_CRL2D_focuscal(crl1, crl2)}')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "db3e48f8-4dc6-4e9e-a8d7-1a2ac8a4592a", + "metadata": {}, "outputs": [], "source": [] } -- GitLab