Skip to content

Commit

Permalink
Merge pull request #14 from fgjorup/JOSS-submission
Browse files Browse the repository at this point in the history
Joss submission
  • Loading branch information
fgjorup authored Oct 15, 2021
2 parents c96b541 + ada9736 commit dc0347a
Show file tree
Hide file tree
Showing 1,515 changed files with 1,812,409 additions and 24 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/draft-pdf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on: [push]

jobs:
paper:
runs-on: ubuntu-latest
name: Paper Draft
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build draft PDF
uses: openjournals/openjournals-draft-action@master
with:
journal: joss
# This should be the path to the paper within your repo.
paper-path: paper.md
- name: Upload
uses: actions/upload-artifact@v1
with:
name: paper
# This is the output path where Pandoc will write the compiled
# PDF. Note, this should be the same directory as the input
# paper.md
path: paper.pdf
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
Tool for visualizing Rietveld refinement results
By Frederik Gjørup

The software provided here is intended only for internal use at Department of Chemistry, Aarhus University, and should not be distributed outside of the institute without the consent of the author.

### Running the program ###
Please run the setup.bat the first time you use the program. After that, run it by running the "run_Reel.bat" file or double-clicking the corresponding short-cut.
If the program does not open, check that the path to python.exe in "run_Reel.bat" line 5 is valid.
Expand All @@ -26,12 +24,17 @@ Open a terminal in the program folder and run "Refinement_evaluator_ver1.0.py" i
### Requirements ###
Python 3.8.3 (Other versions of python 3 and modules might still work)
Non-built-in python modules:
Module | Version | pip install command
------ | ------- | -------------------
PyQt5 | v. 5.14.2 | pip install PyQt5
pyqtgraph | v. 0.11.1 | pip install pyqtgraph
matplotlib | v. 3.3.3 | pip install matplotlib
numpy | v. 1.19.5 | pip install numpy
scipy | v. 1.6.0 | pip install scipy
| Module | Version | pip install command |
| ------ | ------- | ------------------- |
| PyQt5 | v. 5.14.2 | pip install PyQt5 |
| pyqtgraph | v. 0.11.1 | pip install pyqtgraph |
| matplotlib | v. 3.3.3 | pip install matplotlib |
| numpy | v. 1.19.5 | pip install numpy |
| scipy | v. 1.6.0 | pip install scipy |

\+ Requirements imposed by the modules. See `pip show [module]` for more information.

### Contributing, feedback, and support ###
You can open a series of test files intended for debugging by running `Refinement_evaluator_ver1.0.py -debug`.

All users are welcome to provide feedback, report issues, or suggest changes to the program, either by creating a new issue on the GitHub [repository](https://github.com/fgjorup/Reel) or by contacting me at <fgjorup@chem.au.dk>.
Binary file added Reel1.0/Reel1.0 Quick Guide.docx
Binary file not shown.
Binary file modified Reel1.0/Reel1.0 Quick Guide.pdf
Binary file not shown.
29 changes: 21 additions & 8 deletions Reel1.0/Refinement_evaluator_ver1.0.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
Last update: 22/06/2021
Last update: 27/08/2021
Frederik H. Gjørup
"""

Expand Down Expand Up @@ -106,7 +106,19 @@ def __init__(self):
self.scale_surf = us.default_surface_scale
self.scale_pat = us.default_pattern_scale
self.initScale()


if '-debug' in sys.argv:
self.openTestfiles()

def openTestfiles(self):
path = os.path.abspath('_test_files')
test_sets = os.listdir(path)
for tset in test_sets:
ts_path = os.path.join(path,tset)
files = [os.path.join(ts_path,f) for f in os.listdir(ts_path) if f.endswith(tset)]
ext = '*.'+files[0].split('.')[-1]
self.addDataset(self,files=files,ext=ext)

def keyPressEvent(self,event):
if event.modifiers() == Qt.ControlModifier:
if event.key() == Qt.Key_Left:
Expand Down Expand Up @@ -199,7 +211,7 @@ def changeDataset(self,index):
self.parw.updateVline(im.shape[2]-h_pos+0.5)
self.showCurrentWavelength()

def addDataset(self,is_par=False):
def addDataset(self,is_par=False,files=None,ext=None):
self.im.append(np.zeros((3,100,100)))
self.tth.append(np.arange(0,100,1))
self.files.append([''])
Expand All @@ -211,7 +223,7 @@ def addDataset(self,is_par=False):
self.datasets.append('')
self.dataset_index = len(self.im)-1
if is_par != True:
self.openFiles()
self.openFiles(files,ext)

def removeDataset(self):
if len(self.im)==1:
Expand Down Expand Up @@ -249,7 +261,8 @@ def removeAllDatasets(self):

def plotLogo(self):
self.scale_surf, self.scale_pat = ['linear']*2
self.openFiles(files=['_lib\icons\Main.raw'],ext='*.raw')
fname = os.path.abspath('_lib/icons/Main.raw')
self.openFiles(files=[fname],ext='*.raw')
# im = self.im[0][0]
# x = np.arange(0,im.shape[0],1)
# y = np.flip(np.nanmean(im,axis=0))
Expand Down Expand Up @@ -737,10 +750,10 @@ def openFiles(self,files=None,ext=None):
if not isinstance(files,list):
path = self.path
if not path:
path = os.environ['USERPROFILE']
path = os.getenv('USERPROFILE','')
if ext != '*.csv':
ext = us.default_file_extension
filters = '*.xyy;;*.prf;;*.par;;*.dat;;*.xye *.xy;;*.csv'
filters = '*.xyy;;*.prf;;*.dat;;*.xye *.xy;;*.csv'
filters = ext+';;'+';;'.join([x for x in filters.replace(ext,'').split(';;') if x])
files, ext = QtWidgets.QFileDialog.getOpenFileNames(self, 'Select files', path , filters)
if len(files)<1:
Expand All @@ -759,7 +772,7 @@ def openFiles(self,files=None,ext=None):
im, tth, files, lambd, param, sub_plots, bgr, par_file, was_canceled = self.openPRF(files)
elif ext=='*.dat':
im, tth, files, lambd, param, sub_plots, bgr, par_file, was_canceled = self.openDAT(files)
elif ext=='*.xye *.xy':
elif ext=='*.xye *.xy' or ext=='*.xye' or ext=='*.xy':
im, tth, files, lambd, param, sub_plots, bgr, par_file, was_canceled = self.openXYE(files)
elif ext=='*.csv':
im, tth, files, lambd, param, sub_plots, bgr, par_file, was_canceled = self.openCSV(files[0])
Expand Down
2 changes: 1 addition & 1 deletion Reel1.0/Setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ECHO CD %~dp0 >> Run_Reel.bat
ECHO ECHO Opening Reel 1.0... >> Run_Reel.bat
FOR %%i IN (python.exe) DO (
IF EXIST "%%~$PATH:i" (
ECHO %%~$PATH:i Refinement_evaluator_ver1.0.py >> Run_Reel.bat
ECHO "%%~$PATH:i" Refinement_evaluator_ver1.0.py >> Run_Reel.bat
) ELSE (
ECHO python.exe Refinement_evaluator_ver1.0.py >> Run_Reel.bat
ECHO ATTENTION!
Expand Down
13 changes: 7 additions & 6 deletions Reel1.0/_lib/ReelPlotWidgets.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
"""
Last update: 07/06/2021
Last update: 27/08/2021
Frederik H. Gjørup
"""
import os
try:
from PyQt5 import QtCore
import pyqtgraph as pg
Expand All @@ -28,8 +29,8 @@ def convertColormapMPtoPG(cmap):

class MultiImageWidget(pg.GraphicsLayoutWidget):

sigHLineDragged = QtCore.Signal(object)
sigVLineDragged = QtCore.Signal(object)
sigHLineDragged = QtCore.pyqtSignal(object)
sigVLineDragged = QtCore.pyqtSignal(object)

def __init__(self,n_images=1,labels=()):
pg.GraphicsLayoutWidget.__init__(self)
Expand Down Expand Up @@ -65,8 +66,8 @@ def __init__(self,n_images=1,labels=()):
minXRange=10,
yMin=-5,
minYRange=10)

im = np.fromfile('_lib\icons\Main.raw', dtype='ubyte').reshape(230,230).astype(float)
fname = os.path.abspath('_lib/icons/Main.raw')
im = np.fromfile(fname, dtype='ubyte').reshape(230,230).astype(float)
im = np.abs(im-im.max())
data = np.flipud(np.rot90(im))
if i<2:
Expand Down Expand Up @@ -330,7 +331,7 @@ def setResData(self,x,y):

class PlotParametersWidget(pg.PlotWidget):

sigVLineDragged = QtCore.Signal(object)
sigVLineDragged = QtCore.pyqtSignal(object)

def __init__(self):
pg.PlotWidget.__init__(self)
Expand Down
Loading

0 comments on commit dc0347a

Please sign in to comment.