Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version joss rev - integrate cython install and update readme #40

Merged
merged 27 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2a8f802
Added paragraph on optimization to paper
jpcurbelo Sep 1, 2024
9292cd6
Paper: added comments and figs for rev1 comments
jpcurbelo Sep 2, 2024
a60a343
Added comparison to paper
jpcurbelo Sep 2, 2024
abc2f9a
Corrected references in comparison section
jpcurbelo Sep 2, 2024
f51e066
Updated name to paper workflow
jpcurbelo Sep 2, 2024
d385288
Put the cython install into setup.py
jpcurbelo Sep 2, 2024
839f966
Integrated cython install to setup and updated readme
jpcurbelo Sep 2, 2024
32823d7
Updated test workflow file
jpcurbelo Sep 2, 2024
751e58a
Updated test workflow file 2
jpcurbelo Sep 2, 2024
0fb16fb
To test ROOT_PATH on workflow
jpcurbelo Sep 2, 2024
28292be
Update __init__ and wrkflow file
jpcurbelo Sep 2, 2024
d6ae828
Update __init__ and workflow file 2
jpcurbelo Sep 2, 2024
0657e1c
Update wrkflow file
jpcurbelo Sep 2, 2024
0eb16c6
Update test paths - included TESTS_DIR
jpcurbelo Sep 2, 2024
0e08993
Steped back on workflow file to test install dependencies
jpcurbelo Sep 2, 2024
80b4185
Added with path .
jpcurbelo Sep 2, 2024
4dacc58
Added with path: GO-RXR
jpcurbelo Sep 2, 2024
720cce7
Added with path: ..
jpcurbelo Sep 2, 2024
d4336b9
Harcoded removing GO-RXR duplicates in root and uses _PATH
jpcurbelo Sep 2, 2024
6b3e6c2
Update worflow file - all tests explicitely
jpcurbelo Sep 2, 2024
a8abb29
Testing paths on workflow
jpcurbelo Sep 2, 2024
01d275c
Testing os.path.join(parent_dir, 'TESTS')
jpcurbelo Sep 2, 2024
00700bc
Testing os.path.join(parent_dir, 'TESTS') 2
jpcurbelo Sep 2, 2024
5b41feb
Testing os.path.join(parent_dir, 'TESTS') 3
jpcurbelo Sep 2, 2024
d85932f
Added h5 files
jpcurbelo Sep 2, 2024
2b00948
Update tests to be run
jpcurbelo Sep 2, 2024
17f6d48
Fixed '' missing and commented print
jpcurbelo Sep 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions .github/workflows/go-rxr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,11 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.12'
python-version: '3.10.14'

- name: Install dependencies
- name: Install app dependencies
run: |
pip install --upgrade pip setuptools
pip install -r requirements.txt

- name: Install PyQt5 Dependencies
run: |
sudo apt-get install -y pyqt5-dev libqt5multimedia5-plugins

- name: Install Reflectivity Package
run: |
python setup_reflectivity.py install
pip install .

- name: Run tests
run: |
Expand All @@ -47,4 +38,4 @@ jobs:
python -m unittest discover -s TESTS -p "test_density.py"
python -m unittest discover -s TESTS -p "test_material_model.py"
python -m unittest discover -s TESTS -p "test_material_structure.py"
python -m unittest discover -s TESTS -p "test_reflectivity.py"
python -m unittest discover -s TESTS -p "test_reflectivity.py"
12 changes: 9 additions & 3 deletions .github/workflows/paper_joss.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
on: [push]

name: Paper Draft - JOSS

on:
push:
branches: ["main", "version-joss-rev"]
pull_request:
branches: ["main", "version-joss-rev"]

jobs:
paper:
runs-on: ubuntu-latest
Expand All @@ -14,7 +20,7 @@ jobs:
# This should be the path to the paper within your repo.
paper-path: PAPER/paper.md
- name: Upload
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: paper
# This is the output path where Pandoc will write the compiled
Expand Down
10 changes: 6 additions & 4 deletions .github/.gitignore → .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

## folder
dist/
.eggs/*
__pycache__/
build/
**/__pycache__/
/build/*
venv-go-rxr/
venv-go-rxr-paper/
venv-gorxr310/
**/*.h5
.idea/
TESTS/__pycache__/
GO_RXR.egg-info/*
UNKNOWN.egg-info/*

## Files - temporary files
setup_new.py

Binary file added FIGURES/go-rxr-optimization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FIGURES/go-rxr-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 0 additions & 18 deletions GO_RXR.egg-info/PKG-INFO

This file was deleted.

9 changes: 0 additions & 9 deletions GO_RXR.egg-info/SOURCES.txt

This file was deleted.

1 change: 0 additions & 1 deletion GO_RXR.egg-info/dependency_links.txt

This file was deleted.

8 changes: 0 additions & 8 deletions GO_RXR.egg-info/requires.txt

This file was deleted.

1 change: 0 additions & 1 deletion GO_RXR.egg-info/top_level.txt

This file was deleted.

94 changes: 93 additions & 1 deletion PAPER/paper.bib
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,96 @@ @misc{pythonreflectivity
journal = {GitHub repository},
howpublished = {\url{https://github.com/malaclypseII/PyXMRTool/tree/master}},
commit = {30d1ed552cf807d3635d2e274dd89151c2a83090}
}
}

@article{storn1997_de,
title={Differential Evolution – A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces},
author={Storn, R. and Price, K.},
journal={Journal of Global Optimization},
volume={11},
number={4},
pages={341--359},
year={1997},
doi={10.1023/A:1008202821328},
url={https://doi.org/10.1023/A:1008202821328}
}

@article{endres2018_shgo,
title={A simplicial homology algorithm for Lipschitz optimisation},
author={Endres, S.C. and Sandrock, C. and Focke, W.W.},
journal={Journal of Global Optimization},
volume={72},
number={2},
pages={181--217},
year={2018},
doi={10.1007/s10898-018-0627-y},
url={https://doi.org/10.1007/s10898-018-0627-y}
}

@article{xiang1997_dual_annealing,
title={Generalized Simulated Annealing Algorithm and Its Application to the Thomson Model},
author={Xiang, Y. and Sun, D.Y. and Fan, W. and Gong, X.G.},
journal={Physics Letters A},
volume={233},
number={3},
pages={216--220},
year={1997},
doi={10.1016/S0375-9601(97)00474-X},
url={https://doi.org/10.1016/S0375-9601(97)00474-X}
}

@article{virtanen2020_scipy,
title={SciPy 1.0: fundamental algorithms for scientific computing in Python},
author={Virtanen, P. and Gommers, R. and Oliphant, T.E. and others},
journal={Nature Methods},
volume={17},
pages={261--272},
year={2020},
doi={10.1038/s41592-019-0686-2},
url={https://doi.org/10.1038/s41592-019-0686-2}
}

@article{bjorck2007_genx,
title={GenX: an extensible X-ray reflectivity refinement program utilizing differential evolution},
author={Björck, M. and Andersson, G.},
journal={Journal of Applied Crystallography},
volume={40},
pages={1174--1178},
year={2007},
doi={10.1107/S0021889807045086},
url={https://doi.org/10.1107/S0021889807045086}
}

@article{nelson2006_motofit,
title={Co-refinement of multiple-contrast neutron/X-ray reflectivity data using MOTOFIT},
author={Nelson, A.},
journal={Journal of Applied Crystallography},
volume={39},
pages={273--276},
year={2006},
doi={10.1107/S0021889806005073},
url={https://doi.org/10.1107/S0021889806005073}
}

@misc{refl1d_github,
title={{Refl1D: Reflectometry Data Analysis}},
author={Kienzle, P.A. and Maranville, B.B. and O'Donovan, K.V. and Ankner, J.F. and Berk, N.F. and Majkrzak, C.F.},
howpublished={\url{https://github.com/reflectometry/refl1d}},
year={2017},
note={GitHub repository, Accessed: 2024-09-01},
}

@article{pospelov2020_bornagain,
title={{\it BornAgain}: software for simulating and fitting grazing-incidence small-angle scattering},
author={Pospelov, Gennady and Van Herck, Walter and Burle, Jan and Carmona Loaiza, Juan M. and Durniak, C{\'{e}}line and Fisher, Jonathan M. and Ganeva, Marina and Yurov, Dmitry and Wuttke, Joachim},
journal={Journal of Applied Crystallography},
volume={53},
number={1},
pages={262--276},
year={2020},
doi={10.1107/S1600576719016789},
url={https://doi.org/10.1107/S1600576719016789},
}



10 changes: 9 additions & 1 deletion PAPER/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ The analysis of RXR presents multifaceted challenges, extending beyond computati

# Comparison

To the best of our knowledge, no existing software tool comprehensively addresses the general problem of RXR data analysis across a wide range of materials and conditions. Most of the currently available tools are designed for very specific tasks and cannot be extensively applied to the diverse challenges encountered in RXR studies. For example, tools like GenX [@bjorck2007_genx] and Motofit [@nelson2006_motofit] are widely used for reflectometry but are primarily focused on specific types of reflectivity data analysis, such as neutron or x-ray reflectometry, without the capability to handle the complex, element-specific interactions in RXR. Similarly, more modern tools like Refl1D [@refl1d_github] and BornAgain [@pospelov2020_bornagain] offer powerful features for modeling and fitting specific types of reflectometry data but still lack the flexibility and comprehensive approach needed for the broad range of challenges in RXR analysis.

The development of GO-RXR is a response to the critical need for improved tools to analyze RXR data effectively. GO-RXR distinguishes itself from existing RXR data analysis tools through its comprehensive approach and user-friendly design. GO-RXR offers a graphical user interface (GUI) and intuitive plotting options, facilitating data interpretation and analysis. Furthermore, GO-RXR incorporates state-of-the-art global optimization algorithms, allowing for faster and more accurate data fitting compared to older methods. Its ability to model thin-film materials and customize objective functions makes it a versatile and valuable tool for researchers in the field of material science.

# Functionality
Expand All @@ -51,12 +53,18 @@ GO-RXR is available for installation through its GitHub repository, providing us

## Basic concepts

The primary goal of GO-RXR is to simplify and optimize the data analysis process for resonant x-ray reflectometry. Initially conceived as a command-line tool, it evolved into a GUI-based software with enhanced visualization capabilities. Developed using Python with PyQt5 for the interface, this software integrates the Pythonreflectivity [@pythonreflectivity] open-source package to carry out reflectivity calculations efficiently. GO-RXR has been tested extensively on Ubuntu 22.04 with Python 3.10, ensuring reliable performance on this operating system.
The primary goal of GO-RXR is to simplify and optimize the data analysis process for resonant x-ray reflectometry. Initially conceived as a command-line tool, it evolved into a GUI-based software with enhanced visualization capabilities. Developed using Python with PyQt5 for the interface, this software integrates the Pythonreflectivity [@pythonreflectivity] open-source package to carry out reflectivity calculations efficiently. GO-RXR has been tested extensively on Ubuntu 22.04 with Python 3.10, ensuring reliable performance on this operating system. After running the GUI_GO.py file, the start screen in \autoref{fig:start-screen} will be displayed.

![Start screen of GO-RXR. The interface is divided into three main sections: 1) Toolbar, 2) Workspace Navigator, and 3) Workspace Area. \label{fig:start-screen}](../FIGURES/go-rxr-start.png)

\autoref{fig:flowchart} displays the main steps GO-RXR uses to go from input to output. The inputs of the software are the experimental data and are defined by the reflected intensity, incident grazing angle, photon energy, and polarization. The first step in the data analysis is the data selection step. In this step, the user selects the experimental datasets to include into the data analysis. The next step is the parameter selection. In this step, the user selects the model parameters to vary. The final step is the data fitting. In this step, the user selects the global optimization algorithm and its parameters and fits the data from the selected experimental and simulated datasets. The output of GO-RXR is the depth-dependent density profile, as defined by the model parameters.

![Flowchart of GO-RXR. The flowchart illustrates the path the software uses to take the experimental data and convert them into a depth-dependent density profile.\label{fig:flowchart}](../FIGURES/go-rxr-flowchart.png)

GO-RXR incorporates three global optimization algorithms specifically designed to tackle the inherent complexities of RXR data analysis. These are Differential Evolution (DE) [@storn1997_de], Simplicial Homology Global Optimization (SHGO) [@endres2018_shgo], and Dual Annealing [@xiang1997_dual_annealing], each chosen for their effectiveness in handling the high-dimensional optimization challenges typical of RXR. A significant enhancement provided by GO-RXR is the integration of boundary and weight functions, which enable the selective emphasis of specific data regions, thereby improving the precision and relevance of the optimization results [@korol_MSc_2023]. Additionally, the objective function includes a total variation penalty, ensuring that the optimization not only fits the data but also preserves its physical trends, resulting in more accurate and reliable outcomes [@korol_MSc_2023]. These global optimization algorithms, combined with local optimization nonlinear least-squares algorithms for post-processing refinement, allow GO-RXR to effectively model the structural and electronic properties of thin-film materials. The algorithms are implemented within GO-RXR using the SciPy library [@virtanen2020_scipy]. \autoref{fig:optimization} displays the Optimization workspace, which includes sections for parameter boundaries, objective function selection, and algorithm parameters, allowing users to fine-tune the optimization process to achieve the most accurate and physically meaningful results.

![Optimization workspace. \label{fig:optimization}](../FIGURES/go-rxr-optimization.png)


## Example use-cases

Expand Down
Loading
Loading