Skip to content

Commit 93c3ac7

Browse files
authored
Merge pull request #1055 from psavery/unpolarized-lorentz-polarization
Add unpolarized option to Lorentz polarization
2 parents 04b02af + f645337 commit 93c3ac7

File tree

4 files changed

+90
-15
lines changed

4 files changed

+90
-15
lines changed

hexrd/ui/hexrd_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ def intensity_corrected_images_dict(self):
555555
if HexrdConfig().apply_lorentz_polarization_correction:
556556
options = self.config['image']['lorentz_polarization']
557557
kwargs = {
558+
'unpolarized': options['unpolarized'],
558559
'f_hor': options['f_hor'],
559560
'f_vert': options['f_vert'],
560561
}

hexrd/ui/lorentz_polarization_options_dialog.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ def exec_(self):
2424
def accept(self):
2525
# When the dialog is accepted, save the settings in HexrdConfig.
2626
options = HexrdConfig().config['image']['lorentz_polarization']
27+
options['unpolarized'] = self.ui.unpolarized.isChecked()
2728
options['f_hor'] = self.ui.horizontal.value()
2829
options['f_vert'] = self.ui.vertical.value()
2930

3031
def update_gui(self):
3132
options = HexrdConfig().config['image']['lorentz_polarization']
33+
self.ui.unpolarized.setChecked(options['unpolarized'])
3234
self.ui.horizontal.setValue(options['f_hor'])
3335
self.ui.vertical.setValue(options['f_vert'])
3436

hexrd/ui/resources/calibration/default_image_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ show_detector_borders: true
2121
apply_pixel_solid_angle_correction: false
2222
apply_lorentz_polarization_correction: false
2323
lorentz_polarization:
24+
unpolarized: false
2425
f_hor: 1.0
2526
f_vert: 0.0
2627
intensity_subtract_minimum: false

hexrd/ui/resources/ui/lorentz_polarization_options_dialog.ui

Lines changed: 86 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>302</width>
10-
<height>107</height>
9+
<width>318</width>
10+
<height>158</height>
1111
</rect>
1212
</property>
1313
<property name="minimumSize">
@@ -23,21 +23,21 @@
2323
<string notr="true"/>
2424
</property>
2525
<layout class="QGridLayout" name="gridLayout">
26-
<item row="0" column="0">
27-
<widget class="QLabel" name="horizontal_label">
26+
<item row="2" column="0">
27+
<widget class="QLabel" name="vertical_label">
2828
<property name="text">
29-
<string>Horizontal Fraction:</string>
29+
<string>Vertical Fraction:</string>
3030
</property>
3131
</widget>
3232
</item>
33-
<item row="1" column="0">
34-
<widget class="QLabel" name="vertical_label">
35-
<property name="text">
36-
<string>Vertical Fraction:</string>
33+
<item row="3" column="0" colspan="2">
34+
<widget class="QDialogButtonBox" name="button_box">
35+
<property name="standardButtons">
36+
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
3737
</property>
3838
</widget>
3939
</item>
40-
<item row="0" column="1">
40+
<item row="1" column="1">
4141
<widget class="ScientificDoubleSpinBox" name="horizontal">
4242
<property name="keyboardTracking">
4343
<bool>false</bool>
@@ -53,7 +53,7 @@
5353
</property>
5454
</widget>
5555
</item>
56-
<item row="1" column="1">
56+
<item row="2" column="1">
5757
<widget class="ScientificDoubleSpinBox" name="vertical">
5858
<property name="keyboardTracking">
5959
<bool>false</bool>
@@ -66,10 +66,17 @@
6666
</property>
6767
</widget>
6868
</item>
69-
<item row="2" column="0" colspan="2">
70-
<widget class="QDialogButtonBox" name="button_box">
71-
<property name="standardButtons">
72-
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
69+
<item row="1" column="0">
70+
<widget class="QLabel" name="horizontal_label">
71+
<property name="text">
72+
<string>Horizontal Fraction:</string>
73+
</property>
74+
</widget>
75+
</item>
76+
<item row="0" column="0">
77+
<widget class="QCheckBox" name="unpolarized">
78+
<property name="text">
79+
<string>Unpolarized</string>
7380
</property>
7481
</widget>
7582
</item>
@@ -120,5 +127,69 @@
120127
</hint>
121128
</hints>
122129
</connection>
130+
<connection>
131+
<sender>unpolarized</sender>
132+
<signal>toggled(bool)</signal>
133+
<receiver>horizontal_label</receiver>
134+
<slot>setDisabled(bool)</slot>
135+
<hints>
136+
<hint type="sourcelabel">
137+
<x>91</x>
138+
<y>24</y>
139+
</hint>
140+
<hint type="destinationlabel">
141+
<x>91</x>
142+
<y>59</y>
143+
</hint>
144+
</hints>
145+
</connection>
146+
<connection>
147+
<sender>unpolarized</sender>
148+
<signal>toggled(bool)</signal>
149+
<receiver>horizontal</receiver>
150+
<slot>setDisabled(bool)</slot>
151+
<hints>
152+
<hint type="sourcelabel">
153+
<x>91</x>
154+
<y>24</y>
155+
</hint>
156+
<hint type="destinationlabel">
157+
<x>242</x>
158+
<y>59</y>
159+
</hint>
160+
</hints>
161+
</connection>
162+
<connection>
163+
<sender>unpolarized</sender>
164+
<signal>toggled(bool)</signal>
165+
<receiver>vertical_label</receiver>
166+
<slot>setDisabled(bool)</slot>
167+
<hints>
168+
<hint type="sourcelabel">
169+
<x>91</x>
170+
<y>24</y>
171+
</hint>
172+
<hint type="destinationlabel">
173+
<x>91</x>
174+
<y>96</y>
175+
</hint>
176+
</hints>
177+
</connection>
178+
<connection>
179+
<sender>unpolarized</sender>
180+
<signal>toggled(bool)</signal>
181+
<receiver>vertical</receiver>
182+
<slot>setDisabled(bool)</slot>
183+
<hints>
184+
<hint type="sourcelabel">
185+
<x>91</x>
186+
<y>24</y>
187+
</hint>
188+
<hint type="destinationlabel">
189+
<x>242</x>
190+
<y>96</y>
191+
</hint>
192+
</hints>
193+
</connection>
123194
</connections>
124195
</ui>

0 commit comments

Comments
 (0)