Skip to content

Commit

Permalink
7.7.30e near mature version but without beta test by others.
Browse files Browse the repository at this point in the history
  • Loading branch information
SHDShim committed Mar 2, 2020
1 parent 96eb76d commit f66fc0c
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 7 deletions.
3 changes: 2 additions & 1 deletion peakpo/control/cakeazicontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ def integrate_to_1d(self):
for tth_i, intensity_i in zip(tth, intensity):
if not np.array_equal(tth_i, tth[0]):
QtWidgets.QMessageBox.warning(
self.widget, 'Warning', 'Error occured. No output.')
self.widget, 'Warning',
'Error occured while preparing for azimuthal integration. No output.')
return None
intensity_merged += intensity_i
n_azi = azi_list.__len__()
Expand Down
25 changes: 23 additions & 2 deletions peakpo/control/cakecontroller.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import os
import shutil
from PyQt5 import QtWidgets
import numpy as np
from utils import dialog_savefile, writechi, get_directory, make_filename, \
get_temp_dir
get_temp_dir, extract_filename, extract_extension
from .mplcontroller import MplController
from .cakemakecontroller import CakemakeController

Expand Down Expand Up @@ -113,11 +114,25 @@ def _addremove_cake(self):
self.widget, 'Warning', 'Choose PONI file first.')
self.widget.checkBox_ShowCake.setChecked(False),
return False
# check if model.poni exist
if not os.path.exists(self.model.poni):
QtWidgets.QMessageBox.warning(
self.widget, 'Warning', 'The poni does not exist in the path.')
self.widget.checkBox_ShowCake.setChecked(False),
return False
if not self.model.base_ptn_exist():
QtWidgets.QMessageBox.warning(
self.widget, 'Warning', 'Choose CHI file first.')
self.widget.checkBox_ShowCake.setChecked(False)
return False
# check if model.poni is in temp_dir
temp_dir = get_temp_dir(self.model.get_base_ptn_filename())
poni_filen = extract_filename(self.model.poni) + '.' + \
extract_extension(self.model.poni)
if self.model.poni != os.path.join(temp_dir, poni_filen):
shutil.copy(self.model.poni, os.path.join(temp_dir, poni_filen))
self.model.poni = os.path.join(temp_dir, poni_filen)
self.widget.lineEdit_PONI.setText(self.model.poni)
filen_tif = self.model.make_filename('tif', original=True)
filen_mar3450 = self.model.make_filename('mar3450', original=True)
filen_cbf = self.model.make_filename('cbf', original=True)
Expand Down Expand Up @@ -199,7 +214,13 @@ def get_poni(self):
self.model.chi_path, "PONI files (*.poni)")[0]
filename = str(filen)
if os.path.exists(filename):
self.model.poni = filename
# copy the chose file to temp_dir
temp_dir = get_temp_dir(self.model.get_base_ptn_filename())
shutil.copy(filename, temp_dir)
filen = extract_filename(filename) + '.' + \
extract_extension(filename)
# set filename to that exists in temp_dir
self.model.poni = os.path.join(temp_dir, filen)
self.widget.lineEdit_PONI.setText(self.model.poni)
if self.model.diff_img_exist():
self.produce_cake()
Expand Down
6 changes: 4 additions & 2 deletions peakpo/control/jcpdscontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import matplotlib.cm as cmx
from .mplcontroller import MplController
from .jcpdstablecontroller import JcpdsTableController
from utils import xls_jlist, dialog_savefile
from utils import xls_jlist, dialog_savefile, make_filename, get_temp_dir


class JcpdsController(object):
Expand Down Expand Up @@ -198,7 +198,9 @@ def save_xls(self):
"""
if not self.model.jcpds_exist():
return
filen_xls_t = self.model.make_filename('jlist.xls')
temp_dir = get_temp_dir(self.model.get_base_ptn_filename())
filen_xls_t = make_filename(self.model.get_base_ptn_filename(),
'jlist.xls', temp_dir=temp_dir)
filen_xls = dialog_savefile(self.widget, filen_xls_t)
if str(filen_xls) == '':
return
Expand Down
5 changes: 4 additions & 1 deletion peakpo/control/peakfitcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from PyQt5 import QtWidgets
from .mplcontroller import MplController
from .peakfittablecontroller import PeakfitTableController
from utils import make_filename, get_temp_dir


class PeakFitController(object):
Expand Down Expand Up @@ -359,7 +360,9 @@ def conduct_fitting(self):
'Fitting failed.')

def save_to_xls(self):
filen_xls = self.model.make_filename('peakfit.xls')
temp_dir = get_temp_dir(self.model.get_base_ptn_filename())
filen_xls = make_filename(self.model.get_base_ptn_filename(),
'peakfit.xls', temp_dir=temp_dir)
reply = QtWidgets.QMessageBox.question(
self.widget, 'Question',
'Do you want to save in default filename, %s ?' % filen_xls,
Expand Down
2 changes: 1 addition & 1 deletion peakpo/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
create a new subobject with azimuthal ranges and resulting diffraction
patterns
"""
__version__ = "7.7.30c"
__version__ = "7.7.30e"
"""
7.7.30: Unit-cell fitting added for cubic, tetragonal, hexagonal, and orthorhombic
7.7.29: Update for better handling nosymmetry case of jcpds.
Expand Down

0 comments on commit f66fc0c

Please sign in to comment.