xrdPlanner 2.2.0__tar.gz → 2.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xrdPlanner
3
- Version: 2.2.0
3
+ Version: 2.2.1
4
4
  Summary: A tool to project X-ray diffraction cones on a detector screen at different geometries (tilt, rotation, offset) and X-ray energies
5
5
  Author-email: Lennard Krause <lkrause@chem.au.dk>
6
6
  Project-URL: Homepage, https://github.com/LennardKrause/xrdPlanner
@@ -1,6 +1,6 @@
1
- __version__ = '2.2.0'
1
+ __version__ = '2.2.1'
2
2
  __author__ = 'Lennard Krause'
3
3
  __authors__ = ['Lennard Krause', 'Frederik H. Gjørup', 'Mads R. V. Jørgensen']
4
4
  __email__ = 'lkrause@chem.au.dk'
5
- __date__ = '08.11.2024'
5
+ __date__ = '05.12.2024'
6
6
  __year__ = '2024'
@@ -163,6 +163,7 @@ class MainWindow(QtWidgets.QMainWindow):
163
163
 
164
164
  # disable/reset delta_d/d toggles
165
165
  self.action_funct_fwhm_show.setEnabled(False)
166
+ self.action_funct_fwhm_export.setEnabled(False)
166
167
 
167
168
  # add the slider frame
168
169
  # this calls draw_conics(),
@@ -1004,7 +1005,11 @@ class MainWindow(QtWidgets.QMainWindow):
1004
1005
  else:
1005
1006
  self.action_funct_fwhm_show.setChecked(False)
1006
1007
  menu_functions.addAction(self.action_funct_fwhm_show)
1007
-
1008
+ #export fwhm toggle
1009
+ self.action_funct_fwhm_export = QtGui.QAction('Export FWHM', self)
1010
+ self.menu_set_action(self.action_funct_fwhm_export, self.export_fwhm_grid)
1011
+ menu_functions.addAction(self.action_funct_fwhm_export)
1012
+
1008
1013
  # PXRD pattern
1009
1014
  self.action_pxrd_pattern = QtGui.QAction('P&XRD pattern', self)
1010
1015
  self.menu_set_action(self.action_pxrd_pattern, self.win_pxrd_plot)
@@ -3350,10 +3355,23 @@ class MainWindow(QtWidgets.QMainWindow):
3350
3355
  self.plo.scattering_diameter = round(udict[4][0].value() * udict[4][1], 6)
3351
3356
  #self.plo.funct_fwhm_thresh = round(udict[5][0].value() * udict[5][1], 6)
3352
3357
  self.action_funct_fwhm_show.setEnabled(True)
3358
+ self.action_funct_fwhm_export.setEnabled(True)
3353
3359
  self.plo.show_fwhm = False
3354
3360
  self.toggle_fwhm()
3355
3361
  win.close()
3356
3362
 
3363
+ def export_fwhm_grid(self):
3364
+ # calculate the FWHM grid
3365
+ # res = None -> use the current detector pixel dimensions
3366
+ _fwhm_grid = self.calc_overlays(omega=0, res=None, pol=self.plo.polarisation_fac)[-1]
3367
+ # find target file
3368
+ default_path = os.path.join(os.path.expanduser('~'), f'{self.det.name.replace(' ', '_')}_FWHM')
3369
+ target, filter = QtWidgets.QFileDialog.getSaveFileName(self, 'Export FWHM grid', default_path, "Compressed numpy array (*.npz)")
3370
+ if not target:
3371
+ return
3372
+ # save compressed array to target
3373
+ np.savez_compressed(target, fwhm=np.flipud(_fwhm_grid))
3374
+
3357
3375
  ##########
3358
3376
  # PXRD #
3359
3377
  ##########
@@ -5167,8 +5185,13 @@ class MainWindow(QtWidgets.QMainWindow):
5167
5185
  The full width at half maximum (FWHM) for the detector.
5168
5186
  """
5169
5187
  # scale overlay to detector dimensions
5170
- _res_scale = self.ydim/self.xdim
5171
- _res_v = int(round(_res_scale * res, 0))
5188
+ if res is not None and res > 0:
5189
+ _res_scale = self.ydim/self.xdim
5190
+ _res_v = int(round(_res_scale * res, 0))
5191
+ else:
5192
+ res = (self.det.hmp * self.det.hmn + self.det.hgp * (self.det.hmn-1) + self.det.cbh)
5193
+ _res_v = (self.det.vmp * self.det.vmn + self.det.vgp * (self.det.vmn-1) + self.det.cbh)
5194
+
5172
5195
  # neutral overlay grid
5173
5196
  grd = np.ones((_res_v, res))
5174
5197
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xrdPlanner
3
- Version: 2.2.0
3
+ Version: 2.2.1
4
4
  Summary: A tool to project X-ray diffraction cones on a detector screen at different geometries (tilt, rotation, offset) and X-ray energies
5
5
  Author-email: Lennard Krause <lkrause@chem.au.dk>
6
6
  Project-URL: Homepage, https://github.com/LennardKrause/xrdPlanner
File without changes
File without changes
File without changes
File without changes