From fd347e62c993b819bc0a3d9407837ab9b41ef14d Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Wed, 24 Jul 2024 12:47:34 -0600 Subject: [PATCH 01/24] copy .github directory --- workflows/docs.yml | 43 ++++++++++++++++++++++++++++++++ workflows/main.yml | 54 ++++++++++++++++++++++++++++++++++++++++ workflows/pre-commit.yml | 19 ++++++++++++++ 3 files changed, 116 insertions(+) create mode 100644 workflows/docs.yml create mode 100644 workflows/main.yml create mode 100644 workflows/pre-commit.yml diff --git a/workflows/docs.yml b/workflows/docs.yml new file mode 100644 index 00000000..2909d67f --- /dev/null +++ b/workflows/docs.yml @@ -0,0 +1,43 @@ +name: Build Documentation + +on: + push: + branches: + - main + release: + +jobs: + test: + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: build + auto-update-conda: true + + - name: install requirements + run: >- + conda install -n build -c conda-forge + --file requirements/build.txt + --file requirements/run.txt + --file requirements/docs.txt + --quiet --yes + + - name: install the package + run: python -m pip install . --no-deps + + - name: build documents + run: make -C doc html + + - name: Deploy + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./doc/build/html diff --git a/workflows/main.yml b/workflows/main.yml new file mode 100644 index 00000000..81ed769d --- /dev/null +++ b/workflows/main.yml @@ -0,0 +1,54 @@ +name: CI + +on: + push: + branches: + - main + - CI + pull_request: + workflow_dispatch: + +jobs: + miniconda: + name: Miniconda ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: ["ubuntu-latest"] + steps: + - name: check out diffpy.pdfmorph + uses: actions/checkout@v3 + with: + repository: diffpy/diffpy.pdfmorph + path: . + fetch-depth: 0 # avoid shallow clone with no tags + + - name: initialize miniconda + # this uses a marketplace action that sets up miniconda in a way that makes + # it easier to use. I tried setting it up without this and it was a pain + uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: test + # environment.yml file is needed by this action. Because I don't want + # maintain this but rather maintain the requirements files it just has + # basic things in it like conda and pip + environment-file: ./environment.yml + python-version: 3 + auto-activate-base: false + + - name: install diffpy.pdfmorph requirements + shell: bash -l {0} + run: | + conda config --set always_yes yes --set changeps1 no + conda config --add channels conda-forge + conda activate test + conda install --file requirements/run.txt + conda install --file requirements/test.txt + pip install . + - name: Validate diffpy.pdfmorph + shell: bash -l {0} + run: | + conda activate test + coverage run -m pytest -vv -s + coverage report -m + codecov diff --git a/workflows/pre-commit.yml b/workflows/pre-commit.yml new file mode 100644 index 00000000..f2ff7e42 --- /dev/null +++ b/workflows/pre-commit.yml @@ -0,0 +1,19 @@ +name: pre-commit + +on: + pull_request: + push: + workflow_dispatch: + +jobs: + pre-commit: + # pull requests are a duplicate of a branch push if within the same repo. + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - uses: pre-commit/action@v3.0.0 + with: + extra_args: --all-files From 8cdd4c7e8f3b78fc70fe3444e62bccdb5c34d451 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Wed, 24 Jul 2024 12:50:53 -0600 Subject: [PATCH 02/24] nest inside .github --- {workflows => .github/workflows}/docs.yml | 0 {workflows => .github/workflows}/main.yml | 0 {workflows => .github/workflows}/pre-commit.yml | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename {workflows => .github/workflows}/docs.yml (100%) rename {workflows => .github/workflows}/main.yml (100%) rename {workflows => .github/workflows}/pre-commit.yml (100%) diff --git a/workflows/docs.yml b/.github/workflows/docs.yml similarity index 100% rename from workflows/docs.yml rename to .github/workflows/docs.yml diff --git a/workflows/main.yml b/.github/workflows/main.yml similarity index 100% rename from workflows/main.yml rename to .github/workflows/main.yml diff --git a/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml similarity index 100% rename from workflows/pre-commit.yml rename to .github/workflows/pre-commit.yml From a42f581000e08e153a245b1d91e640ff84ec1385 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Wed, 24 Jul 2024 23:41:36 -0600 Subject: [PATCH 03/24] update for pdfgui --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 81ed769d..80bbfb71 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,10 +16,10 @@ jobs: matrix: os: ["ubuntu-latest"] steps: - - name: check out diffpy.pdfmorph + - name: check out diffpy.pdfgui uses: actions/checkout@v3 with: - repository: diffpy/diffpy.pdfmorph + repository: diffpy/diffpy.pdfgui path: . fetch-depth: 0 # avoid shallow clone with no tags @@ -36,7 +36,7 @@ jobs: python-version: 3 auto-activate-base: false - - name: install diffpy.pdfmorph requirements + - name: install diffpy.pdfgui requirements shell: bash -l {0} run: | conda config --set always_yes yes --set changeps1 no @@ -45,7 +45,7 @@ jobs: conda install --file requirements/run.txt conda install --file requirements/test.txt pip install . - - name: Validate diffpy.pdfmorph + - name: Validate diffpy.pdfgui shell: bash -l {0} run: | conda activate test From 6484176963648d82b21f1bdc744d80ffa6c88178 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Fri, 26 Jul 2024 07:50:29 +0200 Subject: [PATCH 04/24] test tests (#131) * pin numpy to 1.x for now * add environment.yml * test tests * trigger * try again with requirements * try again with requirements * now update test reqs * try and handle xwindow display issue * try using xfvb action * refactor xvfb action commands * source activate? * different tack, generate error and work on test? * again * again * chatgpt method * supress running qc of meta.yaml in conda-forge by renaming * try new pyproject.toml * again2 * forgot to install diffpy.pdfgui! * back to setup.py --- .github/workflows/main.yml | 51 +++++++++---------- conda-recipe/{run_test.py => dont_run.py} | 0 .../{meta.yaml => meta.suppress_yaml} | 2 +- environment.yml | 6 +++ requirements/run.txt | 2 +- requirements/test.txt | 2 + run_tests.py | 5 ++ src/diffpy/pdfgui/gui/aboutdialog.py | 4 +- src/diffpy/pdfgui/gui/adddatapanel.py | 1 + 9 files changed, 44 insertions(+), 29 deletions(-) rename conda-recipe/{run_test.py => dont_run.py} (100%) rename conda-recipe/{meta.yaml => meta.suppress_yaml} (96%) create mode 100644 environment.yml create mode 100644 run_tests.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 80bbfb71..e3ade008 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,32 +23,31 @@ jobs: path: . fetch-depth: 0 # avoid shallow clone with no tags - - name: initialize miniconda - # this uses a marketplace action that sets up miniconda in a way that makes - # it easier to use. I tried setting it up without this and it was a pain - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: test - # environment.yml file is needed by this action. Because I don't want - # maintain this but rather maintain the requirements files it just has - # basic things in it like conda and pip - environment-file: ./environment.yml - python-version: 3 - auto-activate-base: false + - name: Install Mamba + run: | + wget "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh" -O mambaforge.sh + bash mambaforge.sh -b -p $HOME/mambaforge + echo "$HOME/mambaforge/bin" >> $GITHUB_PATH + source $HOME/mambaforge/etc/profile.d/conda.sh + conda init bash - - name: install diffpy.pdfgui requirements - shell: bash -l {0} + - name: Create conda environment run: | - conda config --set always_yes yes --set changeps1 no - conda config --add channels conda-forge - conda activate test - conda install --file requirements/run.txt - conda install --file requirements/test.txt - pip install . - - name: Validate diffpy.pdfgui - shell: bash -l {0} + source $HOME/mambaforge/etc/profile.d/conda.sh + conda create -n test_env python=3.12 xonsh regolith -c conda-forge -y + conda activate test_env + pip install case_insensitive_dict + + - name: Install dependencies run: | - conda activate test - coverage run -m pytest -vv -s - coverage report -m - codecov + source $HOME/mambaforge/etc/profile.d/conda.sh + conda activate test_env + mamba install --file requirements/run.txt + mamba install --file requirements/test.txt + pip install -e . + + - name: Use Xvfb Action + uses: GabrielBB/xvfb-action@v1 + with: + run: | + bash -c "source $HOME/mambaforge/etc/profile.d/conda.sh && conda activate test_env && python -m run_tests.py" diff --git a/conda-recipe/run_test.py b/conda-recipe/dont_run.py similarity index 100% rename from conda-recipe/run_test.py rename to conda-recipe/dont_run.py diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.suppress_yaml similarity index 96% rename from conda-recipe/meta.yaml rename to conda-recipe/meta.suppress_yaml index 2eeff68a..568d0c7d 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.suppress_yaml @@ -54,7 +54,7 @@ test: # entry points work. - # You can also put a file called run_test.py in the recipe that will be run + # You can also put a file called dont_run.py in the recipe that will be run # at test time. # requires: diff --git a/environment.yml b/environment.yml new file mode 100644 index 00000000..a3904941 --- /dev/null +++ b/environment.yml @@ -0,0 +1,6 @@ +name: diffpy.pdfgui +channels: + - conda-forge +dependencies: + - python=3 + - pip diff --git a/requirements/run.txt b/requirements/run.txt index 10e45f83..40bce3f0 100644 --- a/requirements/run.txt +++ b/requirements/run.txt @@ -1,4 +1,4 @@ -numpy +numpy==1.26 wxpython diffpy.pdffit2 diffpy.utils diff --git a/requirements/test.txt b/requirements/test.txt index 7167f602..628a048a 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,2 +1,4 @@ pytest freezegun +coverage +codecov diff --git a/run_tests.py b/run_tests.py new file mode 100644 index 00000000..a2a69494 --- /dev/null +++ b/run_tests.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python + +import diffpy.pdfgui.tests + +assert diffpy.pdfgui.tests.testdeps().wasSuccessful() diff --git a/src/diffpy/pdfgui/gui/aboutdialog.py b/src/diffpy/pdfgui/gui/aboutdialog.py index 37bd30c7..c71c45b3 100644 --- a/src/diffpy/pdfgui/gui/aboutdialog.py +++ b/src/diffpy/pdfgui/gui/aboutdialog.py @@ -4,6 +4,8 @@ # PDFgui by DANSE Diffraction group # Simon J. L. Billinge # (c) 2006 trustees of the Michigan State University. +# (c) 2024 trustees of the Columbia University in the City +# of New York # All rights reserved. # # File coded by: Dmitriy Bryndin @@ -233,7 +235,7 @@ def onColumbiaLogo(self, event): # wxGlade: DialogAbout. # end of class DialogAbout -##### testing code ########################################################### +# #### testing code ########################################################### if __name__ == "__main__": app = wx.App() diff --git a/src/diffpy/pdfgui/gui/adddatapanel.py b/src/diffpy/pdfgui/gui/adddatapanel.py index 7f5f1407..15cb48ca 100644 --- a/src/diffpy/pdfgui/gui/adddatapanel.py +++ b/src/diffpy/pdfgui/gui/adddatapanel.py @@ -5,6 +5,7 @@ # PDFgui by DANSE Diffraction group # Simon J. L. Billinge # (c) 2006 trustees of the Michigan State University. +# (c) 2024 trustees of the Columbia University in the City # All rights reserved. # # File coded by: Chris Farrow From db8ce8728bd72b54d8e7f7e10292059ada4c148e Mon Sep 17 00:00:00 2001 From: Caden Myers <158210249+cadenmyers13@users.noreply.github.com> Date: Fri, 26 Jul 2024 00:07:29 -0600 Subject: [PATCH 05/24] copyright fixes (#134) --- src/diffpy/pdfgui/applications/__init__.py | 2 +- src/diffpy/pdfgui/control/structureviewer.py | 2 +- src/diffpy/pdfgui/tests/__init__.py | 2 +- src/diffpy/pdfgui/tests/run.py | 2 +- src/diffpy/pdfgui/tests/rundeps.py | 2 +- src/diffpy/pdfgui/tests/showphasenotebookpanel.py | 2 +- src/diffpy/pdfgui/tests/testutils.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/diffpy/pdfgui/applications/__init__.py b/src/diffpy/pdfgui/applications/__init__.py index d698044f..8bdc5f5a 100644 --- a/src/diffpy/pdfgui/applications/__init__.py +++ b/src/diffpy/pdfgui/applications/__init__.py @@ -3,7 +3,7 @@ # # diffpy.pdfgui by DANSE Diffraction group # Simon J. L. Billinge -# (c) 2009 Trustees of the Columbia University +# (c) 2009-2024 Trustees of the Columbia University # in the City of New York. All rights reserved. # # File coded by: Pavol Juhas diff --git a/src/diffpy/pdfgui/control/structureviewer.py b/src/diffpy/pdfgui/control/structureviewer.py index d58def97..85308d10 100644 --- a/src/diffpy/pdfgui/control/structureviewer.py +++ b/src/diffpy/pdfgui/control/structureviewer.py @@ -3,7 +3,7 @@ # # diffpy.pdfgui by DANSE Diffraction group # Simon J. L. Billinge -# (c) 2009 Trustees of the Columbia University +# (c) 2009-2024 Trustees of the Columbia University # in the City of New York. All rights reserved. # # File coded by: Pavol Juhas diff --git a/src/diffpy/pdfgui/tests/__init__.py b/src/diffpy/pdfgui/tests/__init__.py index accc2e33..863e9949 100644 --- a/src/diffpy/pdfgui/tests/__init__.py +++ b/src/diffpy/pdfgui/tests/__init__.py @@ -3,7 +3,7 @@ # # diffpy.pdfgui by DANSE Diffraction group # Simon J. L. Billinge -# (c) 2012 Trustees of the Columbia University +# (c) 2012-2024 Trustees of the Columbia University # in the City of New York. All rights reserved. # # File coded by: Pavol Juhas diff --git a/src/diffpy/pdfgui/tests/run.py b/src/diffpy/pdfgui/tests/run.py index f1bf407e..461d7c01 100644 --- a/src/diffpy/pdfgui/tests/run.py +++ b/src/diffpy/pdfgui/tests/run.py @@ -3,7 +3,7 @@ # # diffpy.pdfgui by DANSE Diffraction group # Simon J. L. Billinge -# (c) 2012 Trustees of the Columbia University +# (c) 2012-2024 Trustees of the Columbia University # in the City of New York. All rights reserved. # # File coded by: Pavol Juhas diff --git a/src/diffpy/pdfgui/tests/rundeps.py b/src/diffpy/pdfgui/tests/rundeps.py index 0181a83f..9818fc86 100644 --- a/src/diffpy/pdfgui/tests/rundeps.py +++ b/src/diffpy/pdfgui/tests/rundeps.py @@ -3,7 +3,7 @@ # # diffpy.pdfgui by DANSE Diffraction group # Simon J. L. Billinge -# (c) 2012 Trustees of the Columbia University +# (c) 2012-2024 Trustees of the Columbia University # in the City of New York. All rights reserved. # # File coded by: Pavol Juhas diff --git a/src/diffpy/pdfgui/tests/showphasenotebookpanel.py b/src/diffpy/pdfgui/tests/showphasenotebookpanel.py index 4dfb8cde..71c3f0d3 100644 --- a/src/diffpy/pdfgui/tests/showphasenotebookpanel.py +++ b/src/diffpy/pdfgui/tests/showphasenotebookpanel.py @@ -3,7 +3,7 @@ # # diffpy.pdfgui by DANSE Diffraction group # Simon J. L. Billinge -# (c) 2016 Trustees of the Columbia University +# (c) 2016-2024 Trustees of the Columbia University # in the City of New York. All rights reserved. # # File coded by: Pavol Juhas diff --git a/src/diffpy/pdfgui/tests/testutils.py b/src/diffpy/pdfgui/tests/testutils.py index eb981e2b..70147319 100644 --- a/src/diffpy/pdfgui/tests/testutils.py +++ b/src/diffpy/pdfgui/tests/testutils.py @@ -3,7 +3,7 @@ # # diffpy.pdfgui by DANSE Diffraction group # Simon J. L. Billinge -# (c) 2016 Trustees of the Columbia University +# (c) 2016-2024 Trustees of the Columbia University # in the City of New York. All rights reserved. # # File coded by: Pavol Juhas From fa1ac1c2d251d758a4ef7baf2bc4bde98e2fa29f Mon Sep 17 00:00:00 2001 From: Caden Myers <158210249+cadenmyers13@users.noreply.github.com> Date: Tue, 30 Jul 2024 22:00:35 -0400 Subject: [PATCH 06/24] Flake8v1 (#137) * move modules to top * remove extra #s * line length and extra #s * extra #s * modules to top * replace lambda function and line length * add # noqa: E501 * modules to top * fix lambda func --- src/diffpy/pdfgui/doc/manual/fixHTMLCode.py | 7 +-- src/diffpy/pdfgui/gui/aboutdialog.py | 2 +- src/diffpy/pdfgui/gui/mainframe.py | 48 ++++++++++++------- src/diffpy/pdfgui/gui/parameterspanel.py | 10 ++-- src/diffpy/pdfgui/gui/pdfguiglobals.py | 3 +- src/diffpy/pdfgui/gui/tooltips.py | 14 ++++-- src/diffpy/pdfgui/gui/windowperspective.py | 2 +- .../pdfgui/gui/wxextensions/validators.py | 7 ++- src/diffpy/pdfgui/tests/testaboutdialog.py | 6 ++- 9 files changed, 62 insertions(+), 37 deletions(-) diff --git a/src/diffpy/pdfgui/doc/manual/fixHTMLCode.py b/src/diffpy/pdfgui/doc/manual/fixHTMLCode.py index 0e410070..0ec4b70a 100644 --- a/src/diffpy/pdfgui/doc/manual/fixHTMLCode.py +++ b/src/diffpy/pdfgui/doc/manual/fixHTMLCode.py @@ -1,5 +1,9 @@ #!/usr/bin/python +import os +import re +import sys + """Replace all equation marks in HTML file with tag to display corresponding PNG file. This assumes PNG files are in correct sequence. Also fix any accented characters texinfo does not get right. @@ -16,9 +20,6 @@ ############################################################################## # business -import os -import re -import sys eqcnt = 0 diff --git a/src/diffpy/pdfgui/gui/aboutdialog.py b/src/diffpy/pdfgui/gui/aboutdialog.py index c71c45b3..2cd47a5e 100644 --- a/src/diffpy/pdfgui/gui/aboutdialog.py +++ b/src/diffpy/pdfgui/gui/aboutdialog.py @@ -235,7 +235,7 @@ def onColumbiaLogo(self, event): # wxGlade: DialogAbout. # end of class DialogAbout -# #### testing code ########################################################### +# testing code ########################################################### if __name__ == "__main__": app = wx.App() diff --git a/src/diffpy/pdfgui/gui/mainframe.py b/src/diffpy/pdfgui/gui/mainframe.py index b7e32efc..bbe63bca 100644 --- a/src/diffpy/pdfgui/gui/mainframe.py +++ b/src/diffpy/pdfgui/gui/mainframe.py @@ -758,21 +758,21 @@ def __menuBindings(self): # For recent items self.Bind(wx.EVT_MENU_RANGE, self.onMRUFile, id=wx.ID_FILE1, id2=wx.ID_FILE5) - ## Edit Menu + # Edit Menu self.Bind(wx.EVT_MENU, self.onDelete, id=self.deleteId) self.Bind(wx.EVT_MENU, self.onCopy, id=self.copyId) self.Bind(wx.EVT_MENU, self.onPaste, id=self.pasteId) self.Bind(wx.EVT_MENU, self.onPasteLink, id=self.pasteLinkId) self.Bind(wx.EVT_MENU, self.onPreferences, self.prefItem) - ## View menu + # View menu self.Bind(wx.EVT_MENU, self.onDefaultLayout, self.defaultLayoutItem) self.Bind(wx.EVT_MENU, self.onShowFit, self.showFitItem) self.Bind(wx.EVT_MENU, self.onShowPlot, self.showPlotItem) self.Bind(wx.EVT_MENU, self.onShowOutput, self.showOutputItem) self.Bind(wx.EVT_MENU, self.onShowJournal, self.showJournalItem) - ## Fits Menu + # Fits Menu self.Bind(wx.EVT_MENU, self.onNewFit, id=self.newFitId) self.Bind(wx.EVT_MENU, self.onRun, id=self.runFitId) self.Bind(wx.EVT_MENU, self.onStop, id=self.stopFitId) @@ -780,9 +780,9 @@ def __menuBindings(self): self.Bind(wx.EVT_MENU, self.onRSeries, self.rseriesItem) self.Bind(wx.EVT_MENU, self.onTSeries, self.tseriesItem) self.Bind(wx.EVT_MENU, self.onDSeries, self.dseriesItem) - ## Macros are inserted individually + # Macros are inserted individually - ## Phases Menu + # Phases Menu self.Bind(wx.EVT_MENU, self.onInsPhase, id=self.newPhaseId) self.Bind(wx.EVT_MENU, self.onPrintBL, id=self.printBLId) self.Bind(wx.EVT_MENU, self.onPrintBA, id=self.printBAId) @@ -791,16 +791,16 @@ def __menuBindings(self): self.Bind(wx.EVT_MENU, self.onPlotIStruct, id=self.plotIStructId) self.Bind(wx.EVT_MENU, self.onPlotFStruct, id=self.plotFStructId) - ## Data Menu + # Data Menu self.Bind(wx.EVT_MENU, self.onInsData, id=self.newDataId) self.Bind(wx.EVT_MENU, self.onExportPDF, id=self.exportFitPDFId) - ## Calculations Menu + # Calculations Menu self.Bind(wx.EVT_MENU, self.onInsCalc, id=self.newCalcId) self.Bind(wx.EVT_MENU, self.onRun, id=self.runCalcId) self.Bind(wx.EVT_MENU, self.onSaveCalc, id=self.exportCalcPDFId) - ## Help Menu + # Help Menu self.Bind(wx.EVT_MENU, self.onDocumentation, self.docItem) self.Bind(wx.EVT_MENU, self.onAbout, self.aboutItem) self.Bind(wx.EVT_MENU, self.onRequest, self.requestItem) @@ -1529,11 +1529,11 @@ def disableSharedMenuItems(self, menu): noPhases = False if node: phases = self.treeCtrlMain.GetPhases(node) - ## No insert calculation if there are no phases + # No insert calculation if there are no phases if len(phases) == 0: noPhases = True - ## No insert calculation if there are no phases + # No insert calculation if there are no phases if noPhases: menu.Enable(self.newCalcId, False) @@ -1544,7 +1544,7 @@ def disableSharedMenuItems(self, menu): clipbranchtype = None cdata = self.treeCtrlMain.GetClipboard() - ## No paste if nothing in the clipboard + # No paste if nothing in the clipboard if cdata is None: menu.Enable(self.pasteId, False) menu.Enable(self.pasteLinkId, False) @@ -1573,7 +1573,7 @@ def disableSharedMenuItems(self, menu): menu.SetLabel(self.pasteId, pastetext) # Disable certain entries based upon where we clicked. - ## No copy, paste, or insert on multiple items. + # No copy, paste, or insert on multiple items. if len(selections) > 1: menu.Enable(self.copyId, False) menu.Enable(self.pasteId, False) @@ -1581,7 +1581,7 @@ def disableSharedMenuItems(self, menu): menu.Enable(self.newDataId, False) menu.Enable(self.newPhaseId, False) menu.Enable(self.newCalcId, False) - ## Disallow paste of fit if no items selected + # Disallow paste of fit if no items selected elif not selections: menu.Enable(self.copyId, False) menu.Enable(self.deleteId, False) @@ -1708,7 +1708,7 @@ def disableMainMenuItems(self): if not cdata.Gcalc: menu.Enable(self.exportFitPDFId, False) - ## Check the run/stop status. + # Check the run/stop status. if self.runningDict: menu.Enable(self.newId, False) menu.Enable(self.runCalcId, False) @@ -1756,7 +1756,7 @@ def disableMainMenuItems(self): return # Shared menu items - ## The bulk of the code for these methods is in the FitTree class. + # The bulk of the code for these methods is in the FitTree class. def onNewFit(self, event): """Start a new fit tree. @@ -2377,7 +2377,14 @@ def onExportNewStruct(self, event): # branchname = self.treeCtrlMain.GetBranchName(node) name = self.treeCtrlMain.GetItemText(node) basename = ".".join(name.split(".")[:-1]) or name - matchstring = "PDFfit structure file (*.stru)|*.stru|Crystallographic Information File (*.cif)|*.cif|Protein Data Bank file (*.pdb)|*.pdb|Labeled coordinate file (*.xyz)|*.xyz|Raw corrdinate file (*.xyz)|*.xyz|AtomEye configuration file|*" + matchstring = ( + "PDFfit structure file (*.stru)|*.stru|" + "Crystallographic Information File (*.cif)|*.cif|" + "Protein Data Bank file (*.pdb)|*.pdb|" + "Labeled coordinate file (*.xyz)|*.xyz|" + "Raw coordinate file (*.xyz)|*.xyz|" + "AtomEye configuration file|*" + ) d = wx.FileDialog( None, "Save as...", @@ -2416,7 +2423,14 @@ def onExportStruct(self, event): # branchname = self.treeCtrlMain.GetBranchName(node) name = self.treeCtrlMain.GetItemText(node) basename = ".".join(name.split(".")[:-1]) or name - matchstring = "PDFfit structure file (*.stru)|*.stru|Crystallographic Information File (*.cif)|*.cif|Protein Data Bank file (*.pdb)|*.pdb|Labeled coordinate file (*.xyz)|*.xyz|Raw corrdinate file (*.xyz)|*.xyz|AtomEye configuration file|*" + matchstring = ( + "PDFfit structure file (*.stru)|*.stru|" + "Crystallographic Information File (*.cif)|*.cif|" + "Protein Data Bank file (*.pdb)|*.pdb|" + "Labeled coordinate file (*.xyz)|*.xyz|" + "Raw coordinate file (*.xyz)|*.xyz|" + "AtomEye configuration file|*" + ) d = wx.FileDialog( None, "Save as...", diff --git a/src/diffpy/pdfgui/gui/parameterspanel.py b/src/diffpy/pdfgui/gui/parameterspanel.py index fc375704..ff043ff5 100644 --- a/src/diffpy/pdfgui/gui/parameterspanel.py +++ b/src/diffpy/pdfgui/gui/parameterspanel.py @@ -116,7 +116,7 @@ def refresh(self): nRows = len(self.parameters) - ### update the grid + # update the grid # remove all rows and create new ones self.grid_parameters.BeginBatch() gridrows = self.grid_parameters.GetNumberRows() @@ -297,7 +297,7 @@ def popupMenu(self, window, x, y): menu.Destroy() return - ##### Popup menu events ################################################## + # Popup menu events ################################################## def onPopupFill(self, event): """Fills cells selected in the grid with a new value""" @@ -402,7 +402,7 @@ def onPopupRenameParameters(self, event): event.Skip() return - ##### end of Popup menu events ########################################### + # end of Popup menu events ########################################### def onApplyParameters(self, event): # wxGlade: ParametersPanel. self.fit.applyParameters() @@ -439,7 +439,7 @@ def fillCells(self, indices, value): # end of class ParametersPanel -##### testing code ############################################################ +# testing code ############################################################ if __name__ == "__main__": class MyFrame(wx.Frame): @@ -481,4 +481,4 @@ def onInit(self): app = MyApp(0) app.MainLoop() -##### end of testing code ##################################################### +# end of testing code ##################################################### diff --git a/src/diffpy/pdfgui/gui/pdfguiglobals.py b/src/diffpy/pdfgui/gui/pdfguiglobals.py index b19a7ddb..96f20538 100644 --- a/src/diffpy/pdfgui/gui/pdfguiglobals.py +++ b/src/diffpy/pdfgui/gui/pdfguiglobals.py @@ -19,6 +19,8 @@ from pkg_resources import Requirement, resource_filename +from diffpy.pdfgui.gui import debugoptions + # Name of the program name = "PDFgui" # Maximum number of files to be remembered @@ -76,7 +78,6 @@ def iconpath(iconfilename): cmdargs = [] # debugging options: -from diffpy.pdfgui.gui import debugoptions dbopts = debugoptions.DebugOptions() diff --git a/src/diffpy/pdfgui/gui/tooltips.py b/src/diffpy/pdfgui/gui/tooltips.py index 095b4ffa..ff860132 100644 --- a/src/diffpy/pdfgui/gui/tooltips.py +++ b/src/diffpy/pdfgui/gui/tooltips.py @@ -17,9 +17,12 @@ """ +def isalias(s): + return s[1:-1] and s[:: len(s) - 1] == "{}" and s[1:-1].replace("_", "").isalnum() + + def _expand_tooltip_aliases(ttps): "Replace aliased equivalent values {other} in tooltip strings." - isalias = lambda s: (s[1:-1] and s[:: len(s) - 1] == "{}" and s[1:-1].replace("_", "").isalnum()) for n, t in list(ttps.items()): if not isalias(t): continue @@ -79,7 +82,10 @@ def _expand_tooltip_aliases(ttps): dopingseriespanel = { - # 'instructionsLabel' : '', # StaticText "Select a fit from the tree on the left then add datasets and assign\ndoping elements and values below. If you have not set up a fit to be\nthe template for the series, hit cancel and rerun this macro once a\nfit has been created." + # 'instructionsLabel' : '', # StaticText "Select a fit from the tree on the left then add + # datasets and assign\ndoping elements and values below. If you + # have not set up a fit to be\nthe template for the series, hit + # cancel and rerun this macro once a\nfit has been created." # 'labelBaseElement' : '', # StaticText "Base element" # 'textCtrlBaseElement' : '', # TextCtrl # 'labelDopant' : '', # StaticText "Dopant" @@ -175,7 +181,9 @@ def _expand_tooltip_aliases(ttps): temperatureseriespanel = { - # 'instructionsLabel' : '', # StaticText "Select a fit from the tree on the left then add datasets and assign\ntemperatues below. If you have not set up a fit to be the template\nfor the series, hit cancel and rerun this macro once a fit has been\ncreated." + # 'instructionsLabel' : '', # StaticText "Select a fit from the tree on the left + # then add datasets and assign\ntemperatues below. If you have not set up a fit to + # be the template\nfor the series, hit cancel and rerun this macro once a fit has been\ncreated." "listCtrlFiles": "Click header to sort by temperature", # AutoWidthListCtrl # 'buttonUp' : '', # BitmapButton # 'buttonDown' : '', # BitmapButton diff --git a/src/diffpy/pdfgui/gui/windowperspective.py b/src/diffpy/pdfgui/gui/windowperspective.py index 838be3ca..4c2e205b 100644 --- a/src/diffpy/pdfgui/gui/windowperspective.py +++ b/src/diffpy/pdfgui/gui/windowperspective.py @@ -15,4 +15,4 @@ """This contains the default perspective for the gui window.""" -default = "layout2|name=dseries;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=calculation;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=welcome;caption=;state=768;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=adddata;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=serverconfig;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=addphase;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=blank;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=phase;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=dataset;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=preferences;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=fit;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=rseries;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=tseries;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPanel;caption=PDFfit2 Output;state=10487804;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=40;minw=200;minh=40;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=treeCtrlMain;caption=Fit Tree;state=10487804;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=200;besth=100;minw=200;minh=40;maxw=-1;maxh=-1;floatx=471;floaty=730;floatw=208;floath=124|name=plotPanel;caption=Plot Control;state=10487804;dir=4;layer=0;row=0;pos=1;prop=100000;bestw=200;besth=250;minw=200;minh=150;maxw=-1;maxh=-1;floatx=337;floaty=393;floatw=208;floath=274|name=journalPanel;caption=Project Journal;state=10487807;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=450;besth=450;minw=200;minh=200;maxw=-1;maxh=-1;floatx=393;floaty=113;floatw=450;floath=450|dock_size(3,0,0)=59|dock_size(4,0,0)=202|dock_size(5,0,0)=362|" +default = "layout2|name=dseries;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=calculation;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=welcome;caption=;state=768;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=adddata;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=serverconfig;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=addphase;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=blank;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=phase;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=dataset;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=preferences;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=fit;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=rseries;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=tseries;caption=;state=770;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=380;minw=190;minh=200;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=outputPanel;caption=PDFfit2 Output;state=10487804;dir=3;layer=0;row=0;pos=0;prop=100000;bestw=400;besth=40;minw=200;minh=40;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=treeCtrlMain;caption=Fit Tree;state=10487804;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=200;besth=100;minw=200;minh=40;maxw=-1;maxh=-1;floatx=471;floaty=730;floatw=208;floath=124|name=plotPanel;caption=Plot Control;state=10487804;dir=4;layer=0;row=0;pos=1;prop=100000;bestw=200;besth=250;minw=200;minh=150;maxw=-1;maxh=-1;floatx=337;floaty=393;floatw=208;floath=274|name=journalPanel;caption=Project Journal;state=10487807;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=450;besth=450;minw=200;minh=200;maxw=-1;maxh=-1;floatx=393;floaty=113;floatw=450;floath=450|dock_size(3,0,0)=59|dock_size(4,0,0)=202|dock_size(5,0,0)=362|" # noqa: E501 diff --git a/src/diffpy/pdfgui/gui/wxextensions/validators.py b/src/diffpy/pdfgui/gui/wxextensions/validators.py index 5a09ffff..dd99d7cc 100644 --- a/src/diffpy/pdfgui/gui/wxextensions/validators.py +++ b/src/diffpy/pdfgui/gui/wxextensions/validators.py @@ -12,6 +12,9 @@ # See LICENSE.txt for license information. # ############################################################################## +import string + +import wx """This module contains TextValidator, which is an input validator for the wxTextCtrl. See the wxPython documentation for wxTextCtrl for more about text @@ -23,10 +26,6 @@ DIGIT_ONLY = 2 FLOAT_ONLY = 3 -import string - -import wx - class TextValidator(wx.Validator): """This validator is designed to check text input for wxTextCtrls. (It might diff --git a/src/diffpy/pdfgui/tests/testaboutdialog.py b/src/diffpy/pdfgui/tests/testaboutdialog.py index 1123d46d..44078276 100644 --- a/src/diffpy/pdfgui/tests/testaboutdialog.py +++ b/src/diffpy/pdfgui/tests/testaboutdialog.py @@ -43,11 +43,13 @@ def _clickbutton(self, button): self.dialog.ProcessEvent(e) return + def set_url(self, u): + setattr(self, "url", u) + def test_LogoClicks(self): "Check handling of clicks on various logos" d = self.dialog - stealurl = lambda u: setattr(self, "url", u) - with overridewebbrowser(stealurl): + with overridewebbrowser(self.set_url): self._clickbutton(d.bitmap_button_nsf) self.assertTrue(self.url.endswith("www.nsf.gov")) self._clickbutton(d.bitmap_button_danse) From c9ecd94efa72178dfbf8dd8e98b5a53800a64827 Mon Sep 17 00:00:00 2001 From: Caden Myers <158210249+cadenmyers13@users.noreply.github.com> Date: Tue, 30 Jul 2024 22:03:05 -0400 Subject: [PATCH 07/24] Flake8v2 (#138) * fix not in * fix lambda functions * remove # * remove lambda func * modules to top * mod to top * line length and import and #s * fix line length and #s * comment unused var, fix imports and #s * modules to top and inline comment fix * def functions within function to pass tests * move functions outside of class --- src/diffpy/pdfgui/control/fitstructure.py | 2 +- src/diffpy/pdfgui/control/organizer.py | 13 +++++++++--- src/diffpy/pdfgui/control/pdfguicontrol.py | 2 +- src/diffpy/pdfgui/control/plotter.py | 6 +++++- .../pdfgui/doc/manual/extractEquations.py | 7 +++---- .../doc/tutorial/tui_mno_bond_lengths.py | 12 +++++++---- src/diffpy/pdfgui/gui/dopingseriespanel.py | 18 ++++++++++------ src/diffpy/pdfgui/gui/errorreportdialog.py | 13 +++++++----- .../gui/errorreportdialog_control_fix.py | 21 ++++++++++++------- src/diffpy/pdfgui/gui/extendedplotframe.py | 6 +++--- 10 files changed, 64 insertions(+), 36 deletions(-) diff --git a/src/diffpy/pdfgui/control/fitstructure.py b/src/diffpy/pdfgui/control/fitstructure.py index f643c994..515fdec5 100644 --- a/src/diffpy/pdfgui/control/fitstructure.py +++ b/src/diffpy/pdfgui/control/fitstructure.py @@ -252,7 +252,7 @@ def _restoreAtomConstraints(self, acd): acd -- dictionary obtained from _popAtomConstraints() """ for i, a in enumerate(self.initial): - if not a in acd: + if a not in acd: continue # there are some constraints for atom a siteindex = i + 1 diff --git a/src/diffpy/pdfgui/control/organizer.py b/src/diffpy/pdfgui/control/organizer.py index 31a5a095..e5c74d37 100644 --- a/src/diffpy/pdfgui/control/organizer.py +++ b/src/diffpy/pdfgui/control/organizer.py @@ -20,6 +20,15 @@ from diffpy.pdfgui.control.pdfcomponent import PDFComponent +# Search datasets for spdiameter and its constraints +def spd_assigned(ds): + return bool(ds.spdiameter) + + +def spd_constrained(ds): + return "spdiameter" in ds.constraints + + class Organizer(PDFComponent): """Base class for Fitting. It holds separate lists of datasets, strucs and calculations @@ -241,9 +250,7 @@ def __forward_spdiameter(self): for stru in self.strucs: if stru.getvar("spdiameter"): return - # Search datasets for spdiameter and its constraints - spd_assigned = lambda ds: bool(ds.spdiameter) - spd_constrained = lambda ds: "spdiameter" in ds.constraints + # Figure out the value and constraint for spdiameter. # The highest priority is for a dataset with constrained spdiameter, # then for dataset with assigned spdiameter and finally from diff --git a/src/diffpy/pdfgui/control/pdfguicontrol.py b/src/diffpy/pdfgui/control/pdfguicontrol.py index bb39baa8..15632a0d 100644 --- a/src/diffpy/pdfgui/control/pdfguicontrol.py +++ b/src/diffpy/pdfgui/control/pdfguicontrol.py @@ -58,7 +58,7 @@ def __init__(self, gui=None): self.fittingQueue = [] self.currentFitting = None self.queueManager = PDFGuiControl.QueueManager(self) - ##self.startQueue() + # self.startQueue() def reset(self): """clean up for a new project""" diff --git a/src/diffpy/pdfgui/control/plotter.py b/src/diffpy/pdfgui/control/plotter.py index 77134fb1..39359cbd 100644 --- a/src/diffpy/pdfgui/control/plotter.py +++ b/src/diffpy/pdfgui/control/plotter.py @@ -129,6 +129,11 @@ def _buildStyle(plotter, name, group, yNames): return style +def deblank(s): + """Remove all whitespace from the given string.""" + return "".join(s.split()) + + class Plotter(PDFComponent): """Plots a single graph. It can have multiple curves.""" @@ -622,7 +627,6 @@ def export(self, filename): header = "# Generated on %s by %s.\n" % (time.ctime(), getpass.getuser()) header += "# This file was created by PDFgui.\n" outfile.write(header) - deblank = lambda s: "".join(s.split()) xylist = [(c.x, c.y) for c in self.curves] xynames = [(_transName(c.xStr), deblank(c.name)) for c in self.curves] _exportCompactData(outfile, xylist, xynames) diff --git a/src/diffpy/pdfgui/doc/manual/extractEquations.py b/src/diffpy/pdfgui/doc/manual/extractEquations.py index 4c32814e..ce3a9819 100644 --- a/src/diffpy/pdfgui/doc/manual/extractEquations.py +++ b/src/diffpy/pdfgui/doc/manual/extractEquations.py @@ -1,4 +1,7 @@ #!/usr/bin/python +import os +import shutil +import sys """Read one or more texinfo files and extract any equations marked in the code with '@EquationMark' macro as PNG files to the images @@ -31,10 +34,6 @@ ############################################################################## # business -import os -import shutil -import sys - def loadEquations(): """Search for equation codes preceded by @EquationMark macro. diff --git a/src/diffpy/pdfgui/doc/tutorial/tui_mno_bond_lengths.py b/src/diffpy/pdfgui/doc/tutorial/tui_mno_bond_lengths.py index 79c1b527..1f43d196 100755 --- a/src/diffpy/pdfgui/doc/tutorial/tui_mno_bond_lengths.py +++ b/src/diffpy/pdfgui/doc/tutorial/tui_mno_bond_lengths.py @@ -7,12 +7,17 @@ are plotted versus temperature and saved to "mno-bond-lengths.dat" file. """ +import pylab + +from diffpy.pdffit2 import PdfFit + +# Import tui (Text User Interface) functions from diffpy.pdfgui +from diffpy.pdfgui import tui + # PDFgui project file project_file = "lmo-template.ddp3" output_file = "mno-bond-lengths.dat" -# Import tui (Text User Interface) functions from diffpy.pdfgui -from diffpy.pdfgui import tui # load project file prj = tui.LoadProject(project_file) @@ -21,7 +26,7 @@ # using diffpy.pdffit2 # Create a PDF calculator object that will be used in that function. -from diffpy.pdffit2 import PdfFit + pf = PdfFit() @@ -69,7 +74,6 @@ def shortestBond_MnO(stru): # Plot results using matplotlib; pylab is a part of matplotlib that # provides MATLAB-like plotting functions. -import pylab pylab.plot(temperatures, MnO_bond_lengths, "o--") pylab.title("Data from refined phases in PDFgui project %s" % project_file) diff --git a/src/diffpy/pdfgui/gui/dopingseriespanel.py b/src/diffpy/pdfgui/gui/dopingseriespanel.py index 211e2f8e..fd60c1bf 100644 --- a/src/diffpy/pdfgui/gui/dopingseriespanel.py +++ b/src/diffpy/pdfgui/gui/dopingseriespanel.py @@ -18,7 +18,6 @@ import os.path import re -import sys import wx @@ -41,7 +40,10 @@ def __init__(self, *args, **kwds): self.instructionsLabel = wx.StaticText( self, wx.ID_ANY, - "Select a fit from the tree on the left then add datasets and assign\ndoping elements and values below. If you have not set up a fit to be\nthe template for the series, hit cancel and rerun this macro once a\nfit has been created.", + "Select a fit from the tree on the left then add datasets and " + + "assign\ndoping elements and values below. " + + "If you have not set up a fit to be\nthe template for the series, " + + "hit cancel and rerun this macro once a\nfit has been created.", ) self.instructionsLabel.SetFont( wx.Font( @@ -210,7 +212,11 @@ def onAdd(self, event): # wxGlade: DopingSeriesPanel. if not dir: dir = self.mainFrame.workpath - matchstring = "PDF data files (*.gr)|*.gr|PDF fit files (*.fgr)|*.fgr|PDF fit files (*.fit)|*.fit|PDF calculation files (*.cgr)|*.cgr|PDF calculation files (*.calc)|*.calc|All Files|*" + matchstring = ( + "PDF data files (*.gr)|*.gr|PDF fit files (*.fgr)|*.fgr|PDF fit files (*.fit)|" + "*.fit|PDF calculation files (*.cgr)|*.cgr|PDF calculation files (*.calc)|*.calc|" + "All Files|*" + ) d = wx.FileDialog( None, "Choose files", @@ -304,7 +310,7 @@ def onCancel(self, event): # wxGlade: DopingSeriesPanel. self.mainFrame.switchRightPanel("blank") return - ## Utility functions + # Utility functions def checkConfiguration(self): """Verify that the dopant and base are elements. @@ -340,7 +346,7 @@ def fillList(self): self.listCtrlFiles.SetItem(index, 1, shortname) return - ## Needed by mainframe + # Needed by mainframe def treeSelectionUpdate(self, node): """Set the current fit when the tree selection changes.""" nodetype = self.treeCtrlMain.GetNodeType(node) @@ -349,7 +355,7 @@ def treeSelectionUpdate(self, node): self.refresh() return - ## Required by PDFPanel + # Required by PDFPanel def refresh(self): """Block out OK button if there is no fit. diff --git a/src/diffpy/pdfgui/gui/errorreportdialog.py b/src/diffpy/pdfgui/gui/errorreportdialog.py index b93cca76..308954c0 100644 --- a/src/diffpy/pdfgui/gui/errorreportdialog.py +++ b/src/diffpy/pdfgui/gui/errorreportdialog.py @@ -207,15 +207,18 @@ def _extractSearchTerms(tbtext): return rv -##### testing code ############################################################ +# testing code ############################################################ _EXAMPLE_TRACEBACK = r""" Traceback (most recent call last): - File "C:\DiffPy\Python25\lib\site-packages\diffpy.pdfgui-1.0_r3067_20090410-py2.5.egg\diffpy\pdfgui\gui\errorwrapper.py", line 60, in _f + File "C:\DiffPy\Python25\lib\site-packages\diffpy.pdfgui-1.0_r3067_20090410-py2.5.egg\ +diffpy\pdfgui\gui\errorwrapper.py", line 60, in _f return func(*args, **kwargs) - File "C:\DiffPy\Python25\lib\site-packages\diffpy.pdfgui-1.0_r3067_20090410-py2.5.egg\diffpy\pdfgui\gui\mainframe.py", line 2176, in onSave + File "C:\DiffPy\Python25\lib\site-packages\diffpy.pdfgui-1.0_r3067_20090410-py2.5.egg\ +diffpy\pdfgui\gui\mainframe.py", line 2176, in onSave self.control.save(self.fullpath) - File "C:\DiffPy\Python25\lib\site-packages\diffpy.pdfgui-1.0_r3067_20090410-py2.5.egg\diffpy\pdfgui\control\pdfguicontrol.py", line 507, in save + File "C:\DiffPy\Python25\lib\site-packages\diffpy.pdfgui-1.0_r3067_20090410-py2.5.egg\ +diffpy\pdfgui\control\pdfguicontrol.py", line 507, in save self.projfile = projfile.encode('ascii') UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 115: ordinal not in range(128) """.strip() @@ -242,4 +245,4 @@ def test(self): app = MyApp(0) app.MainLoop() -##### end of testing code ##################################################### +# end of testing code ##################################################### diff --git a/src/diffpy/pdfgui/gui/errorreportdialog_control_fix.py b/src/diffpy/pdfgui/gui/errorreportdialog_control_fix.py index 71e239ca..11a8681b 100644 --- a/src/diffpy/pdfgui/gui/errorreportdialog_control_fix.py +++ b/src/diffpy/pdfgui/gui/errorreportdialog_control_fix.py @@ -17,7 +17,6 @@ # generated by wxGlade 0.9.3 on Fri Jul 19 16:01:37 2019 import re -import webbrowser # # "Bug report" Dialog @@ -25,6 +24,8 @@ import wx import wx.html +from .errorreportdialog import ErrorReportDialog + # Constants ------------------------------------------------------------------ ISSUESTRACKER = "https://github.com/diffpy/diffpy.pdfgui/issues" @@ -77,7 +78,7 @@ def __do_layout(self): # begin wxGlade: ErrorReportDialog.__do_layout sizer_main = wx.BoxSizer(wx.VERTICAL) sizer_buttons = wx.BoxSizer(wx.HORIZONTAL) - sizer_log = wx.BoxSizer(wx.VERTICAL) + # sizer_log = wx.BoxSizer(wx.VERTICAL) sizer_label = wx.BoxSizer(wx.HORIZONTAL) sizer_label.Add(self.label_header, 1, wx.EXPAND, 5) sizer_main.Add(sizer_label, 1, wx.ALL | wx.EXPAND, 5) @@ -141,17 +142,21 @@ def _extractSearchTerms(tbtext): return rv -##### testing code ############################################################ +# testing code ############################################################ _EXAMPLE_TRACEBACK = r""" Traceback (most recent call last): - File "C:\DiffPy\Python25\lib\site-packages\diffpy.pdfgui-1.0_r3067_20090410-py2.5.egg\diffpy\pdfgui\gui\errorwrapper.py", line 60, in _f + File "C:\DiffPy\Python25\lib\site-packages\diffpy.pdfgui-1.0_r3067_20090410-py2.5.egg\ +\diffpy\pdfgui\gui\errorwrapper.py", line 60, in _f return func(*args, **kwargs) - File "C:\DiffPy\Python25\lib\site-packages\diffpy.pdfgui-1.0_r3067_20090410-py2.5.egg\diffpy\pdfgui\gui\mainframe.py", line 2176, in onSave + File "C:\DiffPy\Python25\lib\site-packages\diffpy.pdfgui-1.0_r3067_20090410-py2.5.egg\ +\diffpy\pdfgui\gui\mainframe.py", line 2176, in onSave self.control.save(self.fullpath) - File "C:\DiffPy\Python25\lib\site-packages\diffpy.pdfgui-1.0_r3067_20090410-py2.5.egg\diffpy\pdfgui\control\pdfguicontrol.py", line 507, in save + File "C:\DiffPy\Python25\lib\site-packages\diffpy.pdfgui-1.0_r3067_20090410-py2.5.egg\ +\diffpy\pdfgui\control\pdfguicontrol.py", line 507, in save self.projfile = projfile.encode('ascii') -UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 115: ordinal not in range(128) +UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 115: \ +ordinal not in range(128) """.strip() @@ -176,4 +181,4 @@ def test(self): app = MyApp(0) app.MainLoop() -##### end of testing code ##################################################### +# end of testing code ##################################################### diff --git a/src/diffpy/pdfgui/gui/extendedplotframe.py b/src/diffpy/pdfgui/gui/extendedplotframe.py index 848b54d6..297a7670 100644 --- a/src/diffpy/pdfgui/gui/extendedplotframe.py +++ b/src/diffpy/pdfgui/gui/extendedplotframe.py @@ -20,8 +20,6 @@ import os.path import matplotlib - -matplotlib.use("WXAgg") import wx from matplotlib.artist import setp from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas @@ -32,6 +30,8 @@ from diffpy.pdfgui.gui.pdfguiglobals import iconpath from diffpy.pdfgui.gui.wxextensions import wx12 +matplotlib.use("WXAgg") + DATA_SAVE_ID = wx12.NewIdRef() @@ -303,7 +303,7 @@ def __translateStyles(self, style): symbolSize = style["symbolSize"] symbolColor = colorDict.get(style["symbolColor"], "k") properties.update( - { #'linewidth':0.0, # doesn't affect any + { # 'linewidth':0.0, # doesn't affect any "markerfacecolor": symbolColor, "markeredgecolor": color, "marker": symbol, From 3d0643eebb1ec93d4add8d7ff6b814976cfcf92b Mon Sep 17 00:00:00 2001 From: Caden Myers <158210249+cadenmyers13@users.noreply.github.com> Date: Tue, 30 Jul 2024 22:13:28 -0400 Subject: [PATCH 08/24] Flake8v4 (#140) * capitalize Trustees * Exception on errorwrapper * wx.PyObjectError in except * ValueError and Exception * Exception * remove import --- src/diffpy/pdfgui/gui/aboutdialog.py | 4 ++-- src/diffpy/pdfgui/gui/errorwrapper.py | 2 +- src/diffpy/pdfgui/gui/fittree.py | 10 +++++----- src/diffpy/pdfgui/gui/phaseconfigurepanel.py | 2 +- src/diffpy/pdfgui/gui/phasepanelutils.py | 2 +- src/diffpy/pdfgui/gui/plotpanel.py | 3 +-- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/diffpy/pdfgui/gui/aboutdialog.py b/src/diffpy/pdfgui/gui/aboutdialog.py index 2cd47a5e..51012e01 100644 --- a/src/diffpy/pdfgui/gui/aboutdialog.py +++ b/src/diffpy/pdfgui/gui/aboutdialog.py @@ -3,8 +3,8 @@ # # PDFgui by DANSE Diffraction group # Simon J. L. Billinge -# (c) 2006 trustees of the Michigan State University. -# (c) 2024 trustees of the Columbia University in the City +# (c) 2006 Trustees of the Michigan State University. +# (c) 2024 Trustees of the Columbia University in the City # of New York # All rights reserved. # diff --git a/src/diffpy/pdfgui/gui/errorwrapper.py b/src/diffpy/pdfgui/gui/errorwrapper.py index a45a55fc..de99d93b 100644 --- a/src/diffpy/pdfgui/gui/errorwrapper.py +++ b/src/diffpy/pdfgui/gui/errorwrapper.py @@ -75,7 +75,7 @@ def _f(*args, **kwargs): return rvpass # Everything else - except: + except Exception: if pdfguiglobals.dbopts.pythondebugger: import pdb diff --git a/src/diffpy/pdfgui/gui/fittree.py b/src/diffpy/pdfgui/gui/fittree.py index 886a6e61..250656e3 100644 --- a/src/diffpy/pdfgui/gui/fittree.py +++ b/src/diffpy/pdfgui/gui/fittree.py @@ -356,7 +356,7 @@ def AddFit(self, fitname="Fit 1", cdata=None, paste=False): cdata = self.control.paste(cdata, None, fitname, pos) self.SetControlData(newfit, cdata) return newfit - except: + except Exception: self.Delete(newfit) raise return @@ -427,7 +427,7 @@ def AddPhase(self, node, label, insertafter=None, filename=None, makedata=True, elif cdata is not None: self.control.paste(cdata, pdata, label, pos) return newphase - except: + except Exception: self.Delete(newphase) raise return @@ -492,7 +492,7 @@ def AddDataSet(self, node, label, insertafter=None, filename=None, makedata=True elif cdata is not None: self.control.paste(cdata, pdata, label, pos) return newset - except: + except Exception: self.Delete(newset) raise return @@ -553,7 +553,7 @@ def AddCalc(self, node, label, insertafter=None, makedata=True, cdata=None): elif cdata is not None: self.control.paste(cdata, pdata, label, pos) return newcalc - except: + except Exception: self.Delete(newcalc) raise return @@ -611,7 +611,7 @@ def GetClipboard(self): if cdatabytes[:16] == "pdfgui_cliboard=".encode(): cdatabytes = cdatabytes[16:] cdata = pickle_loads(cdatabytes) - except: + except Exception: pass return cdata diff --git a/src/diffpy/pdfgui/gui/phaseconfigurepanel.py b/src/diffpy/pdfgui/gui/phaseconfigurepanel.py index 48bdaadd..5f294162 100644 --- a/src/diffpy/pdfgui/gui/phaseconfigurepanel.py +++ b/src/diffpy/pdfgui/gui/phaseconfigurepanel.py @@ -393,7 +393,7 @@ def applyTextCtrlChange(self, id, value): return value - except: + except Exception: return None def applyCellChange(self, i, j, value): diff --git a/src/diffpy/pdfgui/gui/phasepanelutils.py b/src/diffpy/pdfgui/gui/phasepanelutils.py index 6b4d03af..8459294e 100644 --- a/src/diffpy/pdfgui/gui/phasepanelutils.py +++ b/src/diffpy/pdfgui/gui/phasepanelutils.py @@ -234,7 +234,7 @@ def canPasteIntoCells(panel): # Strip any trailing tabs rowlist = [r.rstrip("\t") for r in rowlist] celllist = [r.split("\t") for r in rowlist] - except: + except wx.PyDeadObjectError: return False if len(celllist) == 0: diff --git a/src/diffpy/pdfgui/gui/plotpanel.py b/src/diffpy/pdfgui/gui/plotpanel.py index 241f4b48..8aaaec39 100644 --- a/src/diffpy/pdfgui/gui/plotpanel.py +++ b/src/diffpy/pdfgui/gui/plotpanel.py @@ -16,7 +16,6 @@ # generated by wxGlade 0.9.3 on Fri Jul 19 16:05:24 2019 -import sys import wx @@ -167,7 +166,7 @@ def _represent(mixedNames): xvals = _represent(xdata) try: xvals.remove("rw") - except: + except ValueError: pass numericStringSort(xvals) From 686390a898311f452a4a04bb20140e4c0ed24168 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Wed, 31 Jul 2024 06:25:20 -0400 Subject: [PATCH 09/24] pre-commit errors in comments (#141) --- .coveragerc | 8 ++++---- src/diffpy/pdfgui/gui/bondangledialog.py | 6 +++--- src/diffpy/pdfgui/gui/parameterspanel.py | 2 +- src/diffpy/pdfgui/gui/phaseconfigurepanel.py | 8 ++++---- src/diffpy/pdfgui/gui/phaseconstraintspanel.py | 16 ++++++++-------- src/diffpy/pdfgui/gui/phaseresultspanel.py | 2 +- src/diffpy/pdfgui/gui/rseriespanel.py | 4 ++-- src/diffpy/pdfgui/gui/sgconstraindialog.py | 4 ++-- src/diffpy/pdfgui/gui/sgstructuredialog.py | 4 ++-- src/diffpy/pdfgui/gui/supercelldialog.py | 2 +- src/diffpy/pdfgui/gui/temperatureseriespanel.py | 15 +++++++-------- 11 files changed, 35 insertions(+), 36 deletions(-) diff --git a/.coveragerc b/.coveragerc index d0a0d16d..63f0ec9c 100644 --- a/.coveragerc +++ b/.coveragerc @@ -3,14 +3,14 @@ [report] # RE patterns for lines to be excluded from consideration. exclude_lines = - ## Have to re-enable the standard pragma + # Have to re-enable the standard pragma pragma: no cover - ## Don't complain if tests don't hit defensive assertion code: + # Don't complain if tests don't hit defensive assertion code: raise AssertionError raise NotImplementedError ^[ ]*assert False - ## Don't complain if non-runnable code isn't run: + # Don't complain if non-runnable code isn't run: ^[ ]*@unittest.skip\b ^[ ]{4}unittest.main() if __name__ == .__main__.: @@ -18,5 +18,5 @@ exclude_lines = [run] omit = - ## exclude debug.py from codecov report + # exclude debug.py from codecov report */tests/debug.py diff --git a/src/diffpy/pdfgui/gui/bondangledialog.py b/src/diffpy/pdfgui/gui/bondangledialog.py index c7b05aeb..a58c8df4 100644 --- a/src/diffpy/pdfgui/gui/bondangledialog.py +++ b/src/diffpy/pdfgui/gui/bondangledialog.py @@ -79,7 +79,7 @@ def __do_layout(self): self.Layout() # end wxGlade - ########################################################################### + # ######################################################################### def __customProperties(self): """Set the custom properties.""" @@ -138,8 +138,8 @@ def onSpin(self, event): loop = True while loop: loop = False - for l in letters: - if newval == getattr(self, l): + for letter in letters: + if newval == getattr(self, letter): loop = True if increasing: newval += 1 diff --git a/src/diffpy/pdfgui/gui/parameterspanel.py b/src/diffpy/pdfgui/gui/parameterspanel.py index ff043ff5..e00c76e8 100644 --- a/src/diffpy/pdfgui/gui/parameterspanel.py +++ b/src/diffpy/pdfgui/gui/parameterspanel.py @@ -98,7 +98,7 @@ def __do_layout(self): self.Layout() # end wxGlade - ########################################################################## + # ######################################################################## # Misc Methods def __customProperties(self): diff --git a/src/diffpy/pdfgui/gui/phaseconfigurepanel.py b/src/diffpy/pdfgui/gui/phaseconfigurepanel.py index 5f294162..d5d44ed4 100644 --- a/src/diffpy/pdfgui/gui/phaseconfigurepanel.py +++ b/src/diffpy/pdfgui/gui/phaseconfigurepanel.py @@ -221,7 +221,7 @@ def __init__(self, *args, **kwds): # end wxGlade self.__customProperties() - ########################################################################## + # ######################################################################## # Misc Methods def __customProperties(self): @@ -319,7 +319,7 @@ def restrictConstrainedParameters(self): """Set 'read-only' boxes that correspond to constrained parameters.""" self.setToolTips(tooltips.phasepanel) - txtbg = self.textCtrlA.DefaultStyle.BackgroundColour + self.textCtrlA.DefaultStyle.BackgroundColour # First the TextCtrls for key, var in self.lConstraintsMap.items(): @@ -447,7 +447,7 @@ def applyCellChange(self, i, j, value): except ValueError: return - ########################################################################## + # ######################################################################## # Event Handlers # TextCtrl Events @@ -629,7 +629,7 @@ def onKey(self, event): return - ########################################################################## + # ######################################################################## # Grid popup menu and handlers def popupMenu(self, window, x, y): diff --git a/src/diffpy/pdfgui/gui/phaseconstraintspanel.py b/src/diffpy/pdfgui/gui/phaseconstraintspanel.py index 352e92ea..0506b9c6 100644 --- a/src/diffpy/pdfgui/gui/phaseconstraintspanel.py +++ b/src/diffpy/pdfgui/gui/phaseconstraintspanel.py @@ -210,7 +210,7 @@ def __init__(self, *args, **kwds): # end wxGlade self.__customProperties() - ########################################################################## + # ######################################################################## # Misc Methods def __customProperties(self): @@ -314,7 +314,7 @@ def refresh(self): self.refreshTextCtrls() - ### update the grid ### + # # update the grid ### natoms = len(self.structure) nrows = self.gridAtoms.GetNumberRows() self.gridAtoms.BeginBatch() @@ -339,7 +339,7 @@ def refresh(self): if not m: continue barevar = m.group(1) - if not barevar in bareAtomVarColumn: + if barevar not in bareAtomVarColumn: continue column = bareAtomVarColumn[barevar] row = int(m.group(2)) - 1 @@ -348,7 +348,7 @@ def refresh(self): raise ControlValueError(emsg) self.gridAtoms.SetCellValue(row, column, con.formula) barevar = re.sub(r"\(\d+\)$", "", var) - if not barevar in bareAtomVarColumn: + if barevar not in bareAtomVarColumn: continue self.gridAtoms.AutosizeLabels() @@ -411,7 +411,7 @@ def applyCellChange(self, i, j, value): return "" return - ########################################################################## + # ######################################################################## # Event Handlers # TextCtrl Events @@ -554,12 +554,12 @@ def onKey(self, event): self.mainFrame.needsSave() # Can't get these to work. Maybe later. - ## Copy - Ctrl+C / Ctrl+Insert + # Copy - Ctrl+C / Ctrl+Insert # if event.ControlDown() and (key == 67 or key == wx.WXK_INSERT): # if phasepanelutils.canCopySelectedCells(self): # phasepanelutils.copySelectedCells(self) - ## Paste - Ctrl+V / Shift+Insert + # Paste - Ctrl+V / Shift+Insert # if (event.ControlDown() and key == 86) or\ # (event.ShiftDown() and key == wx.WXK_INSERT): # if phasepanelutils.canPasteIntoCells(self): @@ -569,7 +569,7 @@ def onKey(self, event): event.Skip() return - ########################################################################## + # ######################################################################## # Grid popup menu and handlers def popupMenu(self, window, x, y): diff --git a/src/diffpy/pdfgui/gui/phaseresultspanel.py b/src/diffpy/pdfgui/gui/phaseresultspanel.py index cf806767..5b063994 100644 --- a/src/diffpy/pdfgui/gui/phaseresultspanel.py +++ b/src/diffpy/pdfgui/gui/phaseresultspanel.py @@ -198,7 +198,7 @@ def __init__(self, *args, **kwds): self.__customProperties() return - ########################################################################## + # ######################################################################## # Misc Methods def __customProperties(self): diff --git a/src/diffpy/pdfgui/gui/rseriespanel.py b/src/diffpy/pdfgui/gui/rseriespanel.py index c1afe397..5c733d2c 100644 --- a/src/diffpy/pdfgui/gui/rseriespanel.py +++ b/src/diffpy/pdfgui/gui/rseriespanel.py @@ -32,7 +32,7 @@ def __init__(self, *args, **kwds): self.instructionsLabel = wx.StaticText( self, wx.ID_ANY, - "Select a fit from the tree on the left and set the first value, last value, \nand the step size of the maximum and/or minimum of the fit range\nbelow. If you have not set up a fit to be the template for the series, hit\ncancel and rerun this macro once a fit has been created.", + "Select a fit from the tree on the left and set the first value, last value, \nand the step size of the maximum and/or minimum of the fit range\nbelow. If you have not set up a fit to be the template for the series, hit\ncancel and rerun this macro once a fit has been created.", # noqa: E501 ) self.maxFirstLabel = wx.StaticText(self, wx.ID_ANY, "first") self.maxFirstTextCtrl = wx.TextCtrl(self, wx.ID_ANY, "") @@ -101,7 +101,7 @@ def __do_layout(self): self.Layout() # end wxGlade - ################################################## + # ################################################ def __customProperties(self): """Set the custom properties of this panel.""" self.fit = None diff --git a/src/diffpy/pdfgui/gui/sgconstraindialog.py b/src/diffpy/pdfgui/gui/sgconstraindialog.py index 1d9bb606..5c8ecbc3 100644 --- a/src/diffpy/pdfgui/gui/sgconstraindialog.py +++ b/src/diffpy/pdfgui/gui/sgconstraindialog.py @@ -101,7 +101,7 @@ def __init__(self, *args, **kwds): # end wxGlade self.__customProperties() - ########################################################################### + # ######################################################################### def __customProperties(self): """Set the custom properties.""" @@ -204,7 +204,7 @@ def updateWidgets(self): raise ControlValueError(error) return - ### Events + # # Events def onKillFocus(self, event): """Check value of widgets and update the dialog message.""" diff --git a/src/diffpy/pdfgui/gui/sgstructuredialog.py b/src/diffpy/pdfgui/gui/sgstructuredialog.py index f8a6336f..7819579a 100644 --- a/src/diffpy/pdfgui/gui/sgstructuredialog.py +++ b/src/diffpy/pdfgui/gui/sgstructuredialog.py @@ -91,7 +91,7 @@ def __init__(self, *args, **kwds): # end wxGlade self.__customProperties() - ########################################################################### + # ######################################################################### def __customProperties(self): """Set the custom properties.""" @@ -195,7 +195,7 @@ def updateWidgets(self): raise ControlValueError(error) return - ### Events + # # Events def onKillFocus(self, event): """Check value of widgets and update the dialog message.""" self.updateWidgets() diff --git a/src/diffpy/pdfgui/gui/supercelldialog.py b/src/diffpy/pdfgui/gui/supercelldialog.py index 8070a82c..2e34b2c7 100644 --- a/src/diffpy/pdfgui/gui/supercelldialog.py +++ b/src/diffpy/pdfgui/gui/supercelldialog.py @@ -74,7 +74,7 @@ def __do_layout(self): self.Layout() # end wxGlade - ############################################################################ + # ########################################################################## def __customProperties(self): """Set custom properties.""" diff --git a/src/diffpy/pdfgui/gui/temperatureseriespanel.py b/src/diffpy/pdfgui/gui/temperatureseriespanel.py index d1cc6ae1..66956fc2 100644 --- a/src/diffpy/pdfgui/gui/temperatureseriespanel.py +++ b/src/diffpy/pdfgui/gui/temperatureseriespanel.py @@ -18,7 +18,6 @@ import os.path import re -import sys import wx @@ -41,7 +40,7 @@ def __init__(self, *args, **kwds): self.instructionsLabel = wx.StaticText( self, wx.ID_ANY, - "Select a fit from the tree on the left then add datasets and assign\ntemperatues below. If you have not set up a fit to be the template\nfor the series, hit cancel and rerun this macro once a fit has been\ncreated.", + "Select a fit from the tree on the left then add datasets and assign\ntemperatues below. If you have not set up a fit to be the template\nfor the series, hit cancel and rerun this macro once a fit has been\ncreated.", # noqa: E501 ) self.instructionsLabel.SetFont( wx.Font( @@ -201,7 +200,7 @@ def onAdd(self, event): # wxGlade: TemperatureSeriesPanel. if not dir: dir = self.mainFrame.workpath - matchstring = "PDF data files (*.gr)|*.gr|PDF fit files (*.fgr)|*.fgr|PDF fit files (*.fit)|*.fit|PDF calculation files (*.cgr)|*.cgr|PDF calculation files (*.calc)|*.calc|All Files|*" + matchstring = "PDF data files (*.gr)|*.gr|PDF fit files (*.fgr)|*.fgr|PDF fit files (*.fit)|*.fit|PDF calculation files (*.cgr)|*.cgr|PDF calculation files (*.calc)|*.calc|All Files|*" # noqa: E501 d = wx.FileDialog( None, "Choose files", @@ -293,13 +292,13 @@ def onColClick(self, event): # wxGlade: TemperatureSeriesPanel. column = event.GetColumn() # sort by temperature if column == 0: - sortkey = lambda tf: float(tf[0]) + sortkey = lambda tf: float(tf[0]) # noqa: E731 # sort by filename with numerical comparison of digits elif column == 1: filenames = [f for t, f in self.datasets] numericStringSort(filenames) order = dict(zip(filenames, range(len(filenames)))) - sortkey = lambda tf: order[tf[1]] + sortkey = lambda tf: order[tf[1]] # noqa: E731 # ignore unhandled columns else: return @@ -308,7 +307,7 @@ def onColClick(self, event): # wxGlade: TemperatureSeriesPanel. self.fillList() return - ## Utility functions + # Utility functions def fillList(self): """Fill the list with the datasets.""" self.listCtrlFiles.DeleteAllItems() @@ -325,7 +324,7 @@ def fillList(self): self.listCtrlFiles.SetItem(index, 1, shortname) return - ## Needed by mainframe + # Needed by mainframe def treeSelectionUpdate(self, node): """Set the current fit when the tree selection changes.""" nodetype = self.treeCtrlMain.GetNodeType(node) @@ -334,7 +333,7 @@ def treeSelectionUpdate(self, node): self.refresh() return - ## Required by PDFPanel + # Required by PDFPanel def refresh(self): """Block out OK button if there is no fit. From 33091d18209d16e13f6b61bff06533be499ff5d3 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Wed, 31 Jul 2024 06:30:11 -0400 Subject: [PATCH 10/24] wx12 and bonlengthdialog (#142) * wx12 and bonlengthdialog * devutils/makedist import order --- devutils/makesdist | 4 ++-- src/diffpy/pdfgui/gui/bondlengthdialog.py | 4 ++-- src/diffpy/pdfgui/gui/wxextensions/wx12.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/devutils/makesdist b/devutils/makesdist index e77257ea..dccfaa99 100755 --- a/devutils/makesdist +++ b/devutils/makesdist @@ -11,11 +11,11 @@ import subprocess import sys import tarfile +from setup import FALLBACK_VERSION, versiondata + BASEDIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) sys.path.insert(0, BASEDIR) -from setup import FALLBACK_VERSION, versiondata - timestamp = versiondata.getint("DEFAULT", "timestamp") vfb = versiondata.get("DEFAULT", "version").split(".post")[0] + ".post0" diff --git a/src/diffpy/pdfgui/gui/bondlengthdialog.py b/src/diffpy/pdfgui/gui/bondlengthdialog.py index e23ec5c5..7624009a 100644 --- a/src/diffpy/pdfgui/gui/bondlengthdialog.py +++ b/src/diffpy/pdfgui/gui/bondlengthdialog.py @@ -219,8 +219,8 @@ def onSpin(self, event): # wxGlade: BondLengthDialog. loop = True while loop: loop = False - for l in letters: - if newval == getattr(self, l): + for letter in letters: + if newval == getattr(self, letter): loop = True if increasing: newval += 1 diff --git a/src/diffpy/pdfgui/gui/wxextensions/wx12.py b/src/diffpy/pdfgui/gui/wxextensions/wx12.py index 17a3f938..45552de0 100644 --- a/src/diffpy/pdfgui/gui/wxextensions/wx12.py +++ b/src/diffpy/pdfgui/gui/wxextensions/wx12.py @@ -46,7 +46,7 @@ def Append(self, *args, **kwargs): if WX4: - Menu = wx.Menu + Menu = wx.Menu # noqa: F811 # ---------------------------------------------------------------------------- @@ -58,7 +58,7 @@ class ListCtrl(wx.ListCtrl): if WX4: - ListCtrl = wx.ListCtrl + ListCtrl = wx.ListCtrl # noqa: F811 # ---------------------------------------------------------------------------- @@ -70,7 +70,7 @@ class TreeCtrl(wx.TreeCtrl): if WX4: - TreeCtrl = wx.TreeCtrl + TreeCtrl = wx.TreeCtrl # noqa: F811 # wx.ToolBar ----------------------------------------------------------------- From ffda1a2ae00db29b7833998ba5d8c996b1124ea3 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Wed, 31 Jul 2024 06:34:16 -0400 Subject: [PATCH 11/24] news (#143) --- news/linting.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/linting.rst diff --git a/news/linting.rst b/news/linting.rst new file mode 100644 index 00000000..0a9638dc --- /dev/null +++ b/news/linting.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Code linted up to PEP8 and group standards + +**Security:** + +* From 4b3f53f9f6d6f7391a2d927856320cf914589636 Mon Sep 17 00:00:00 2001 From: Caden Myers <158210249+cadenmyers13@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:00:53 -0400 Subject: [PATCH 12/24] cookiecutter: untracked files (#149) * untracked files * [pre-commit.ci] auto fixes from pre-commit hooks * update LICENSE.rst * update AUTHORS.rst and remove AUTHORS.txt * tipping our hat * Remove BSD 3-Clause, leaving Columbia copyright * remove README from requirements * replace requirements * adding wxpython back * adding back freezegun --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Simon Billinge --- .isort.cfg | 4 + AUTHORS.txt => AUTHORS.rst | 35 +++-- CODE_OF_CONDUCT.rst | 133 ++++++++++++++++++ LICENSE.txt => LICENSE.rst | 48 +++---- requirements/build.txt | 2 + requirements/docs.txt | 4 + requirements/pip.txt | 0 requirements/run.txt | 10 +- requirements/test.txt | 6 +- src/diffpy/pdfgui/control/calculation.py | 11 +- src/diffpy/pdfgui/control/fitting.py | 6 +- src/diffpy/pdfgui/control/pdfguicontrol.py | 6 +- src/diffpy/pdfgui/tests/conftest.py | 19 +++ .../pdfgui/tests/testphaseconfigurepanel.py | 8 +- 14 files changed, 222 insertions(+), 70 deletions(-) create mode 100644 .isort.cfg rename AUTHORS.txt => AUTHORS.rst (81%) create mode 100644 CODE_OF_CONDUCT.rst rename LICENSE.txt => LICENSE.rst (64%) create mode 100644 requirements/build.txt create mode 100644 requirements/docs.txt create mode 100644 requirements/pip.txt create mode 100644 src/diffpy/pdfgui/tests/conftest.py diff --git a/.isort.cfg b/.isort.cfg new file mode 100644 index 00000000..e0926f42 --- /dev/null +++ b/.isort.cfg @@ -0,0 +1,4 @@ +[settings] +line_length = 115 +multi_line_output = 3 +include_trailing_comma = True diff --git a/AUTHORS.txt b/AUTHORS.rst similarity index 81% rename from AUTHORS.txt rename to AUTHORS.rst index a6b9bc57..c942b8dd 100644 --- a/AUTHORS.txt +++ b/AUTHORS.rst @@ -1,3 +1,16 @@ +Authors +======= + +DiffPy was initiated as part of the Distributed Data Analysis of Neutron +Scattering Experiments (DANSE) project, funded by the National Science +Foundation under grant DMR-0520547. More information on DANSE can be +found at http://danse.us. Any opinions, findings, and conclusions or +recommendations expressed in this material are those of the author(s) +and do not necessarily reflect the views of the NSF. + +Main Contributors +----------------- + This code was developed as part of the DiffPy project to create python modules for structure investigations from diffraction data. The main contributors to this package were @@ -7,18 +20,19 @@ contributors to this package were Pavol Juhas Dmitriy Bryndin -The DiffPy team is located in the Billinge-group at the Applied Physics -and Applied Mathematics Department of the Columbia University in New York. -Currently the team consists of +Other current and former contributors of the DiffPy project include Simon Billinge - Pavol Juhas Chris Farrow Emil Bozin Wenduo Zhou Peng Tian - Timur Dykhne +The DiffPy team is part of the Billinge Group at Columbia University in New York, +within the Department of Applied Physics and Applied Mathematics. + +Contributors +------------ Please see the header of each source file for a detailed list of contributors. This is an open-source project and we hope and expect that the list of contributors will expand with time. Many thanks to @@ -26,14 +40,11 @@ all current and future contributors! For more information on the DiffPy project email sb2896@columbia.edu -DiffPy was initiated as part of the Distributed Data Analysis of Neutron -Scattering Experiments (DANSE) project, funded by the National Science -Foundation under grant DMR-0520547. More information on DANSE can be -found at http://danse.us. Any opinions, findings, and conclusions or -recommendations expressed in this material are those of the author(s) -and do not necessarily reflect the views of the NSF. +For a list of contributors, visit +https://github.com/diffpy/diffpy.pdfgui/graphs/contributors -Acknowledgments: +Acknowledgments +--------------- We are truly grateful to all the people who have contributed, in all different ways, to this project: Thomas Proffen, Xiangyun Qiu, Pete diff --git a/CODE_OF_CONDUCT.rst b/CODE_OF_CONDUCT.rst new file mode 100644 index 00000000..ff9c3561 --- /dev/null +++ b/CODE_OF_CONDUCT.rst @@ -0,0 +1,133 @@ +===================================== + Contributor Covenant Code of Conduct +===================================== + +Our Pledge +---------- + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +Our Standards +------------- + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +Enforcement Responsibilities +---------------------------- + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +Scope +----- + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official email address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +Enforcement +----------- + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +sb2896@columbia.edu. All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +Enforcement Guidelines +---------------------- + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +1. Correction +**************** + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +2. Warning +************* + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +3. Temporary Ban +****************** + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +4. Permanent Ban +****************** + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +Attribution +----------- + +This Code of Conduct is adapted from the `Contributor Covenant `_. + +Community Impact Guidelines were inspired by `Mozilla's code of conduct enforcement ladder `_. + +For answers to common questions about this code of conduct, see the `FAQ `_. `Translations are available `_ diff --git a/LICENSE.txt b/LICENSE.rst similarity index 64% rename from LICENSE.txt rename to LICENSE.rst index f451dcb7..0cebd08f 100644 --- a/LICENSE.txt +++ b/LICENSE.rst @@ -1,3 +1,7 @@ +Copyright (c) 2024, The Trustees of Columbia University +in the City of New York. +All rights reserved. + This software was originally developed by the Billinge group as part of the Distributed Data Analysis of Neutron Scattering Experiments (DANSE) project funded by the US National Science Foundation under @@ -47,32 +51,26 @@ For more information please visit the project web-page: or email Prof. Simon Billinge at sb2896@columbia.edu Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: +modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. - * Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER "AS IS". COPYRIGHT HOLDER -EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES AND CONDITIONS, EITHER -EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY, TITLE, FITNESS, ADEQUACY OR SUITABILITY -FOR A PARTICULAR PURPOSE, AND ANY WARRANTIES OF FREEDOM FROM -INFRINGEMENT OF ANY DOMESTIC OR FOREIGN PATENT, COPYRIGHTS, TRADE -SECRETS OR OTHER PROPRIETARY RIGHTS OF ANY PARTY. IN NO EVENT SHALL -COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE OR RELATING TO THIS AGREEMENT, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/requirements/build.txt b/requirements/build.txt new file mode 100644 index 00000000..f72d870d --- /dev/null +++ b/requirements/build.txt @@ -0,0 +1,2 @@ +python +setuptools diff --git a/requirements/docs.txt b/requirements/docs.txt new file mode 100644 index 00000000..ab17b1c8 --- /dev/null +++ b/requirements/docs.txt @@ -0,0 +1,4 @@ +sphinx +sphinx_rtd_theme +doctr +m2r diff --git a/requirements/pip.txt b/requirements/pip.txt new file mode 100644 index 00000000..e69de29b diff --git a/requirements/run.txt b/requirements/run.txt index 40bce3f0..1bad6988 100644 --- a/requirements/run.txt +++ b/requirements/run.txt @@ -1,5 +1,5 @@ -numpy==1.26 -wxpython -diffpy.pdffit2 -diffpy.utils -matplotlib-base +numpy==1.26 +wxpython +diffpy.pdffit2 +diffpy.utils +matplotlib-base diff --git a/requirements/test.txt b/requirements/test.txt index 628a048a..977a5764 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,4 +1,6 @@ -pytest +flake8 freezegun -coverage +pytest codecov +coverage +pytest-env diff --git a/src/diffpy/pdfgui/control/calculation.py b/src/diffpy/pdfgui/control/calculation.py index 2cab84a3..13819b81 100644 --- a/src/diffpy/pdfgui/control/calculation.py +++ b/src/diffpy/pdfgui/control/calculation.py @@ -19,11 +19,7 @@ import copy import math -from diffpy.pdfgui.control.controlerrors import ( - ControlConfigError, - ControlKeyError, - ControlValueError, -) +from diffpy.pdfgui.control.controlerrors import ControlConfigError, ControlKeyError, ControlValueError from diffpy.pdfgui.control.pdfcomponent import PDFComponent from diffpy.pdfgui.utils import pickle_loads, safeCPickleDumps @@ -124,10 +120,7 @@ def setRGrid(self, rmin=None, rstep=None, rmax=None): def start(self): """entry function for calculation""" - from diffpy.pdfgui.control.fitting import ( - getEngineExceptions, - handleEngineException, - ) + from diffpy.pdfgui.control.fitting import getEngineExceptions, handleEngineException try: self.calculate() diff --git a/src/diffpy/pdfgui/control/fitting.py b/src/diffpy/pdfgui/control/fitting.py index 8e24aed5..0d56df89 100644 --- a/src/diffpy/pdfgui/control/fitting.py +++ b/src/diffpy/pdfgui/control/fitting.py @@ -18,11 +18,7 @@ import threading import time -from diffpy.pdfgui.control.controlerrors import ( - ControlError, - ControlStatusError, - ControlValueError, -) +from diffpy.pdfgui.control.controlerrors import ControlError, ControlStatusError, ControlValueError from diffpy.pdfgui.control.organizer import Organizer from diffpy.pdfgui.utils import pickle_loads, safeCPickleDumps diff --git a/src/diffpy/pdfgui/control/pdfguicontrol.py b/src/diffpy/pdfgui/control/pdfguicontrol.py index 15632a0d..c6619417 100644 --- a/src/diffpy/pdfgui/control/pdfguicontrol.py +++ b/src/diffpy/pdfgui/control/pdfguicontrol.py @@ -24,11 +24,7 @@ import six.moves.cPickle as pickle from diffpy.pdfgui.control.calculation import Calculation -from diffpy.pdfgui.control.controlerrors import ( - ControlError, - ControlFileError, - ControlTypeError, -) +from diffpy.pdfgui.control.controlerrors import ControlError, ControlFileError, ControlTypeError from diffpy.pdfgui.control.fitdataset import FitDataSet from diffpy.pdfgui.control.fitstructure import FitStructure from diffpy.pdfgui.control.fitting import Fitting diff --git a/src/diffpy/pdfgui/tests/conftest.py b/src/diffpy/pdfgui/tests/conftest.py new file mode 100644 index 00000000..e3b63139 --- /dev/null +++ b/src/diffpy/pdfgui/tests/conftest.py @@ -0,0 +1,19 @@ +import json +from pathlib import Path + +import pytest + + +@pytest.fixture +def user_filesystem(tmp_path): + base_dir = Path(tmp_path) + home_dir = base_dir / "home_dir" + home_dir.mkdir(parents=True, exist_ok=True) + cwd_dir = base_dir / "cwd_dir" + cwd_dir.mkdir(parents=True, exist_ok=True) + + home_config_data = {"username": "home_username", "email": "home@email.com"} + with open(home_dir / "diffpyconfig.json", "w") as f: + json.dump(home_config_data, f) + + yield tmp_path diff --git a/src/diffpy/pdfgui/tests/testphaseconfigurepanel.py b/src/diffpy/pdfgui/tests/testphaseconfigurepanel.py index 5f41f64e..acc01ec6 100644 --- a/src/diffpy/pdfgui/tests/testphaseconfigurepanel.py +++ b/src/diffpy/pdfgui/tests/testphaseconfigurepanel.py @@ -23,13 +23,7 @@ from diffpy.pdfgui.gui.mainframe import MainFrame from diffpy.pdfgui.gui.phaseconfigurepanel import PhaseConfigurePanel -from diffpy.pdfgui.tests.testutils import ( - GUITestCase, - clickcell, - datafile, - overrideclipboard, - tooltiptext, -) +from diffpy.pdfgui.tests.testutils import GUITestCase, clickcell, datafile, overrideclipboard, tooltiptext # ---------------------------------------------------------------------------- From d65d1eefa64ca7e60b8d12b337c93974087ba744 Mon Sep 17 00:00:00 2001 From: Caden Myers <158210249+cadenmyers13@users.noreply.github.com> Date: Thu, 8 Aug 2024 12:59:07 -0400 Subject: [PATCH 13/24] Files in doc directory (#157) * move images to _static * move files in .../doc/manual into doc/source * move .gitignore file * move rest of files to doc/ * move makefile from doc/source to doc/ * remove Makefile from doc/source * update Makefile in doc * add rest of cookiecutter files into doc/source * add make.bat file * moving .py files into doc/manual * move files into manual * moving images into manual * add TUTORIAL.rst * convert .txt to .rst in TUTORIAL * fix formating * formating * formating * reference formating * move TUTORIAL.rst to manual * move tutorial.rst from manual to source * rm extra tutorial.rst * add tutorial section to index.rst * index.rst formating --- doc/Makefile | 194 ++++++++++++ doc/TUTORIAL.rst | 148 +++++++++ .../diffpy/pdfgui/doc => doc}/epydoc/Makefile | 0 .../pdfgui/doc => doc}/epydoc/epydoc.cfg | 0 doc/make.bat | 36 +++ .../pdfgui/doc => doc}/manual/.gitignore | 0 .../doc => doc/manual}/Farrow-jpcm-2007.pdf | Bin .../doc => doc/manual}/Proffen-jac-1999.pdf | Bin .../manual/acknowledgements.texinfo | 0 .../doc => doc}/manual/disclaimer.texinfo | 0 .../doc => doc}/manual/extractEquations.py | 0 .../pdfgui/doc => doc}/manual/fixHTMLCode.py | 0 .../pdfgui/doc => doc}/manual/images/Makefile | 0 .../doc => doc}/manual/images/eq-01.png | Bin .../doc => doc}/manual/images/eq-02.png | Bin .../doc => doc}/manual/images/fig2-01.png | Bin .../doc => doc}/manual/images/fig2-02.png | Bin .../doc => doc}/manual/images/fig2-03.png | Bin .../doc => doc}/manual/images/fig2-04.png | Bin .../doc => doc}/manual/images/fig2-05.png | Bin .../doc => doc}/manual/images/fig2-06.png | Bin .../doc => doc}/manual/images/fig2-07.png | Bin .../doc => doc}/manual/images/fig2-08.png | Bin .../doc => doc}/manual/images/fig2-09.png | Bin .../doc => doc}/manual/images/fig2-10.png | Bin .../doc => doc}/manual/images/fig2-11.png | Bin .../doc => doc}/manual/images/fig3-01.png | Bin .../doc => doc}/manual/images/fig3-02.png | Bin .../doc => doc}/manual/images/fig3-03.png | Bin .../doc => doc}/manual/images/fig3-04.png | Bin .../doc => doc}/manual/images/fig3-05.png | Bin .../doc => doc}/manual/images/fig3-06.png | Bin .../doc => doc}/manual/images/fig3-07.png | Bin .../doc => doc}/manual/images/fig3-08.png | Bin .../doc => doc}/manual/images/fig3-09.png | Bin .../doc => doc}/manual/images/fig3-10.png | Bin .../doc => doc}/manual/images/fig4-01.png | Bin .../doc => doc}/manual/images/fig4-02.png | Bin .../manual/images/originals/fig2-01.png | Bin .../manual/images/originals/fig2-01.xcf | Bin .../manual/images/originals/fig2-02.png | Bin .../manual/images/originals/fig2-03.png | Bin .../manual/images/originals/fig2-04.png | Bin .../manual/images/originals/fig2-05.png | Bin .../manual/images/originals/fig2-06.png | Bin .../manual/images/originals/fig2-07.png | Bin .../manual/images/originals/fig2-08.png | Bin .../manual/images/originals/fig2-09.png | Bin .../manual/images/originals/fig2-10.png | Bin .../manual/images/originals/fig2-11.png | Bin .../manual/images/originals/fig3-01.png | Bin .../manual/images/originals/fig3-02.png | Bin .../manual/images/originals/fig3-03.png | Bin .../manual/images/originals/fig3-04.png | Bin .../manual/images/originals/fig3-05.png | Bin .../manual/images/originals/fig3-06.png | Bin .../manual/images/originals/fig3-07.png | Bin .../manual/images/originals/fig3-08.png | Bin .../manual/images/originals/fig3-09.png | Bin .../manual/images/originals/fig3-10.png | Bin .../manual/images/originals/fig4-01.png | Bin .../manual/images/originals/fig4-02.png | Bin .../pdfgui/doc => doc}/manual/pdfgui.html | 0 .../pdfgui/doc => doc}/manual/pdfgui.pdf | Bin .../pdfgui/doc => doc}/manual/pdfgui.texinfo | 0 .../doc => doc}/manual/redistribution.texinfo | 0 doc/source/_static/.placeholder | 0 .../api/diffpy.pdfgui.example_package.rst | 31 ++ doc/source/api/diffpy.pdfgui.rst | 30 ++ doc/source/conf.py | 289 ++++++++++++++++++ doc/source/index.rst | 50 +++ doc/source/license.rst | 39 +++ doc/source/release.rst | 5 + .../pdfgui/doc => doc}/tutorial/1050K.gr | 0 .../pdfgui/doc => doc}/tutorial/1100K.gr | 0 .../pdfgui/doc => doc}/tutorial/1150K.gr | 0 .../pdfgui/doc => doc}/tutorial/300K.gr | 0 .../pdfgui/doc => doc}/tutorial/550K.gr | 0 .../pdfgui/doc => doc}/tutorial/650K.gr | 0 .../pdfgui/doc => doc}/tutorial/700K.gr | 0 .../pdfgui/doc => doc}/tutorial/720K.gr | 0 .../pdfgui/doc => doc}/tutorial/730K.gr | 0 .../pdfgui/doc => doc}/tutorial/740K.gr | 0 .../pdfgui/doc => doc}/tutorial/750K.gr | 0 .../pdfgui/doc => doc}/tutorial/800K.gr | 0 .../pdfgui/doc => doc}/tutorial/880K.gr | 0 .../pdfgui/doc => doc}/tutorial/980K.gr | 0 .../pdfgui/doc => doc}/tutorial/CdSe-3nm.gr | 0 .../pdfgui/doc => doc}/tutorial/CdSe-bulk.gr | 0 .../doc => doc}/tutorial/CdSe-nano.ddp3 | Bin .../doc => doc}/tutorial/CdSe-wurtzite.stru | 0 .../pdfgui/doc => doc}/tutorial/Ni-neutron.gr | 0 .../pdfgui/doc => doc}/tutorial/Ni-xray.gr | 0 .../pdfgui/doc => doc}/tutorial/Ni.stru | 0 .../doc => doc}/tutorial/lcmo-template.ddp3 | Bin .../doc => doc}/tutorial/lmo-template.ddp3 | Bin .../tutorial/tui_mno_bond_lengths.py | 0 .../doc => doc}/tutorial/x000t010q35.gr | 0 .../doc => doc}/tutorial/x004t010q35.gr | 0 .../doc => doc}/tutorial/x012t010q35.gr | 0 .../doc => doc}/tutorial/x016t010q35.gr | 0 .../doc => doc}/tutorial/x020t010q35.gr | 0 .../doc => doc}/tutorial/x024t010q35.gr | 0 .../doc => doc}/tutorial/x028t010q35.gr | 0 src/diffpy/pdfgui/doc/TUTORIAL.txt | 185 ----------- src/diffpy/pdfgui/doc/manual/Makefile | 49 --- 106 files changed, 822 insertions(+), 234 deletions(-) create mode 100644 doc/Makefile create mode 100644 doc/TUTORIAL.rst rename {src/diffpy/pdfgui/doc => doc}/epydoc/Makefile (100%) rename {src/diffpy/pdfgui/doc => doc}/epydoc/epydoc.cfg (100%) create mode 100644 doc/make.bat rename {src/diffpy/pdfgui/doc => doc}/manual/.gitignore (100%) rename {src/diffpy/pdfgui/doc => doc/manual}/Farrow-jpcm-2007.pdf (100%) rename {src/diffpy/pdfgui/doc => doc/manual}/Proffen-jac-1999.pdf (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/acknowledgements.texinfo (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/disclaimer.texinfo (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/extractEquations.py (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/fixHTMLCode.py (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/Makefile (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/eq-01.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/eq-02.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig2-01.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig2-02.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig2-03.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig2-04.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig2-05.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig2-06.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig2-07.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig2-08.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig2-09.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig2-10.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig2-11.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig3-01.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig3-02.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig3-03.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig3-04.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig3-05.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig3-06.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig3-07.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig3-08.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig3-09.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig3-10.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig4-01.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/fig4-02.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig2-01.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig2-01.xcf (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig2-02.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig2-03.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig2-04.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig2-05.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig2-06.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig2-07.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig2-08.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig2-09.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig2-10.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig2-11.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig3-01.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig3-02.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig3-03.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig3-04.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig3-05.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig3-06.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig3-07.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig3-08.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig3-09.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig3-10.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig4-01.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/images/originals/fig4-02.png (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/pdfgui.html (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/pdfgui.pdf (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/pdfgui.texinfo (100%) rename {src/diffpy/pdfgui/doc => doc}/manual/redistribution.texinfo (100%) create mode 100644 doc/source/_static/.placeholder create mode 100644 doc/source/api/diffpy.pdfgui.example_package.rst create mode 100644 doc/source/api/diffpy.pdfgui.rst create mode 100644 doc/source/conf.py create mode 100644 doc/source/index.rst create mode 100644 doc/source/license.rst create mode 100644 doc/source/release.rst rename {src/diffpy/pdfgui/doc => doc}/tutorial/1050K.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/1100K.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/1150K.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/300K.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/550K.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/650K.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/700K.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/720K.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/730K.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/740K.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/750K.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/800K.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/880K.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/980K.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/CdSe-3nm.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/CdSe-bulk.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/CdSe-nano.ddp3 (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/CdSe-wurtzite.stru (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/Ni-neutron.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/Ni-xray.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/Ni.stru (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/lcmo-template.ddp3 (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/lmo-template.ddp3 (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/tui_mno_bond_lengths.py (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/x000t010q35.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/x004t010q35.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/x012t010q35.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/x016t010q35.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/x020t010q35.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/x024t010q35.gr (100%) rename {src/diffpy/pdfgui/doc => doc}/tutorial/x028t010q35.gr (100%) delete mode 100644 src/diffpy/pdfgui/doc/TUTORIAL.txt delete mode 100644 src/diffpy/pdfgui/doc/manual/Makefile diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 00000000..ebad7585 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,194 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = build +BASENAME = $(subst .,,$(subst $() $(),,diffpy.pdfgui)) + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/$(BASENAME).qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/$(BASENAME).qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/$(BASENAME)" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/$(BASENAME)" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +# Manual publishing to the gh-pages branch + +GITREPOPATH = $(shell cd $(CURDIR) && git rev-parse --git-dir) +GITREMOTE = origin +GITREMOTEURL = $(shell git config --get remote.$(GITREMOTE).url) +GITLASTCOMMIT = $(shell git rev-parse --short HEAD) + +publish: + @test -d build/html || \ + ( echo >&2 "Run 'make html' first!"; false ) + git show-ref --verify --quiet refs/heads/gh-pages || \ + git branch --track gh-pages $(GITREMOTE)/gh-pages + test -d build/gh-pages || \ + git clone -s -b gh-pages $(GITREPOPATH) build/gh-pages + cd build/gh-pages && \ + git pull $(GITREMOTEURL) gh-pages + rsync -acv --delete --exclude=.git --exclude=.rsync-exclude \ + --exclude-from=build/gh-pages/.rsync-exclude \ + --link-dest=$(CURDIR)/build/html build/html/ build/gh-pages/ + cd build/gh-pages && \ + git add --all . && \ + git diff --cached --quiet || \ + git commit -m "Sync with the source at $(GITLASTCOMMIT)." + cd build/gh-pages && \ + git push origin gh-pages diff --git a/doc/TUTORIAL.rst b/doc/TUTORIAL.rst new file mode 100644 index 00000000..2cb5b5ce --- /dev/null +++ b/doc/TUTORIAL.rst @@ -0,0 +1,148 @@ +=============================================================================== + Welcome to the PDFgui tutorial +=============================================================================== + +The latest version of this document is available online at + +`http://danse.us/trac/diffraction/browser/diffraction/diffpy/diffpy/pdfgui/doc`_ + +Please, have your co-workers or students try it out and let us know if you +have any comments. We want to make it really easy for the new users to get +started with PDFgui. + +------------------------------------------------------------------------------- + +Lesson 1: Creating simple fit of Ni PDF +---------------------------------------- + +Input files: + +* ``_ - experimental X-ray PDF data +* ``_ - Ni f.c.c. structure in PDFfit format + +Procedure: + +1. Open a terminal and type ``pdfgui`` to start the program. + +2. Create a new Fit: + 1. Select "FITTING" in the left-most vertical tab. + 2. Click right mouse button in the left panel and choose "New Fit" in the pop-up menu. + +3. Load structure model: + 1. Place the cursor of the mouse onto the title of the Fit, click the right button and choose "Insert Phase" in the pop-up menu. + 2. Click the "Open" button and load the `Ni.stru` file. + + The right panel has 3 tabs for the initial configuration, constraints panel for expressing structure properties as functions of tunable parameters, and Results panel for refined structure. + +4. Load experimental PDF data: + 1. Select the title of "Fit 1", click the right button and choose "Insert Data Set" in the pop-up menu. + 2. Load the `Ni-xray.gr` file. + + Again, the right panel shows 3 tabs for properties of this dataset. + +5. Define what is refined: + 1. Click on the `Ni-xray.gr` data and select the "Constraints" tab. + 2. Type ``@1`` into "Scale Factor" edit box. + 3. Select the `Ni.stru` phase and its "Constraints" tab. + 4. Fill "a", "b", "c" boxes with ``@5``. + + A refined variable can be expressed as a math expression: + ``f(@n1, @n2, @n3, ...)`` where + ``@n1`` stands for fitted parameter and + ``n1, n2, ...`` are arbitrary positive integers. + This allows simple linking of related variables - for example, since + cell lengths a, b, c are all expressed as ``@5``, the refined structure will remain cubic. + +6. Start the refinement: + 1. Select "Fit 1" in the left panel. The parameters panel shows a list of used parameters and their initial values. + 2. Click the "gear" icon on the toolbar and watch the fit progress in the terminal window. + +7. Plot the results: + 1. Select "PLOTTING" in the left-most vertical tab. + 2. Select the `Ni-xray.gr` dataset. + 3. Select "r" as the X plotting variable. + 4. Hold down shift and select "Gcalc" and "Gtrunc" as the Y plotting variables. + 5. Click "Plot" button. + + A new window pops up with plots. You can try out the buttons in the toolbar below. + +8. Save your project for later use. + +------------------------------------------------------------------------------- + +Lesson 2: Build structure model using crystal symmetry +------------------------------------------------------ + +In the previous example the initial structure was defined by an existing file. However, PDFgui makes it very easy to build a structure model from scratch and constrain it with arbitrary crystal symmetry. + +1. Create a blank structure: + 1. Click the FITTING tab. + 2. Repeat steps 1-3a from Lesson 1, but choose the "New" button. Rename "New Phase" to "Ni fcc". + +2. Define asymmetric unit: + 1. Right click the header of the empty atoms grid in the "Configure" page. + 2. Insert 1 atom using the popup menu. + 3. Change the elem cell to "Ni". + 4. Select the u11-u33 cells and type "0.004" and press Enter. + +3. Expand to all equivalent positions: + 1. Right click the first Ni atom and select "Expand space group". A "Space Group Expansion" dialog should open. + 2. In the dialog, select Fm-3m or just type 225 in the "Space Group" box and hit "OK". + + You should now have four atoms in the atoms grid. + +4. Generate symmetry constraints: + 1. Select the "Constraints" tab. + 2. Select all atoms. This can be done by dragging the mouse over the atom names or by clicking on the "elem" header. + 3. Right click in a selected cell and select "Symmetry constraints." A "Space Group Constraints" dialog should open. + 4. "Fm-3m" should already appear in the "Space Group" box. If it does not, select it as you did in step 3 and hit "OK". + + The u11-u33 cells should all read the same value. The "x", "y" and "z" cells should be all empty because Ni atoms are at special positions in Fm-3m. You may try to select lower-symmetry space and check what happens with the constraints. The space group constraints may be mixed by selecting different groups of atoms, for example, when only certain species show lowered symmetry. + +5. Continue the fit as in Lesson 1. + +------------------------------------------------------------------------------- + +Lesson 3: Multi-stage fitting +----------------------------- + +Learn how to string together fits. + +1. Create a fit as in Lesson 1. + +2. Copy the fit: + 1. Right click on the fit name "Fit 1" in the right panel (the fit tree). + 2. Select "Copy" from the pop-up menu. + +3. Paste the fit: + 1. Right click in the empty space between the first fit in the fit tree. + 2. Select "Paste Fit." This will create "Fit 1_copy", a copy of "Fit 1" in the fit tree. + +4. Link the fits: + 1. Click on "Fit 1_copy" in the fit tree. + 2. In the "Parameters" panel, select the entire "Initial" column. + 3. Type ``=Fit 1`` and then press Enter. The "Initial" values of the parameters should now read ``=Fit1:n``, where "n" is the index of the parameter. + + This is the linking syntax: ``=name:index``. + "name" is the name of another fit. + "index" is the index of a parameter in that fit. + If you omit "index", it will default to the index of the parameter you are linking from. A linked parameter uses the refined value of the link as its initial value. This is useful when you are running several related fits. + +5. Add more fit parameters: + 1. Select the "Constraints" tab of the `Ni.stru` phase below "Fit 1_copy". + 2. Write ``@9`` in the "delta2" box. + +6. Run the fit and plot the results: + 1. Run the fit as in Lesson 1. + 2. Plot the fit as in Lesson 1, but this time hold down Control and select the data sets from "Fit 1" and "Fit 1_copy". You can change the "offset" in the plotting window to 0 to place the plots on top of each other. + +------------------------------------------------------------------------------- + +References: +----------- + +1. `(pdf) `_, + Th. Proffen and S. J. L. Billinge, PDFFIT a program for full profile structural refinement of the atomic pair distribution function, J. Appl. Crystallogr. 32, 572-575 (1999) + +2. `(pdf) `_, + C. L. Farrow, P. Juhas, J. W. Liu, D. Bryndin, J. Bloch, Th. Proffen and S. J. L. Billinge, PDFfit2 and PDFgui: Computer programs for studying nanostructure in crystals, J. Phys.: Condens. Matter 19, 335219 (2007) diff --git a/src/diffpy/pdfgui/doc/epydoc/Makefile b/doc/epydoc/Makefile similarity index 100% rename from src/diffpy/pdfgui/doc/epydoc/Makefile rename to doc/epydoc/Makefile diff --git a/src/diffpy/pdfgui/doc/epydoc/epydoc.cfg b/doc/epydoc/epydoc.cfg similarity index 100% rename from src/diffpy/pdfgui/doc/epydoc/epydoc.cfg rename to doc/epydoc/epydoc.cfg diff --git a/doc/make.bat b/doc/make.bat new file mode 100644 index 00000000..2be83069 --- /dev/null +++ b/doc/make.bat @@ -0,0 +1,36 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build +set SPHINXPROJ=PackagingScientificPython + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd diff --git a/src/diffpy/pdfgui/doc/manual/.gitignore b/doc/manual/.gitignore similarity index 100% rename from src/diffpy/pdfgui/doc/manual/.gitignore rename to doc/manual/.gitignore diff --git a/src/diffpy/pdfgui/doc/Farrow-jpcm-2007.pdf b/doc/manual/Farrow-jpcm-2007.pdf similarity index 100% rename from src/diffpy/pdfgui/doc/Farrow-jpcm-2007.pdf rename to doc/manual/Farrow-jpcm-2007.pdf diff --git a/src/diffpy/pdfgui/doc/Proffen-jac-1999.pdf b/doc/manual/Proffen-jac-1999.pdf similarity index 100% rename from src/diffpy/pdfgui/doc/Proffen-jac-1999.pdf rename to doc/manual/Proffen-jac-1999.pdf diff --git a/src/diffpy/pdfgui/doc/manual/acknowledgements.texinfo b/doc/manual/acknowledgements.texinfo similarity index 100% rename from src/diffpy/pdfgui/doc/manual/acknowledgements.texinfo rename to doc/manual/acknowledgements.texinfo diff --git a/src/diffpy/pdfgui/doc/manual/disclaimer.texinfo b/doc/manual/disclaimer.texinfo similarity index 100% rename from src/diffpy/pdfgui/doc/manual/disclaimer.texinfo rename to doc/manual/disclaimer.texinfo diff --git a/src/diffpy/pdfgui/doc/manual/extractEquations.py b/doc/manual/extractEquations.py similarity index 100% rename from src/diffpy/pdfgui/doc/manual/extractEquations.py rename to doc/manual/extractEquations.py diff --git a/src/diffpy/pdfgui/doc/manual/fixHTMLCode.py b/doc/manual/fixHTMLCode.py similarity index 100% rename from src/diffpy/pdfgui/doc/manual/fixHTMLCode.py rename to doc/manual/fixHTMLCode.py diff --git a/src/diffpy/pdfgui/doc/manual/images/Makefile b/doc/manual/images/Makefile similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/Makefile rename to doc/manual/images/Makefile diff --git a/src/diffpy/pdfgui/doc/manual/images/eq-01.png b/doc/manual/images/eq-01.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/eq-01.png rename to doc/manual/images/eq-01.png diff --git a/src/diffpy/pdfgui/doc/manual/images/eq-02.png b/doc/manual/images/eq-02.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/eq-02.png rename to doc/manual/images/eq-02.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig2-01.png b/doc/manual/images/fig2-01.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig2-01.png rename to doc/manual/images/fig2-01.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig2-02.png b/doc/manual/images/fig2-02.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig2-02.png rename to doc/manual/images/fig2-02.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig2-03.png b/doc/manual/images/fig2-03.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig2-03.png rename to doc/manual/images/fig2-03.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig2-04.png b/doc/manual/images/fig2-04.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig2-04.png rename to doc/manual/images/fig2-04.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig2-05.png b/doc/manual/images/fig2-05.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig2-05.png rename to doc/manual/images/fig2-05.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig2-06.png b/doc/manual/images/fig2-06.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig2-06.png rename to doc/manual/images/fig2-06.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig2-07.png b/doc/manual/images/fig2-07.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig2-07.png rename to doc/manual/images/fig2-07.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig2-08.png b/doc/manual/images/fig2-08.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig2-08.png rename to doc/manual/images/fig2-08.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig2-09.png b/doc/manual/images/fig2-09.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig2-09.png rename to doc/manual/images/fig2-09.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig2-10.png b/doc/manual/images/fig2-10.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig2-10.png rename to doc/manual/images/fig2-10.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig2-11.png b/doc/manual/images/fig2-11.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig2-11.png rename to doc/manual/images/fig2-11.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig3-01.png b/doc/manual/images/fig3-01.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig3-01.png rename to doc/manual/images/fig3-01.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig3-02.png b/doc/manual/images/fig3-02.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig3-02.png rename to doc/manual/images/fig3-02.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig3-03.png b/doc/manual/images/fig3-03.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig3-03.png rename to doc/manual/images/fig3-03.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig3-04.png b/doc/manual/images/fig3-04.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig3-04.png rename to doc/manual/images/fig3-04.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig3-05.png b/doc/manual/images/fig3-05.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig3-05.png rename to doc/manual/images/fig3-05.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig3-06.png b/doc/manual/images/fig3-06.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig3-06.png rename to doc/manual/images/fig3-06.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig3-07.png b/doc/manual/images/fig3-07.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig3-07.png rename to doc/manual/images/fig3-07.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig3-08.png b/doc/manual/images/fig3-08.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig3-08.png rename to doc/manual/images/fig3-08.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig3-09.png b/doc/manual/images/fig3-09.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig3-09.png rename to doc/manual/images/fig3-09.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig3-10.png b/doc/manual/images/fig3-10.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig3-10.png rename to doc/manual/images/fig3-10.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig4-01.png b/doc/manual/images/fig4-01.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig4-01.png rename to doc/manual/images/fig4-01.png diff --git a/src/diffpy/pdfgui/doc/manual/images/fig4-02.png b/doc/manual/images/fig4-02.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/fig4-02.png rename to doc/manual/images/fig4-02.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig2-01.png b/doc/manual/images/originals/fig2-01.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig2-01.png rename to doc/manual/images/originals/fig2-01.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig2-01.xcf b/doc/manual/images/originals/fig2-01.xcf similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig2-01.xcf rename to doc/manual/images/originals/fig2-01.xcf diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig2-02.png b/doc/manual/images/originals/fig2-02.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig2-02.png rename to doc/manual/images/originals/fig2-02.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig2-03.png b/doc/manual/images/originals/fig2-03.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig2-03.png rename to doc/manual/images/originals/fig2-03.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig2-04.png b/doc/manual/images/originals/fig2-04.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig2-04.png rename to doc/manual/images/originals/fig2-04.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig2-05.png b/doc/manual/images/originals/fig2-05.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig2-05.png rename to doc/manual/images/originals/fig2-05.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig2-06.png b/doc/manual/images/originals/fig2-06.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig2-06.png rename to doc/manual/images/originals/fig2-06.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig2-07.png b/doc/manual/images/originals/fig2-07.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig2-07.png rename to doc/manual/images/originals/fig2-07.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig2-08.png b/doc/manual/images/originals/fig2-08.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig2-08.png rename to doc/manual/images/originals/fig2-08.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig2-09.png b/doc/manual/images/originals/fig2-09.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig2-09.png rename to doc/manual/images/originals/fig2-09.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig2-10.png b/doc/manual/images/originals/fig2-10.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig2-10.png rename to doc/manual/images/originals/fig2-10.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig2-11.png b/doc/manual/images/originals/fig2-11.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig2-11.png rename to doc/manual/images/originals/fig2-11.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig3-01.png b/doc/manual/images/originals/fig3-01.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig3-01.png rename to doc/manual/images/originals/fig3-01.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig3-02.png b/doc/manual/images/originals/fig3-02.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig3-02.png rename to doc/manual/images/originals/fig3-02.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig3-03.png b/doc/manual/images/originals/fig3-03.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig3-03.png rename to doc/manual/images/originals/fig3-03.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig3-04.png b/doc/manual/images/originals/fig3-04.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig3-04.png rename to doc/manual/images/originals/fig3-04.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig3-05.png b/doc/manual/images/originals/fig3-05.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig3-05.png rename to doc/manual/images/originals/fig3-05.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig3-06.png b/doc/manual/images/originals/fig3-06.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig3-06.png rename to doc/manual/images/originals/fig3-06.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig3-07.png b/doc/manual/images/originals/fig3-07.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig3-07.png rename to doc/manual/images/originals/fig3-07.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig3-08.png b/doc/manual/images/originals/fig3-08.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig3-08.png rename to doc/manual/images/originals/fig3-08.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig3-09.png b/doc/manual/images/originals/fig3-09.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig3-09.png rename to doc/manual/images/originals/fig3-09.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig3-10.png b/doc/manual/images/originals/fig3-10.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig3-10.png rename to doc/manual/images/originals/fig3-10.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig4-01.png b/doc/manual/images/originals/fig4-01.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig4-01.png rename to doc/manual/images/originals/fig4-01.png diff --git a/src/diffpy/pdfgui/doc/manual/images/originals/fig4-02.png b/doc/manual/images/originals/fig4-02.png similarity index 100% rename from src/diffpy/pdfgui/doc/manual/images/originals/fig4-02.png rename to doc/manual/images/originals/fig4-02.png diff --git a/src/diffpy/pdfgui/doc/manual/pdfgui.html b/doc/manual/pdfgui.html similarity index 100% rename from src/diffpy/pdfgui/doc/manual/pdfgui.html rename to doc/manual/pdfgui.html diff --git a/src/diffpy/pdfgui/doc/manual/pdfgui.pdf b/doc/manual/pdfgui.pdf similarity index 100% rename from src/diffpy/pdfgui/doc/manual/pdfgui.pdf rename to doc/manual/pdfgui.pdf diff --git a/src/diffpy/pdfgui/doc/manual/pdfgui.texinfo b/doc/manual/pdfgui.texinfo similarity index 100% rename from src/diffpy/pdfgui/doc/manual/pdfgui.texinfo rename to doc/manual/pdfgui.texinfo diff --git a/src/diffpy/pdfgui/doc/manual/redistribution.texinfo b/doc/manual/redistribution.texinfo similarity index 100% rename from src/diffpy/pdfgui/doc/manual/redistribution.texinfo rename to doc/manual/redistribution.texinfo diff --git a/doc/source/_static/.placeholder b/doc/source/_static/.placeholder new file mode 100644 index 00000000..e69de29b diff --git a/doc/source/api/diffpy.pdfgui.example_package.rst b/doc/source/api/diffpy.pdfgui.example_package.rst new file mode 100644 index 00000000..0390b965 --- /dev/null +++ b/doc/source/api/diffpy.pdfgui.example_package.rst @@ -0,0 +1,31 @@ +.. _example_package documentation: + +|title| +======= + +.. |title| replace:: diffpy.pdfgui.example_package package + +.. automodule:: diffpy.pdfgui.example_package + :members: + :undoc-members: + :show-inheritance: + +|foo| +----- + +.. |foo| replace:: diffpy.pdfgui.example_package.foo module + +.. automodule:: diffpy.pdfgui.example_package.foo + :members: + :undoc-members: + :show-inheritance: + +|bar| +----- + +.. |bar| replace:: diffpy.pdfgui.example_package.bar module + +.. automodule:: diffpy.pdfgui.example_package.foo + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/diffpy.pdfgui.rst b/doc/source/api/diffpy.pdfgui.rst new file mode 100644 index 00000000..8166640e --- /dev/null +++ b/doc/source/api/diffpy.pdfgui.rst @@ -0,0 +1,30 @@ +:tocdepth: -1 + +|title| +======= + +.. |title| replace:: diffpy.pdfgui package + +.. automodule:: diffpy.pdfgui + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + diffpy.pdfgui.example_package + +Submodules +---------- + +|module| +-------- + +.. |module| replace:: diffpy.pdfgui.example_submodule module + +.. automodule:: diffpy.pdfgui.example_submodule + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/conf.py b/doc/source/conf.py new file mode 100644 index 00000000..cc57882a --- /dev/null +++ b/doc/source/conf.py @@ -0,0 +1,289 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# diffpy.pdfgui documentation build configuration file, created by +# sphinx-quickstart on Thu Jan 30 15:49:41 2014. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import time +from importlib.metadata import version +from pathlib import Path + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use Path().resolve() to make it absolute, like shown here. +# sys.path.insert(0, str(Path(".").resolve())) +sys.path.insert(0, str(Path("../..").resolve())) +sys.path.insert(0, str(Path("../../src").resolve())) + +# abbreviations +ab_authors = "Billinge Group members and community contributors" + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.napoleon", + "sphinx.ext.todo", + "sphinx.ext.viewcode", + "sphinx.ext.intersphinx", + "sphinx_rtd_theme", + "m2r", +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +source_suffix = [".rst", ".md"] + +# The encoding of source files. +# source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = "index" + +# General information about the project. +project = "diffpy.pdfgui" +copyright = "%Y, The Trustees of Columbia University in the City of New York" + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. + +fullversion = version(project) +# The short X.Y version. +version = "".join(fullversion.split(".post")[:1]) +# The full version, including alpha/beta/rc tags. +release = fullversion + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +# today = '' +today = time.strftime("%B %d, %Y", time.localtime()) +year = today.split()[-1] +# Else, today_fmt is used as the format for a strftime call. +# today_fmt = '%B %d, %Y' +# substitute YEAR in the copyright string +copyright = copyright.replace("%Y", year) + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ["build"] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +# add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +# add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +# show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "sphinx" + +# A list of ignored prefixes for module index sorting. +modindex_common_prefix = ["diffpy.pdfgui"] + +# Display all warnings for missing links. +nitpicky = True + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = "sphinx_rtd_theme" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +html_theme_options = { + "navigation_with_keys": "true", +} + +# Add any paths that contain custom themes here, relative to this directory. +# html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +# html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +# html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +# html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +# html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +# html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +# html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +# html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +# html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +# html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +# html_additional_pages = {} + +# If false, no module index is generated. +# html_domain_indices = True + +# If false, no index is generated. +# html_use_index = True + +# If true, the index is split into individual pages for each letter. +# html_split_index = False + +# If true, links to the reST sources are added to the pages. +# html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +# html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +# html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +# html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +# html_file_suffix = None + +# Output file base name for HTML help builder. +basename = "diffpy.pdfgui".replace(" ", "").replace(".", "") +htmlhelp_basename = basename + "doc" + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # 'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + # 'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + # 'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ("index", "diffpy.pdfgui.tex", "diffpy.pdfgui Documentation", ab_authors, "manual"), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +# latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +# latex_use_parts = False + +# If true, show page references after internal links. +# latex_show_pagerefs = False + +# If true, show URL addresses after external links. +# latex_show_urls = False + +# Documents to append as an appendix to all manuals. +# latex_appendices = [] + +# If false, no module index is generated. +# latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [("index", "diffpy.pdfgui", "diffpy.pdfgui Documentation", ab_authors, 1)] + +# If true, show URL addresses after external links. +# man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ( + "index", + "diffpy.pdfgui", + "diffpy.pdfgui Documentation", + ab_authors, + "diffpy.pdfgui", + "One line description of project.", + "Miscellaneous", + ), +] + +# Documents to append as an appendix to all manuals. +# texinfo_appendices = [] + +# If false, no module index is generated. +# texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +# texinfo_no_detailmenu = False + + +# Example configuration for intersphinx: refer to the Python standard library. +# intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/doc/source/index.rst b/doc/source/index.rst new file mode 100644 index 00000000..7a8854ce --- /dev/null +++ b/doc/source/index.rst @@ -0,0 +1,50 @@ +####### +|title| +####### + +.. |title| replace:: diffpy.pdfgui documentation + +diffpy.pdfgui - GUI for PDF simulation and structure refinement.. + +| Software version |release|. +| Last updated |today|. + +======= +Authors +======= + +diffpy.pdfgui is developed by Billinge Group +and its community contributors. + +For a detailed list of contributors see +https://github.com/diffpy/diffpy.pdfgui/graphs/contributors. + +============ +Installation +============ + +See the `README `_ +file included with the distribution. + +======== +Tutorial +======== + +A tutorial for this package can be found here: `<../TUTORIAL.rst>` + +================= +Table of contents +================= +.. toctree:: + :titlesonly: + + license + release + Package API + +======= +Indices +======= + +* :ref:`genindex` +* :ref:`search` diff --git a/doc/source/license.rst b/doc/source/license.rst new file mode 100644 index 00000000..cfab61c2 --- /dev/null +++ b/doc/source/license.rst @@ -0,0 +1,39 @@ +:tocdepth: -1 + +.. index:: license + +License +####### + +OPEN SOURCE LICENSE AGREEMENT +============================= +BSD 3-Clause License + +Copyright (c) 2024, The Trustees of Columbia University in +the City of New York. +All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/doc/source/release.rst b/doc/source/release.rst new file mode 100644 index 00000000..27cd0cc9 --- /dev/null +++ b/doc/source/release.rst @@ -0,0 +1,5 @@ +:tocdepth: -1 + +.. index:: release notes + +.. include:: ../../CHANGELOG.rst diff --git a/src/diffpy/pdfgui/doc/tutorial/1050K.gr b/doc/tutorial/1050K.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/1050K.gr rename to doc/tutorial/1050K.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/1100K.gr b/doc/tutorial/1100K.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/1100K.gr rename to doc/tutorial/1100K.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/1150K.gr b/doc/tutorial/1150K.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/1150K.gr rename to doc/tutorial/1150K.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/300K.gr b/doc/tutorial/300K.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/300K.gr rename to doc/tutorial/300K.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/550K.gr b/doc/tutorial/550K.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/550K.gr rename to doc/tutorial/550K.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/650K.gr b/doc/tutorial/650K.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/650K.gr rename to doc/tutorial/650K.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/700K.gr b/doc/tutorial/700K.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/700K.gr rename to doc/tutorial/700K.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/720K.gr b/doc/tutorial/720K.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/720K.gr rename to doc/tutorial/720K.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/730K.gr b/doc/tutorial/730K.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/730K.gr rename to doc/tutorial/730K.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/740K.gr b/doc/tutorial/740K.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/740K.gr rename to doc/tutorial/740K.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/750K.gr b/doc/tutorial/750K.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/750K.gr rename to doc/tutorial/750K.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/800K.gr b/doc/tutorial/800K.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/800K.gr rename to doc/tutorial/800K.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/880K.gr b/doc/tutorial/880K.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/880K.gr rename to doc/tutorial/880K.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/980K.gr b/doc/tutorial/980K.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/980K.gr rename to doc/tutorial/980K.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/CdSe-3nm.gr b/doc/tutorial/CdSe-3nm.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/CdSe-3nm.gr rename to doc/tutorial/CdSe-3nm.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/CdSe-bulk.gr b/doc/tutorial/CdSe-bulk.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/CdSe-bulk.gr rename to doc/tutorial/CdSe-bulk.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/CdSe-nano.ddp3 b/doc/tutorial/CdSe-nano.ddp3 similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/CdSe-nano.ddp3 rename to doc/tutorial/CdSe-nano.ddp3 diff --git a/src/diffpy/pdfgui/doc/tutorial/CdSe-wurtzite.stru b/doc/tutorial/CdSe-wurtzite.stru similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/CdSe-wurtzite.stru rename to doc/tutorial/CdSe-wurtzite.stru diff --git a/src/diffpy/pdfgui/doc/tutorial/Ni-neutron.gr b/doc/tutorial/Ni-neutron.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/Ni-neutron.gr rename to doc/tutorial/Ni-neutron.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/Ni-xray.gr b/doc/tutorial/Ni-xray.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/Ni-xray.gr rename to doc/tutorial/Ni-xray.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/Ni.stru b/doc/tutorial/Ni.stru similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/Ni.stru rename to doc/tutorial/Ni.stru diff --git a/src/diffpy/pdfgui/doc/tutorial/lcmo-template.ddp3 b/doc/tutorial/lcmo-template.ddp3 similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/lcmo-template.ddp3 rename to doc/tutorial/lcmo-template.ddp3 diff --git a/src/diffpy/pdfgui/doc/tutorial/lmo-template.ddp3 b/doc/tutorial/lmo-template.ddp3 similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/lmo-template.ddp3 rename to doc/tutorial/lmo-template.ddp3 diff --git a/src/diffpy/pdfgui/doc/tutorial/tui_mno_bond_lengths.py b/doc/tutorial/tui_mno_bond_lengths.py similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/tui_mno_bond_lengths.py rename to doc/tutorial/tui_mno_bond_lengths.py diff --git a/src/diffpy/pdfgui/doc/tutorial/x000t010q35.gr b/doc/tutorial/x000t010q35.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/x000t010q35.gr rename to doc/tutorial/x000t010q35.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/x004t010q35.gr b/doc/tutorial/x004t010q35.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/x004t010q35.gr rename to doc/tutorial/x004t010q35.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/x012t010q35.gr b/doc/tutorial/x012t010q35.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/x012t010q35.gr rename to doc/tutorial/x012t010q35.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/x016t010q35.gr b/doc/tutorial/x016t010q35.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/x016t010q35.gr rename to doc/tutorial/x016t010q35.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/x020t010q35.gr b/doc/tutorial/x020t010q35.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/x020t010q35.gr rename to doc/tutorial/x020t010q35.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/x024t010q35.gr b/doc/tutorial/x024t010q35.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/x024t010q35.gr rename to doc/tutorial/x024t010q35.gr diff --git a/src/diffpy/pdfgui/doc/tutorial/x028t010q35.gr b/doc/tutorial/x028t010q35.gr similarity index 100% rename from src/diffpy/pdfgui/doc/tutorial/x028t010q35.gr rename to doc/tutorial/x028t010q35.gr diff --git a/src/diffpy/pdfgui/doc/TUTORIAL.txt b/src/diffpy/pdfgui/doc/TUTORIAL.txt deleted file mode 100644 index 283fc5bd..00000000 --- a/src/diffpy/pdfgui/doc/TUTORIAL.txt +++ /dev/null @@ -1,185 +0,0 @@ -============================================================================== -= Welcome to the PDFgui tutorial = -============================================================================== - -The latest version of this document is available online at - -http://danse.us/trac/diffraction/browser/diffraction/diffpy/diffpy/pdfgui/doc - -Please, have your co-workers or students try it out and let us know if you -have any comments. We want to make it really easy for the new users to get -started with PDFgui. - ------------------------------------------------------------------------------- - -Lesson 1: Creating simple fit of Ni PDF - - Input files: - - tutorial/Ni-xray.gr experimental X-ray PDF data - tutorial/Ni.stru Ni f.c.c. structure in PDFfit format - - Procedure: - - 1. Open a terminal and type "pdfgui" to start the program. - - 2. Create a new Fit: - (a) Select "FITTING" in the left-most vertical tab. - (b) Click right mouse button in the left panel and choose "New Fit" - in the pop-up menu. - - 3. Load structure model: - - (a) Place the cursor of the mouse onto the title of the Fit, click - the right button and choose "Insert Phase" in the pop-up menu. - (b) Click the "Open" button and load the Ni.stru file. - - The right panel has 3 tabs for the initial configuration, constraints - panel for expressing structure properties as functions of tunable - parameters, and Results panel for refined structure. - - 4. Load experimental PDF data: - (a) Select the title of "Fit 1", click the right button and choose - "Insert Data Set" in the pop-up menu. - (b) Load the "Ni-xray.gr" file. - - Again, the right panel shows 3 tabs for properties of this dataset. - - 5. Define what is refined: - (a) Click on the "Ni-xray.gr" data and select the "Constraints" tab. - (b) Type "@1" into "Scale Factor" edit box. - (c) Select the "Ni.stru" phase and its "Constraints" tab. - (d) Fill "a", "b", "c" boxes with "@5". - - A refined variable can be expressed as math expression - f(@n1, @n2, @n3, ...) where - @n1 stands for fitted parameter and - n1, n2, ... are arbitrary positive integers - This allows simple linking of related variables - for example, since - cell lengths a, b, c are all expressed as "@5", the refined structure - will remain cubic. - - 6. Start the refinement: - (a) Select "Fit 1" in the left panel. The parameters panel shows list - of used parameters and their initial values. - (b) Click the "gear" icon on the toolbar and watch the fit progress - in the terminal window. - - 7. Plot the results: - (a) Select "PLOTTING" in the left-most vertical tab. - (b) Select the "Ni-xray.gr" dataset - (c) Select "r" as the X plotting variable. - (d) Hold down shift and select "Gcalc" and "Gtrunc" as the Y plotting - variables. - (d) Click "Plot" button. - - A new window pops up with plots. You can try out the buttons in - the toolbar below. - - 8. Save your project for later use. - ------------------------------------------------------------------------------- - -Lesson 2: Build structure model using crystal symmetry - - In the previous example the initial structure was defined by an existing - file. However, PDFgui makes it very easy to build structure model from - scratch and constrain it with arbitrary crystal symmetry. - - 1. Create blank structure: - (a) Click the FITTING tab - (b) Repeat steps 1-3a from Lesson 1, but choose the "New" button. - Rename "New Phase" to "Ni fcc". - - 2. Define asymmetric unit: - (a) Right click the header of the empty atoms grid in the - "Configure" page. - (b) Insert 1 atom using the popup menu. - (c) Change the elem cell to "Ni". - (d) Select the u11-u33 cells and type "0.004" and press Enter. - - 3. Expand to all equivalent positions: - (a) Right click the first Ni atom and select "Expand space group". A - "Space Group Expansion" dialog should open. - (b) In the dialog, select Fm-3m or just type 225 in the "Space Group" - box and hit "OK". - - You should now have four atoms in the atoms grid. - - 4. Generate symmetry constraints: - (a) Select the "Constraints" tab. - (b) Select all atoms. This can be done by dragging the mouse over the - atom names or by clicking on the "elem" header. - (c) Right click in a selected cell and select "Symmetry constraints." - A "Space Group Constraints" dialog should open. - (d) "Fm-3m" should already appear in the "Space Group" box. If it does - not, select it as you did in step 3 and hit "OK". - - The u11-u33 cells should all read the same value. The "x", "y" and - "z" cells should be all empty, because Ni atoms are at special - positions in Fm-3m. You may try to select lower-symmetry space and - check what happens with the constraints. The space group constraints - may be mixed by selecting different groups of atoms, for example when - only certain species show lowered symmetry. - - 5. Continue the fit as in Lesson 1. - ------------------------------------------------------------------------------- - -Lesson 3: Multi-stage fitting - - Learn how to string together fits. - - 1. Create a fit as in Lesson 1. - - 2. Copy the fit. - (a) Right click on the fit name "Fit 1" in the right panel (the fit - tree). - (b) Select "Copy" from the pop-up menu. - - 3. Paste the fit. - (a) Right click in the empty space between the first fit in the fit - tree. - (b) Select "Paste Fit." This will create "Fit 1_copy", a copy of - "Fit 1" in the fit tree. - - 4. Link the fits. - (a) Click on "Fit 1_copy" in the fit tree. - (b) In the "Parameters" panel, select the entire "Initial" column. - (c) Type "=Fit 1" and then press Enter. The "Initial" values of the - parameters should now read "=Fit1:n", where "n" is the index of the - parameter. - - This is the linking syntax: "=name:index". - "name" is the name of another fit. - "index" is the index of a parameter in that fit. - If you omit "index", it will default to the index of the parameter - you are linking from. A linked parameter uses the refined value - of the link as its initial value. This is useful when you are - running several related fits. - - 5. Add more fit parameters. - (a) Select the "Constraints" tab of the "Ni.stru" phase below - "Fit 1_copy". - (b) Write "@9" in the "delta2" box. - - 6. Run the fit and plot the results. - (a) Run the fit as in Lesson 1. - (b) Plot the fit as in Lesson 1, but this time hold down Control and - select the data sets from "Fit 1" and "Fit 1_copy". You can change - the "offset" in the plotting window to 0 to place the plots on top - of each other. - ------------------------------------------------------------------------------- - -References: - -1. Proffen-jac-1999.pdf - Th. Proffen and S. J. L. Billinge, PDFFIT a program for full profile - structural refinement of the atomic pair distribution function, - J. Appl. Crystallogr. 32, 572-575 (1999) - -2. Farrow-jpcm-2007.pdf - C. L. Farrow, P. Juhas, J. W. Liu, D. Bryndin, J. Bloch, Th. Proffen - and S. J. L. Billinge, PDFfit2 and PDFgui: Computer programs for studying - nanostructure in crystals, J. Phys.: Condens. Matter 19, 335219 (2007) diff --git a/src/diffpy/pdfgui/doc/manual/Makefile b/src/diffpy/pdfgui/doc/manual/Makefile deleted file mode 100644 index c1ee4b0e..00000000 --- a/src/diffpy/pdfgui/doc/manual/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -# Makefile for compiling and publishing pdfgui manual -# Available targets: -# -# all -- (default) build pdfgui manual in HTML and PDF formats -# clean -- remove intermediate texinfo files -# cleanALL -- delete all generated files -# publish -- copy the compiled manual files to WEBDIR directory -# -# Variables: -# -# EQBUILD -- extract PNG equations for HTML manual -# WEBDIR -- the rsync target directory. Required by "publish" target. - - -all: pdfgui.pdf pdfgui.html - - -pdfgui.html: pdfgui.texinfo - $(MAKE) -C images - texi2html $< -ifdef EQBUILD - python extractEquations.py $< -endif - python fixHTMLCode.py $@ - - -pdfgui.pdf: pdfgui.texinfo - $(MAKE) -C images - texi2pdf $< - - -clean: - /bin/rm -f -- \ - pdfgui.vr pdfgui.tp pdfgui.pg pdfgui.ky pdfgui.fn \ - pdfgui.cps pdfgui.cp pdfgui.toc pdfgui.aux pdfgui.log \ - pdfgui.vrs - - -cleanALL: clean - /bin/rm -f pdfgui.html pdfgui.pdf - $(MAKE) -C images clean - - -publish: all -ifndef WEBDIR - $(error Set WEBDIR to define rsync target directory.) -endif - rsync -pRt --chmod=a+rwx,go-w,Fa-x \ - pdfgui.html pdfgui.pdf images/*.png $(WEBDIR) From 897f683ec92895e2963b9783c183a7a982f9b991 Mon Sep 17 00:00:00 2001 From: Caden Myers <158210249+cadenmyers13@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:13:30 -0400 Subject: [PATCH 14/24] files (#158) --- .codecov.yml | 36 +++++++++++- .coveragerc | 31 ++++------ .gitattributes | 8 +-- .gitignore | 89 ++++++++++++++++++++++------ CHANGELOG.rst | 6 +- README.rst | 157 +++++++++++++++++++++++++------------------------ pyproject.toml | 49 +++++++++++++++ 7 files changed, 251 insertions(+), 125 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index 86671410..04dd6510 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,2 +1,34 @@ -fixes: - - ".*/site-packages/::src/" +# codecov can find this file anywhere in the repo, so we don't need to clutter +# the root folder. +#comment: false + +codecov: + notify: + require_ci_to_pass: no + +coverage: + status: + patch: + default: + target: '70' + if_no_uploads: error + if_not_found: success + if_ci_failed: failure + project: + default: false + library: + target: auto + if_no_uploads: error + if_not_found: success + if_ci_failed: error + paths: '!*/tests/.*' + + tests: + target: 97.9% + paths: '*/tests/.*' + if_not_found: success + +flags: + tests: + paths: + - tests/ diff --git a/.coveragerc b/.coveragerc index 63f0ec9c..77556cdf 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,22 +1,13 @@ -# Configuration of the coverage.py tool for reporting test coverage. - -[report] -# RE patterns for lines to be excluded from consideration. -exclude_lines = - # Have to re-enable the standard pragma - pragma: no cover - # Don't complain if tests don't hit defensive assertion code: - raise AssertionError - raise NotImplementedError - ^[ ]*assert False - - # Don't complain if non-runnable code isn't run: - ^[ ]*@unittest.skip\b - ^[ ]{4}unittest.main() - if __name__ == .__main__.: - - [run] +source = + diffpy.pdfgui +[report] omit = - # exclude debug.py from codecov report - */tests/debug.py + */python?.?/* + */site-packages/nose/* + # ignore _version.py and versioneer.py + .*version.* + *_version.py + +exclude_lines = + if __name__ == '__main__': diff --git a/.gitattributes b/.gitattributes index 9d58a8cd..0caa8f9f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,7 +1 @@ -/.gitattributes export-ignore -/.gitignore export-ignore -/.travis.yml export-ignore -/conda-recipe/ export-ignore -/devutils export-ignore -.gitarchive.cfg export-subst -*.bat text eol=crlf +diffpy.pdfgui/_version.py export-subst diff --git a/.gitignore b/.gitignore index b1f18e26..a25212ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,44 +1,99 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ *.py[cod] +*$py.class # C extensions *.so -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -temp -develop-eggs +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +venv/ +*.egg-info/ .installed.cfg -lib -lib64 -tags +*.egg +bin/ +temp/ +tags/ errors.err -.idea + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec # Installer logs pip-log.txt +pip-delete-this-directory.txt MANIFEST # Unit test / coverage reports +htmlcov/ +.tox/ .coverage -.tox +.coverage.* +.cache nosetests.xml +coverage.xml +*,cover +.hypothesis/ # Translations *.mo +*.pot # Mr Developer .mr.developer.cfg .project .pydevproject +# Django stuff: +*.log + +# Sphinx documentation +docs/build/ +docs/source/generated/ + +# pytest +.pytest_cache/ + +# PyBuilder +target/ + +# Editor files +# mac +.DS_Store +*~ + +# vim +*.swp +*.swo + +# pycharm +.idea/ + +# VSCode +.vscode/ + +# Ipython Notebook +.ipynb_checkpoints + # version information setup.cfg /src/diffpy/*/version.cfg + +# Rever +rever/ diff --git a/CHANGELOG.rst b/CHANGELOG.rst index fc5d6241..4280491e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,6 @@ -========================= -Diffpy.pdfgui Change Log -========================= +============= +Release Notes +============= .. current developments diff --git a/README.rst b/README.rst index bb30e2e4..809d4f3c 100644 --- a/README.rst +++ b/README.rst @@ -1,11 +1,41 @@ -.. image:: https://travis-ci.org/diffpy/diffpy.pdfgui.svg?branch=master - :target: https://travis-ci.org/diffpy/diffpy.pdfgui +|Icon| |title|_ +=============== -.. image:: https://codecov.io/gh/diffpy/diffpy.pdfgui/branch/master/graph/badge.svg - :target: https://codecov.io/gh/diffpy/diffpy.pdfgui +.. |title| replace:: diffpy.pdfgui +.. _title: https://diffpy.github.io/diffpy.pdfgui +.. |Icon| image:: https://avatars.githubusercontent.com/diffpy + :target: https://diffpy.github.io/diffpy.pdfgui + :height: 100px -PDFgui +|PyPi| |Forge| |PythonVersion| |PR| + +|CI| |Codecov| |Black| |Tracking| + +.. |Black| image:: https://img.shields.io/badge/code_style-black-black + :target: https://github.com/psf/black + +.. |CI| image:: https://github.com/diffpy/diffpy.pdfgui/actions/workflows/main.yml/badge.svg + :target: https://github.com/diffpy/diffpy.pdfgui/actions/workflows/main.yml + +.. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.pdfgui/branch/main/graph/badge.svg + :target: https://codecov.io/gh/diffpy/diffpy.pdfgui + +.. |Forge| image:: https://img.shields.io/conda/vn/conda-forge/diffpy.pdfgui + :target: https://anaconda.org/conda-forge/diffpy.pdfgui + +.. |PR| image:: https://img.shields.io/badge/PR-Welcome-29ab47ff + +.. |PyPi| image:: https://img.shields.io/pypi/v/diffpy.pdfgui + :target: https://pypi.org/project/diffpy.pdfgui/ + +.. |PythonVersion| image:: https://img.shields.io/pypi/pyversions/diffpy.pdfgui + :target: https://pypi.org/project/diffpy.pdfgui/ + +.. |Tracking| image:: https://img.shields.io/badge/issue_tracking-github-blue + :target: https://github.com/diffpy/diffpy.pdfgui/issues + +diffpy.pdfgui ======================================================================== Graphical user interface program for structure refinements to atomic @@ -43,101 +73,76 @@ possible for it to read .ddp files that were saved by the Python2 PDFgui but it will sometimes fail to read these. We are working on a solution that will be available in a future version. -INSTALLATION ------------------------------------------------------------------------- - -The preferred method is to use Anaconda Python and install from the -"conda-forge" channel of Anaconda packages. `pdfgui` can be installed with `conda` :: - - conda install -c conda-forge diffpy.pdfgui - -PDFgui can be then started from a terminal ("Anaconda Prompt" on -Windows) by executing the "pdfgui" program. An alternative -method on Windows is to start PDFgui through the DiffPy start menu. - -If you don't use Anaconda or prefer to install from sources, make -sure the required software is all in place :: + diffpy.pdfgui Package, https://github.com/diffpy/diffpy.pdfgui - conda install -c conda-forge diffpy.utils diffpy.pdffit2 matplotlib wxpython +Installation +------------ -Then you are ready to install diffpy.pdfgui from source codes:: +The preferred method is to use `Miniconda Python +`_ +and install from the "conda-forge" channel of Conda packages. - python setup.py install +To add "conda-forge" to the conda channels, run the following in a terminal. :: -By default the files are installed to standard system directories, -which may require the use of ``sudo`` for write privileges. If -administrator (root) access is not available, see the output from -``python setup.py install --help`` for options to install as a regular -user to user-writable locations. Note that installation to non-standard -directories may require adjustments to the PATH and PYTHONPATH -environment variables. The installation integrity can be verified by -changing to the HOME directory and running :: + conda config --add channels conda-forge - python -m diffpy.pdfgui.tests.rundeps +We want to install our packages in a suitable conda environment. +The following creates and activates a new environment named ``diffpy.pdfgui_env`` :: -To use PDFgui, you can simply type `pdfgui`, or run the following command :: + conda create -n diffpy.pdfgui_env python=3 + conda activate diffpy.pdfgui_env - python diffpy.pdfgui/src/diffpy/pdfgui/application/pdfgui.py +Then, to fully install ``diffpy.pdfgui`` in our active environment, run :: -If it shows some error like "This program needs access to the screen.". For Mac, you could install `python.app` from conda -(`conda install python.app`), then run as follows :: + conda install diffpy.pdfgui - python.app diffpy.pdfgui/src/diffpy/pdfgui/application/pdfgui.py +Another option is to use ``pip`` to download and install the latest release from +`Python Package Index `_. +To install using ``pip`` into your ``diffpy.pdfgui_env`` environment, we will also have to install dependencies :: -With Anaconda PDFgui can be later upgraded to the latest released -version using :: + pip install -r https://raw.githubusercontent.com/diffpy/diffpy.pdfgui/main/requirements/run.txt - conda update -c conda-forge diffpy.pdfgui +and then install the package :: -With other Python distributions the program can be upgraded to -the latest version as follows :: + pip install diffpy.pdfgui - easy_install --upgrade diffpy.pdfgui +If you prefer to install from sources, after installing the dependencies, obtain the source archive from +`GitHub `_. Once installed, ``cd`` into your ``diffpy.pdfgui`` directory +and run the following :: -If you would like to use other Python distributions except Anaconda, -it is necessary to install the required software separately. As an -example, on Ubuntu Linux some of the required software can be -installed using :: + pip install . - sudo apt-get install \ - python-setuptools python-wxtools python-numpy \ - python-matplotlib +Support and Contribute +---------------------- -To install the remaining packages see the installation instructions -at their respective web pages. +`Diffpy user group `_ is the discussion forum for general questions and discussions about the use of diffpy.pdfgui. Please join the diffpy.pdfgui users community by joining the Google group. The diffpy.pdfgui project welcomes your expertise and enthusiasm! -Other software -```````````````````````````````````````````````````````````````````````` +If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. -PDFgui can use an external structure viewer for displaying analyzed -structures. We have tested with several structure viewers such as +Feel free to fork the project and contribute. To install diffpy.pdfgui +in a development mode, with its sources being directly used by Python +rather than copied to a package directory, use the following in the root +directory :: -* AtomEye, http://li.mit.edu/A/Graphics/A/ -* PyMol, https://www.pymol.org -* VESTA, http://jp-minerals.org/vesta/en/ + pip install -e . -Other viewers should work as well, as long as they understand one of -the output structure formats supported by PDFgui. +To ensure code quality and to prevent accidental commits into the default branch, please set up the use of our pre-commit +hooks. +1. Install pre-commit in your working environment by running ``conda install pre-commit``. -DEVELOPMENT ------------------------------------------------------------------------- - -PDFgui is an open-source software available in a git repository at -https://github.com/diffpy/diffpy.pdfgui. - -Feel free to fork the project and contribute. To install PDFgui -in a development mode where the source files are used directly -rather than copied to a system directory, use :: +2. Initialize pre-commit (one time only) ``pre-commit install``. - python setup.py develop --user +Thereafter your code will be linted by black and isort and checked against flake8 before you can commit. +If it fails by black or isort, just rerun and it should pass (black and isort will modify the files so should +pass after they are modified). If the flake8 test fails please see the error messages and fix them manually before +trying to commit again. +Improvements and fixes are always appreciated. -CONTACTS ------------------------------------------------------------------------- - -For more information on PDFgui please visit the project web-page: +Before contribuing, please read our `Code of Conduct `_. -https://www.diffpy.org/products/pdfgui.html +Contact +------- -or email Prof. Simon Billinge at sb2896@columbia.edu +For more information on diffpy.pdfgui please visit the project `web-page `_ or email Prof. Simon Billinge at sb2896@columbia.edu. diff --git a/pyproject.toml b/pyproject.toml index e537e24a..273ea25e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,52 @@ +[build-system] +requires = ["setuptools>=62.0", "setuptools-git-versioning<2"] +build-backend = "setuptools.build_meta" + +[project] +name = "diffpy.pdfgui" +dynamic=['version'] +authors = [ + { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, +] +maintainers = [ + { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, +] +description = "GUI for PDF simulation and structure refinement." +keywords = ['PDF structure refinement GUI'] +readme = "README.rst" +requires-python = ">=3.10" +classifiers = [ + 'Development Status :: 5 - Production/Stable', + 'Environment :: Console', + 'Intended Audience :: Developers', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: BSD License', + 'Operating System :: MacOS :: MacOS X', + 'Operating System :: Microsoft :: Windows', + 'Operating System :: POSIX', + 'Operating System :: Unix', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Topic :: Scientific/Engineering :: Physics', + 'Topic :: Scientific/Engineering :: Chemistry', +] + +[project.urls] +Homepage = "https://github.com/diffpy/diffpy.pdfgui/" +Issues = "https://github.com/diffpy/diffpy.pdfgui/issues/" + +[tool.setuptools-git-versioning] +enabled = true +template = "{tag}" +dev_template = "{tag}" +dirty_template = "{tag}" + +[tool.setuptools.packages.find] +where = ["src"] # list of folders that contain the packages (["."] by default) +include = ["*"] # package names should match these glob patterns (["*"] by default) +exclude = ["diffpy.pdfgui.tests*"] # exclude packages matching these glob patterns (empty by default) +namespaces = false # to disable scanning PEP 420 namespaces (true by default) + [tool.black] line-length = 115 include = '\.pyi?$' From 0652110fa6279ae56f52884d71f8f61e25dac74c Mon Sep 17 00:00:00 2001 From: Tieqiong <123656525+Tieqiong@users.noreply.github.com> Date: Thu, 15 Aug 2024 18:00:33 -0400 Subject: [PATCH 15/24] Replace Caden's PR (#160) Minor copyright fixes and news update --- README.rst | 2 +- news/cookiecutter.rst | 23 +++++++++++++++++++ requirements/run.txt | 2 +- .../pdfgui/gui/wxextensions/textctrlutils.py | 2 +- src/diffpy/pdfgui/tests/debug.py | 15 ++++++------ src/diffpy/pdfgui/tests/run.py | 14 +++++------ 6 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 news/cookiecutter.rst diff --git a/README.rst b/README.rst index 809d4f3c..b9d7da0a 100644 --- a/README.rst +++ b/README.rst @@ -47,7 +47,7 @@ help menu and follow the tutorial instructions. A detailed description is available in the doc/Farrow-jpcm-2007.pdf paper. -REQUIREMENTS +Requirements ------------------------------------------------------------------------ PDFgui requires Python 3.8+ or 2.7 and several third-party diff --git a/news/cookiecutter.rst b/news/cookiecutter.rst new file mode 100644 index 00000000..83d30cd4 --- /dev/null +++ b/news/cookiecutter.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* Package reformatted to comply with new Billinge Group package structure + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/requirements/run.txt b/requirements/run.txt index 1bad6988..1d2bb168 100644 --- a/requirements/run.txt +++ b/requirements/run.txt @@ -1,4 +1,4 @@ -numpy==1.26 +numpy < 2.0.0 # Need to fix deprecations before 2.0.0 compat wxpython diffpy.pdffit2 diffpy.utils diff --git a/src/diffpy/pdfgui/gui/wxextensions/textctrlutils.py b/src/diffpy/pdfgui/gui/wxextensions/textctrlutils.py index 496b117f..4820cb8f 100644 --- a/src/diffpy/pdfgui/gui/wxextensions/textctrlutils.py +++ b/src/diffpy/pdfgui/gui/wxextensions/textctrlutils.py @@ -4,7 +4,7 @@ # # wxextensions by DANSE Diffraction group # Simon J. L. Billinge -# (c) 2009 trustees of Columbia University in the City of +# (c) 2009-2024 trustees of Columbia University in the City of # New York. # All rights reserved. # diff --git a/src/diffpy/pdfgui/tests/debug.py b/src/diffpy/pdfgui/tests/debug.py index 28926e22..c26a68d2 100644 --- a/src/diffpy/pdfgui/tests/debug.py +++ b/src/diffpy/pdfgui/tests/debug.py @@ -1,15 +1,16 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfgui Complex Modeling Initiative -# (c) 2016 Brookhaven Science Associates, -# Brookhaven National Laboratory. -# All rights reserved. +# (c) 2016 Brookhaven Science Associates, Brookhaven National Laboratory. +# (c) 2024 The Trustees of Columbia University in the City of New York. +# All rights reserved. # -# File coded by: Pavol Juhas +# File coded by: Billinge Group members and community contributors. # -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE.txt for license information. +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.pdfgui/graphs/contributors +# +# See LICENSE.rst for license information. # ############################################################################## diff --git a/src/diffpy/pdfgui/tests/run.py b/src/diffpy/pdfgui/tests/run.py index 461d7c01..2184cda6 100644 --- a/src/diffpy/pdfgui/tests/run.py +++ b/src/diffpy/pdfgui/tests/run.py @@ -1,15 +1,15 @@ #!/usr/bin/env python ############################################################################## # -# diffpy.pdfgui by DANSE Diffraction group -# Simon J. L. Billinge -# (c) 2012-2024 Trustees of the Columbia University -# in the City of New York. All rights reserved. +# (c) 2012-2024 The Trustees of Columbia University in the City of New York. +# All rights reserved. # -# File coded by: Pavol Juhas +# File coded by: Billinge Group members and community contributors. # -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE.txt for license information. +# See GitHub contributions for a more detailed list of contributors. +# https://github.com/diffpy/diffpy.pdfgui/graphs/contributors +# +# See LICENSE.rst for license information. # ############################################################################## From 6d0d9e7ec4d23b8cfce7a1a4eda459a0cf7d2438 Mon Sep 17 00:00:00 2001 From: Tieqiong <123656525+Tieqiong@users.noreply.github.com> Date: Sat, 17 Aug 2024 07:06:22 -0400 Subject: [PATCH 16/24] try workflow for testing (#161) * workflow for testing * test unittest * try Xvfb * try to remove no test ran line * [pre-commit.ci] auto fixes from pre-commit hooks * try to remove no test ran line * try pytest --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/main.yml | 57 ++++--- run_tests.py | 5 - setup.py | 161 ------------------ src/diffpy/pdfgui/tests/conftest.py | 5 + ...testaboutdialog.py => test_aboutdialog.py} | 0 ...testcalculation.py => test_calculation.py} | 0 .../{testconstraint.py => test_constraint.py} | 0 ...datasetpanels.py => test_datasetpanels.py} | 0 ...riespanel.py => test_dopingseriespanel.py} | 0 ...plotframe.py => test_extendedplotframe.py} | 0 .../{testfitdataset.py => test_fitdataset.py} | 0 ...stfitstructure.py => test_fitstructure.py} | 0 ...rowsdialog.py => test_insertrowsdialog.py} | 0 ...testloadproject.py => test_loadproject.py} | 0 .../{testmainframe.py => test_mainframe.py} | 0 .../{testparameter.py => test_parameter.py} | 0 ...meterspanel.py => test_parameterspanel.py} | 0 .../{testpdfdataset.py => test_pdfdataset.py} | 0 ...pdfguicontrol.py => test_pdfguicontrol.py} | 0 ...stpdfstructure.py => test_pdfstructure.py} | 0 ...repanel.py => test_phaseconfigurepanel.py} | 0 ...ctureviewer.py => test_structureviewer.py} | 0 ...anel.py => test_temperatureseriespanel.py} | 0 23 files changed, 39 insertions(+), 189 deletions(-) delete mode 100644 run_tests.py delete mode 100755 setup.py rename src/diffpy/pdfgui/tests/{testaboutdialog.py => test_aboutdialog.py} (100%) rename src/diffpy/pdfgui/tests/{testcalculation.py => test_calculation.py} (100%) rename src/diffpy/pdfgui/tests/{testconstraint.py => test_constraint.py} (100%) rename src/diffpy/pdfgui/tests/{testdatasetpanels.py => test_datasetpanels.py} (100%) rename src/diffpy/pdfgui/tests/{testdopingseriespanel.py => test_dopingseriespanel.py} (100%) rename src/diffpy/pdfgui/tests/{testextendedplotframe.py => test_extendedplotframe.py} (100%) rename src/diffpy/pdfgui/tests/{testfitdataset.py => test_fitdataset.py} (100%) rename src/diffpy/pdfgui/tests/{testfitstructure.py => test_fitstructure.py} (100%) rename src/diffpy/pdfgui/tests/{testinsertrowsdialog.py => test_insertrowsdialog.py} (100%) rename src/diffpy/pdfgui/tests/{testloadproject.py => test_loadproject.py} (100%) rename src/diffpy/pdfgui/tests/{testmainframe.py => test_mainframe.py} (100%) rename src/diffpy/pdfgui/tests/{testparameter.py => test_parameter.py} (100%) rename src/diffpy/pdfgui/tests/{testparameterspanel.py => test_parameterspanel.py} (100%) rename src/diffpy/pdfgui/tests/{testpdfdataset.py => test_pdfdataset.py} (100%) rename src/diffpy/pdfgui/tests/{testpdfguicontrol.py => test_pdfguicontrol.py} (100%) rename src/diffpy/pdfgui/tests/{testpdfstructure.py => test_pdfstructure.py} (100%) rename src/diffpy/pdfgui/tests/{testphaseconfigurepanel.py => test_phaseconfigurepanel.py} (100%) rename src/diffpy/pdfgui/tests/{teststructureviewer.py => test_structureviewer.py} (100%) rename src/diffpy/pdfgui/tests/{testtemperatureseriespanel.py => test_temperatureseriespanel.py} (100%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e3ade008..c26194af 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,31 +23,42 @@ jobs: path: . fetch-depth: 0 # avoid shallow clone with no tags - - name: Install Mamba - run: | - wget "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh" -O mambaforge.sh - bash mambaforge.sh -b -p $HOME/mambaforge - echo "$HOME/mambaforge/bin" >> $GITHUB_PATH - source $HOME/mambaforge/etc/profile.d/conda.sh - conda init bash + - name: initialize miniconda + # this uses a marketplace action that sets up miniconda in a way that makes + # it easier to use. I tried setting it up without this and it was a pain + uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: test + # environment.yml file is needed by this action. Because I don't want + # maintain this but rather maintain the requirements files it just has + # basic things in it like conda and pip + environment-file: ./environment.yml + python-version: 3 + auto-activate-base: false - - name: Create conda environment + - name: install diffpy.pdfgui requirements + shell: bash -l {0} run: | - source $HOME/mambaforge/etc/profile.d/conda.sh - conda create -n test_env python=3.12 xonsh regolith -c conda-forge -y - conda activate test_env - pip install case_insensitive_dict + conda config --set always_yes yes --set changeps1 no + conda config --add channels conda-forge + conda activate test + conda install --file requirements/run.txt + conda install --file requirements/test.txt + pip install . + + - name: Install Xvfb + run: sudo apt-get install -y xvfb - - name: Install dependencies + - name: Start Xvfb run: | - source $HOME/mambaforge/etc/profile.d/conda.sh - conda activate test_env - mamba install --file requirements/run.txt - mamba install --file requirements/test.txt - pip install -e . + export DISPLAY=:99 + Xvfb :99 -screen 0 1024x768x16 & - - name: Use Xvfb Action - uses: GabrielBB/xvfb-action@v1 - with: - run: | - bash -c "source $HOME/mambaforge/etc/profile.d/conda.sh && conda activate test_env && python -m run_tests.py" + - name: Validate diffpy.pdfgui + shell: bash -l {0} + run: | + export DISPLAY=:99 + conda activate test + coverage run -m pytest -vv -s + coverage report -m + codecov diff --git a/run_tests.py b/run_tests.py deleted file mode 100644 index a2a69494..00000000 --- a/run_tests.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python - -import diffpy.pdfgui.tests - -assert diffpy.pdfgui.tests.testdeps().wasSuccessful() diff --git a/setup.py b/setup.py deleted file mode 100755 index 1738fd08..00000000 --- a/setup.py +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env python - -# Installation script for diffpy.pdfgui - -"""PDFgui - graphical user interface for real space structure refinement. - -Packages: diffpy.pdfgui -Scripts: pdfgui -""" - -import os -import re -import sys - -from setuptools import find_packages, setup - -# Use this version when git data are not available, like in git zip archive. -# Update when tagging a new release. -FALLBACK_VERSION = "2.0.4" - -# determine if we run with Python 3. -PY3 = sys.version_info[0] == 3 - -# versioncfgfile holds version data for git commit hash and date. -# It must reside in the same directory as version.py. -MYDIR = os.path.dirname(os.path.abspath(__file__)) -versioncfgfile = os.path.join(MYDIR, "src/diffpy/pdfgui/version.cfg") -gitarchivecfgfile = os.path.join(MYDIR, ".gitarchive.cfg") - - -def gitinfo(): - from subprocess import PIPE, Popen - - kw = dict(stdout=PIPE, cwd=MYDIR, universal_newlines=True) - proc = Popen(["git", "describe", "--tags", "--match=v[[:digit:]]*"], **kw) - desc = proc.stdout.read() - proc = Popen(["git", "log", "-1", "--format=%H %ct %ci"], **kw) - glog = proc.stdout.read() - rv = {} - rv["version"] = ".post".join(desc.strip().split("-")[:2]).lstrip("v") - rv["commit"], rv["timestamp"], rv["date"] = glog.strip().split(None, 2) - return rv - - -def getversioncfg(): - if PY3: - from configparser import RawConfigParser - else: - from ConfigParser import RawConfigParser - vd0 = dict(version=FALLBACK_VERSION, commit="", date="", timestamp=0) - # first fetch data from gitarchivecfgfile, ignore if it is unexpanded - g = vd0.copy() - cp0 = RawConfigParser(vd0) - cp0.read(gitarchivecfgfile) - if len(cp0.get("DEFAULT", "commit")) > 20: - g = cp0.defaults() - mx = re.search(r"\btag: v(\d[^,]*)", g.pop("refnames")) - if mx: - g["version"] = mx.group(1) - # then try to obtain version data from git. - gitdir = os.path.join(MYDIR, ".git") - if os.path.exists(gitdir) or "GIT_DIR" in os.environ: - try: - g = gitinfo() - except OSError: - pass - # finally, check and update the active version file - cp = RawConfigParser() - cp.read(versioncfgfile) - d = cp.defaults() - rewrite = not d or (g["commit"] and (g["version"] != d.get("version") or g["commit"] != d.get("commit"))) - if rewrite: - cp.set("DEFAULT", "version", g["version"]) - cp.set("DEFAULT", "commit", g["commit"]) - cp.set("DEFAULT", "date", g["date"]) - cp.set("DEFAULT", "timestamp", g["timestamp"]) - with open(versioncfgfile, "w") as fp: - cp.write(fp) - return cp - - -versiondata = getversioncfg() - - -def dirglob(d, *patterns): - from glob import glob - - rv = [] - for p in patterns: - rv += glob(os.path.join(d, p)) - return rv - - -with open(os.path.join(MYDIR, "README.rst")) as fp: - long_description = fp.read() - -# define distribution -setup_args = dict( - name="diffpy.pdfgui", - version="3.0.5", - packages=find_packages(os.path.join(MYDIR, "src")), - package_dir={"": "src"}, - include_package_data=True, - test_suite="diffpy.pdfgui.tests", - entry_points={ - "gui_scripts": [ - "pdfgui=diffpy.pdfgui.applications.pdfgui:main", - ], - }, - data_files=[ - ("icons", dirglob("icons", "*.png", "*.ico")), - ("doc", dirglob("doc", "*.pdf")), - ("doc/manual", dirglob("doc/manual", "*.html", "*.pdf")), - ("doc/manual/images", dirglob("doc/manual/images", "*.png")), - ("doc/tutorial", dirglob("doc/tutorial", "*")), - ], - # manual and tutorial files should not be zipped - zip_safe=False, - install_requires=[ - "six", - "diffpy.structure>=3", - "diffpy.pdffit2", - "diffpy.utils", - ], - author="Simon J.L. Billinge", - author_email="sb2896@columbia.edu", - maintainer="Pavol Juhas", - maintainer_email="pavol.juhas@gmail.com", - url="https://github.com/diffpy/diffpy.pdfgui", - description="GUI for PDF simulation and structure refinement.", - long_description=long_description, - long_description_content_type="text/x-rst", - license="BSD", - keywords="PDF structure refinement GUI", - classifiers=[ - # List of possible values at - # http://pypi.python.org/pypi?:action=list_classifiers - "Development Status :: 5 - Production/Stable", - "Environment :: MacOS X", - "Environment :: Win32 (MS Windows)", - "Environment :: X11 Applications", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: BSD License", - "Operating System :: MacOS", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.10", - "Topic :: Scientific/Engineering :: Chemistry", - "Topic :: Scientific/Engineering :: Physics", - ], -) - -if __name__ == "__main__": - setup(**setup_args) - -# End of file diff --git a/src/diffpy/pdfgui/tests/conftest.py b/src/diffpy/pdfgui/tests/conftest.py index e3b63139..fefe798b 100644 --- a/src/diffpy/pdfgui/tests/conftest.py +++ b/src/diffpy/pdfgui/tests/conftest.py @@ -1,9 +1,14 @@ import json +import subprocess from pathlib import Path import pytest +def pytest_collection_modifyitems(session, config, items): + subprocess.run(["python", "-m", "diffpy.pdfgui.tests.rundeps"], check=True) + + @pytest.fixture def user_filesystem(tmp_path): base_dir = Path(tmp_path) diff --git a/src/diffpy/pdfgui/tests/testaboutdialog.py b/src/diffpy/pdfgui/tests/test_aboutdialog.py similarity index 100% rename from src/diffpy/pdfgui/tests/testaboutdialog.py rename to src/diffpy/pdfgui/tests/test_aboutdialog.py diff --git a/src/diffpy/pdfgui/tests/testcalculation.py b/src/diffpy/pdfgui/tests/test_calculation.py similarity index 100% rename from src/diffpy/pdfgui/tests/testcalculation.py rename to src/diffpy/pdfgui/tests/test_calculation.py diff --git a/src/diffpy/pdfgui/tests/testconstraint.py b/src/diffpy/pdfgui/tests/test_constraint.py similarity index 100% rename from src/diffpy/pdfgui/tests/testconstraint.py rename to src/diffpy/pdfgui/tests/test_constraint.py diff --git a/src/diffpy/pdfgui/tests/testdatasetpanels.py b/src/diffpy/pdfgui/tests/test_datasetpanels.py similarity index 100% rename from src/diffpy/pdfgui/tests/testdatasetpanels.py rename to src/diffpy/pdfgui/tests/test_datasetpanels.py diff --git a/src/diffpy/pdfgui/tests/testdopingseriespanel.py b/src/diffpy/pdfgui/tests/test_dopingseriespanel.py similarity index 100% rename from src/diffpy/pdfgui/tests/testdopingseriespanel.py rename to src/diffpy/pdfgui/tests/test_dopingseriespanel.py diff --git a/src/diffpy/pdfgui/tests/testextendedplotframe.py b/src/diffpy/pdfgui/tests/test_extendedplotframe.py similarity index 100% rename from src/diffpy/pdfgui/tests/testextendedplotframe.py rename to src/diffpy/pdfgui/tests/test_extendedplotframe.py diff --git a/src/diffpy/pdfgui/tests/testfitdataset.py b/src/diffpy/pdfgui/tests/test_fitdataset.py similarity index 100% rename from src/diffpy/pdfgui/tests/testfitdataset.py rename to src/diffpy/pdfgui/tests/test_fitdataset.py diff --git a/src/diffpy/pdfgui/tests/testfitstructure.py b/src/diffpy/pdfgui/tests/test_fitstructure.py similarity index 100% rename from src/diffpy/pdfgui/tests/testfitstructure.py rename to src/diffpy/pdfgui/tests/test_fitstructure.py diff --git a/src/diffpy/pdfgui/tests/testinsertrowsdialog.py b/src/diffpy/pdfgui/tests/test_insertrowsdialog.py similarity index 100% rename from src/diffpy/pdfgui/tests/testinsertrowsdialog.py rename to src/diffpy/pdfgui/tests/test_insertrowsdialog.py diff --git a/src/diffpy/pdfgui/tests/testloadproject.py b/src/diffpy/pdfgui/tests/test_loadproject.py similarity index 100% rename from src/diffpy/pdfgui/tests/testloadproject.py rename to src/diffpy/pdfgui/tests/test_loadproject.py diff --git a/src/diffpy/pdfgui/tests/testmainframe.py b/src/diffpy/pdfgui/tests/test_mainframe.py similarity index 100% rename from src/diffpy/pdfgui/tests/testmainframe.py rename to src/diffpy/pdfgui/tests/test_mainframe.py diff --git a/src/diffpy/pdfgui/tests/testparameter.py b/src/diffpy/pdfgui/tests/test_parameter.py similarity index 100% rename from src/diffpy/pdfgui/tests/testparameter.py rename to src/diffpy/pdfgui/tests/test_parameter.py diff --git a/src/diffpy/pdfgui/tests/testparameterspanel.py b/src/diffpy/pdfgui/tests/test_parameterspanel.py similarity index 100% rename from src/diffpy/pdfgui/tests/testparameterspanel.py rename to src/diffpy/pdfgui/tests/test_parameterspanel.py diff --git a/src/diffpy/pdfgui/tests/testpdfdataset.py b/src/diffpy/pdfgui/tests/test_pdfdataset.py similarity index 100% rename from src/diffpy/pdfgui/tests/testpdfdataset.py rename to src/diffpy/pdfgui/tests/test_pdfdataset.py diff --git a/src/diffpy/pdfgui/tests/testpdfguicontrol.py b/src/diffpy/pdfgui/tests/test_pdfguicontrol.py similarity index 100% rename from src/diffpy/pdfgui/tests/testpdfguicontrol.py rename to src/diffpy/pdfgui/tests/test_pdfguicontrol.py diff --git a/src/diffpy/pdfgui/tests/testpdfstructure.py b/src/diffpy/pdfgui/tests/test_pdfstructure.py similarity index 100% rename from src/diffpy/pdfgui/tests/testpdfstructure.py rename to src/diffpy/pdfgui/tests/test_pdfstructure.py diff --git a/src/diffpy/pdfgui/tests/testphaseconfigurepanel.py b/src/diffpy/pdfgui/tests/test_phaseconfigurepanel.py similarity index 100% rename from src/diffpy/pdfgui/tests/testphaseconfigurepanel.py rename to src/diffpy/pdfgui/tests/test_phaseconfigurepanel.py diff --git a/src/diffpy/pdfgui/tests/teststructureviewer.py b/src/diffpy/pdfgui/tests/test_structureviewer.py similarity index 100% rename from src/diffpy/pdfgui/tests/teststructureviewer.py rename to src/diffpy/pdfgui/tests/test_structureviewer.py diff --git a/src/diffpy/pdfgui/tests/testtemperatureseriespanel.py b/src/diffpy/pdfgui/tests/test_temperatureseriespanel.py similarity index 100% rename from src/diffpy/pdfgui/tests/testtemperatureseriespanel.py rename to src/diffpy/pdfgui/tests/test_temperatureseriespanel.py From 5a200f47ab07815dfc96d8de1f1651434e8f7b06 Mon Sep 17 00:00:00 2001 From: Tieqiong <123656525+Tieqiong@users.noreply.github.com> Date: Mon, 19 Aug 2024 15:00:51 -0400 Subject: [PATCH 17/24] remove unused files (#166) --- .travis.yml | 115 ---------------------------------------------------- rever.xsh | 22 ---------- 2 files changed, 137 deletions(-) delete mode 100644 .travis.yml delete mode 100644 rever.xsh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 99916b15..00000000 --- a/.travis.yml +++ /dev/null @@ -1,115 +0,0 @@ -dist: xenial -language: generic - -os: - - linux - - osx - -env: - - MYUSEMC=true MYPYTHON_VERSION=2.7 - - MYUSEMC=true MYPYTHON_VERSION=3.7 - - MYUSEMC=true MYPYTHON_VERSION=3.8 - - MYUSEMC=true MYPYTHON_VERSION=3.9 - - MYUSEMC=true MYPYTHON_VERSION=3.10 - - MYUSEMC=false - -matrix: - exclude: - - os: osx - env: MYUSEMC=false - -git: - depth: 999999 - -branches: - except: - - /^v[0-9]/ - - -before_install: - - MYNAME=diffpy.pdfgui - - MYCOMMIT="$(git rev-parse HEAD)" - - umask 022 - - git fetch origin --tags - - if ${MYUSEMC}; then - NOAPT=true; NOMC=false; - else - NOAPT=false; NOMC=true; - MYPIPFLAGS="--user"; - fi - - MYMCREPO=https://repo.anaconda.com/miniconda - - case ${TRAVIS_OS_NAME} in - linux) - MYMCBUNDLE=Miniconda3-latest-Linux-x86_64.sh ;; - osx) - MYMCBUNDLE=Miniconda3-latest-MacOSX-x86_64.sh ;; - *) - echo "Unsupported operating system." >&2; - exit 2 ;; - esac - - MYRUNDIR=${PWD}/build/rundir - - - mkdir -p ~/pkgs - - mkdir -p ${MYRUNDIR} - - cp .coveragerc ${MYRUNDIR}/ - - - $NOMC || pushd ~/pkgs - - $NOMC || wget --timestamping ${MYMCREPO}/${MYMCBUNDLE} - - $NOMC || test -x ~/mc/bin/conda || bash ${MYMCBUNDLE} -b -f -p ~/mc - - $NOMC || popd - - $NOMC || source ~/mc/bin/activate base - - $NOMC || conda update --yes conda - - $NOMC || conda install --yes conda-build conda-verify jinja2 - - $NOMC || conda create --name=testenv --yes python=${MYPYTHON_VERSION} coverage - - $NOMC || conda config --add channels diffpy - - - $NOAPT || test "${TRAVIS_OS_NAME}" = "linux" || exit $? - - $NOAPT || PATH="$(echo "$PATH" | sed 's,:/opt/pyenv/[^:]*,,g')" - - $NOAPT || test "$(which python)" = "/usr/bin/python" || ( - which python; exit 1) - - $NOAPT || sudo apt-get update -qq - - $NOAPT || sudo apt-get install -y - build-essential libgsl0-dev python-dev - python-numpy python-setuptools python-pip python-wxtools - python-matplotlib - - $NOAPT || devutils/makesdist - - $NOAPT || MYTARBUNDLE="$(ls -t "${PWD}"/dist/*.tar.gz | head -1)" - - -install: - - $NOMC || conda build --python=${MYPYTHON_VERSION} --no-test conda-recipe - - $NOMC || conda render --python=${MYPYTHON_VERSION} --output conda-recipe | - sed 's,.*/,,; s/[.]tar[.]bz2$//; s/-/=/g' > /tmp/mypackage.txt - - $NOMC || source activate testenv - - $NOMC || conda install --yes --use-local --file=/tmp/mypackage.txt - - - $NOAPT || pip install $MYPIPFLAGS coverage - # TODO - restore pip install once it works. - # - $NOAPT || pip install $MYPIPFLAGS "${MYTARBUNDLE}" - - $NOAPT || easy_install --user "${MYTARBUNDLE}" - - - cd ${MYRUNDIR} - - MYGIT_REV=$(python -c "import ${MYNAME}.version as v; print(v.__git_commit__)") - - if [[ "${MYCOMMIT}" != "${MYGIT_REV}" ]]; then - echo "Version mismatch ${MYCOMMIT} vs ${MYGIT_REV}."; - exit 1; - fi - - -before_script: - # provide shell functions to execute coverage with GUI support - - case ${TRAVIS_OS_NAME} in - linux) - guicoverage() { xvfb-run coverage "$@"; } ;; - osx) - guicoverage() { pythonw -m coverage "$@"; } ;; - esac - - -script: - - guicoverage run --source ${MYNAME} -m ${MYNAME}.tests.rundeps - - -after_success: - - pip install $MYPIPFLAGS codecov - - codecov diff --git a/rever.xsh b/rever.xsh deleted file mode 100644 index 523abe81..00000000 --- a/rever.xsh +++ /dev/null @@ -1,22 +0,0 @@ -$PROJECT = 'diffpy.pdfgui' -$ACTIVITIES = [ - 'version_bump', - 'changelog', - 'tag', # Creates a tag for the new version number - 'push_tag', # Pushes the tag up to the $TAG_REMOTE - 'pypi', # Sends the package to pypi - 'ghrelease' # Creates a Github release entry for the new tag - ] -$VERSION_BUMP_PATTERNS = [ - ('setup.py', 'version\s*=.*,', "version='$VERSION',") - ] -$CHANGELOG_FILENAME = 'CHANGELOG.rst' -$CHANGELOG_IGNORE = ['TEMPLATE.rst'] -$PUSH_TAG_REMOTE = 'git@github.com:diffpy/diffpy.pdfgui.git' # Repo to push tags to - -$GITHUB_ORG = 'diffpy' # Github org for Github releases and conda-forge -$GITHUB_REPO = 'diffpy.pdfgui' # Github repo for Github releases and conda-forge -$GHRELEASE_PREPEND = """See [CHANGELOG.md](CHANGELOG.md) for detailed release notes. - -The release is also available at [PyPI](https://pypi.org/project/diffpy.pdfgui/) and [Conda](https://anaconda.org/conda-forge/diffpy.pdfgui). -""" # release message From f78b4b99bc34de388f5b08dd714f6856450c024e Mon Sep 17 00:00:00 2001 From: Tieqiong <123656525+Tieqiong@users.noreply.github.com> Date: Tue, 20 Aug 2024 09:06:46 -0400 Subject: [PATCH 18/24] update requirements/run.txt (#165) * update requirements/run.txt, include right package * use matplotlib-base --- requirements/run.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements/run.txt b/requirements/run.txt index 1d2bb168..a8d863e1 100644 --- a/requirements/run.txt +++ b/requirements/run.txt @@ -1,5 +1,6 @@ numpy < 2.0.0 # Need to fix deprecations before 2.0.0 compat wxpython diffpy.pdffit2 +diffpy.structure diffpy.utils matplotlib-base From ef29c6aee3ab87df794be9c65c585f6abda14602 Mon Sep 17 00:00:00 2001 From: Tieqiong <123656525+Tieqiong@users.noreply.github.com> Date: Tue, 20 Aug 2024 09:09:48 -0400 Subject: [PATCH 19/24] remove dependency tests (#169) --- src/diffpy/pdfgui/tests/__init__.py | 24 ----------------------- src/diffpy/pdfgui/tests/conftest.py | 5 ----- src/diffpy/pdfgui/tests/rundeps.py | 30 ----------------------------- 3 files changed, 59 deletions(-) delete mode 100644 src/diffpy/pdfgui/tests/rundeps.py diff --git a/src/diffpy/pdfgui/tests/__init__.py b/src/diffpy/pdfgui/tests/__init__.py index 863e9949..40209476 100644 --- a/src/diffpy/pdfgui/tests/__init__.py +++ b/src/diffpy/pdfgui/tests/__init__.py @@ -78,28 +78,4 @@ def test(): return result -def testdeps(): - """Execute all unit tests for diffpy.pdfgui and its dependencies. - - Returns - ------- - result : `unittest.TestResult` - """ - from importlib import import_module - - modulenames = """ - diffpy.pdfgui.tests - diffpy.structure.tests - diffpy.pdffit2.tests - diffpy.utils.tests - """.split() - suite = unittest.TestSuite() - for mname in modulenames: - mod = import_module(mname) - suite.addTests(mod.testsuite()) - runner = unittest.TextTestRunner() - result = runner.run(suite) - return result - - # End of file diff --git a/src/diffpy/pdfgui/tests/conftest.py b/src/diffpy/pdfgui/tests/conftest.py index fefe798b..e3b63139 100644 --- a/src/diffpy/pdfgui/tests/conftest.py +++ b/src/diffpy/pdfgui/tests/conftest.py @@ -1,14 +1,9 @@ import json -import subprocess from pathlib import Path import pytest -def pytest_collection_modifyitems(session, config, items): - subprocess.run(["python", "-m", "diffpy.pdfgui.tests.rundeps"], check=True) - - @pytest.fixture def user_filesystem(tmp_path): base_dir = Path(tmp_path) diff --git a/src/diffpy/pdfgui/tests/rundeps.py b/src/diffpy/pdfgui/tests/rundeps.py deleted file mode 100644 index 9818fc86..00000000 --- a/src/diffpy/pdfgui/tests/rundeps.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python -############################################################################## -# -# diffpy.pdfgui by DANSE Diffraction group -# Simon J. L. Billinge -# (c) 2012-2024 Trustees of the Columbia University -# in the City of New York. All rights reserved. -# -# File coded by: Pavol Juhas -# -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE.txt for license information. -# -############################################################################## - -"""Convenience module for executing unit tests for all pdfgui dependencies - -python -m diffpy.pdfgui.tests.rundeps -""" - - -if __name__ == "__main__": - import sys - - from diffpy.pdfgui.tests import testdeps - - # produce zero exit code for a successful test - sys.exit(not testdeps().wasSuccessful()) - -# End of file From fccca8ac62ada45506b7f5a4a8afd1fdf28bc70b Mon Sep 17 00:00:00 2001 From: Tieqiong <123656525+Tieqiong@users.noreply.github.com> Date: Tue, 20 Aug 2024 09:20:24 -0400 Subject: [PATCH 20/24] fix deprecation warning when test (#170) * fix pkg_resources deprecation warning * use __name__ * daemon deprecation --- src/diffpy/pdfgui/control/pdfguicontrol.py | 2 +- src/diffpy/pdfgui/gui/extendedplotframe.py | 4 ++-- src/diffpy/pdfgui/gui/pdfguiglobals.py | 13 ++++++------- src/diffpy/pdfgui/tests/__init__.py | 5 ++--- src/diffpy/pdfgui/tests/testutils.py | 4 ++-- src/diffpy/pdfgui/version.py | 7 +++---- 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/diffpy/pdfgui/control/pdfguicontrol.py b/src/diffpy/pdfgui/control/pdfguicontrol.py index c6619417..f7d480f5 100644 --- a/src/diffpy/pdfgui/control/pdfguicontrol.py +++ b/src/diffpy/pdfgui/control/pdfguicontrol.py @@ -89,7 +89,7 @@ def run(self): def startQueue(self): """start queue manager""" - self.queueManager.setDaemon(True) + self.queueManager.daemon = True self.queueManager.start() def checkQueue(self): diff --git a/src/diffpy/pdfgui/gui/extendedplotframe.py b/src/diffpy/pdfgui/gui/extendedplotframe.py index 297a7670..bdc65f23 100644 --- a/src/diffpy/pdfgui/gui/extendedplotframe.py +++ b/src/diffpy/pdfgui/gui/extendedplotframe.py @@ -368,9 +368,9 @@ def legendBoxProperties(): return _lbp # figure out matplotlib version and appropriate names from matplotlib import __version__ as mplver - from pkg_resources import parse_version + from packaging.version import parse - if parse_version(mplver) >= parse_version("0.98.5"): + if parse(mplver) >= parse("0.98.5"): _lbp = { "loc": "upper right", "numpoints": 3, # number of points in the legend line diff --git a/src/diffpy/pdfgui/gui/pdfguiglobals.py b/src/diffpy/pdfgui/gui/pdfguiglobals.py index 96f20538..7de59ed0 100644 --- a/src/diffpy/pdfgui/gui/pdfguiglobals.py +++ b/src/diffpy/pdfgui/gui/pdfguiglobals.py @@ -16,8 +16,7 @@ """This module contains global parameters needed by PDFgui.""" import os.path - -from pkg_resources import Requirement, resource_filename +from importlib.resources import files from diffpy.pdfgui.gui import debugoptions @@ -31,23 +30,23 @@ isAltered = False # Resolve APPDATADIR base path to application data files. -_mydir = os.path.abspath(resource_filename(__name__, "")) +_mydir = os.path.abspath(str(files(__name__))) _upbasedir = os.path.normpath(_mydir + "/../../..") _development_mode = os.path.basename(_upbasedir) == "src" and os.path.isfile( - os.path.join(_upbasedir, "../setup.py") + os.path.join(_upbasedir, "../pyproject.toml") ) # Requirement must have egg-info. Do not use in _development_mode. -_req = Requirement.parse("diffpy.pdfgui") +_req = "diffpy.pdfgui" # pavol # APPDATADIR = (os.path.dirname(_upbasedir) if _development_mode -# else resource_filename(_req, "")) +# else str(files(_req))) # long if _development_mode: APPDATADIR = os.path.dirname(_mydir) else: - APPDATADIR = os.path.join(resource_filename(_req, ""), "diffpy/pdfgui") + APPDATADIR = str(files(_req)) APPDATADIR = os.path.abspath(APPDATADIR) diff --git a/src/diffpy/pdfgui/tests/__init__.py b/src/diffpy/pdfgui/tests/__init__.py index 40209476..beb24343 100644 --- a/src/diffpy/pdfgui/tests/__init__.py +++ b/src/diffpy/pdfgui/tests/__init__.py @@ -35,13 +35,12 @@ def testsuite(pattern=""): The TestSuite object containing the matching tests. """ import re + from importlib.resources import files from itertools import chain from os.path import dirname - from pkg_resources import resource_filename - loader = unittest.defaultTestLoader - thisdir = resource_filename(__name__, "") + thisdir = str(files(__name__)) depth = __name__.count(".") + 1 topdir = thisdir for i in range(depth): diff --git a/src/diffpy/pdfgui/tests/testutils.py b/src/diffpy/pdfgui/tests/testutils.py index 70147319..bf0e832f 100644 --- a/src/diffpy/pdfgui/tests/testutils.py +++ b/src/diffpy/pdfgui/tests/testutils.py @@ -29,9 +29,9 @@ def datafile(filename): - from pkg_resources import resource_filename + from importlib.resources import files - rv = resource_filename(__name__, "testdata/" + filename) + rv = str(files(__name__).joinpath("testdata", filename)) return rv diff --git a/src/diffpy/pdfgui/version.py b/src/diffpy/pdfgui/version.py index 416dcb46..037c944b 100644 --- a/src/diffpy/pdfgui/version.py +++ b/src/diffpy/pdfgui/version.py @@ -25,16 +25,15 @@ __all__ = ["__date__", "__git_commit__", "__timestamp__", "__version__"] import os.path - -from pkg_resources import resource_filename +from importlib.resources import files # obtain version information from the version.cfg file cp = dict(version="", date="", commit="", timestamp="0") -fcfg = resource_filename(__name__, "version.cfg") +fcfg = str(files(__name__).joinpath("version.cfg")) if not os.path.isfile(fcfg): # pragma: no cover from warnings import warn - warn('Package metadata not found, execute "./setup.py egg_info".') + warn("Package metadata not found.") fcfg = os.devnull with open(fcfg) as fp: kwords = [[w.strip() for w in line.split(" = ", 1)] for line in fp if line[:1].isalpha() and " = " in line] From 9cfafbaba2d348604dfaf4d1d3045d4cd3c3506d Mon Sep 17 00:00:00 2001 From: Tieqiong <123656525+Tieqiong@users.noreply.github.com> Date: Tue, 20 Aug 2024 09:21:35 -0400 Subject: [PATCH 21/24] rst file changes (#171) * Use the original license * other file changes * add a bit more in readme --- AUTHORS.rst | 14 +++--- LICENSE.rst | 130 +++++++++++++++++++++++++++------------------------- README.rst | 67 +++++++++++++-------------- 3 files changed, 105 insertions(+), 106 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index c942b8dd..99b148ea 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -15,17 +15,17 @@ This code was developed as part of the DiffPy project to create python modules for structure investigations from diffraction data. The main contributors to this package were - Chris Farrow - Jiwu Liu - Pavol Juhas + Chris Farrow, + Jiwu Liu, + Pavol Juhas, Dmitriy Bryndin Other current and former contributors of the DiffPy project include - Simon Billinge - Chris Farrow - Emil Bozin - Wenduo Zhou + Simon Billinge, + Chris Farrow, + Emil Bozin, + Wenduo Zhou, Peng Tian The DiffPy team is part of the Billinge Group at Columbia University in New York, diff --git a/LICENSE.rst b/LICENSE.rst index 0cebd08f..51d7148a 100644 --- a/LICENSE.rst +++ b/LICENSE.rst @@ -1,76 +1,80 @@ -Copyright (c) 2024, The Trustees of Columbia University -in the City of New York. -All rights reserved. +.. code-block:: text -This software was originally developed by the Billinge group as part -of the Distributed Data Analysis of Neutron Scattering Experiments -(DANSE) project funded by the US National Science Foundation under -grant DMR-0520547. Developments of PDFfit2 were funded by NSF grant -DMR-0304391 in the Billinge group, and with support from Michigan State -University and Columbia University. Any opinions, findings, and conclusions -or recommendations expressed in this material are those of the author(s) -and do not necessarily reflect the views of the respective funding bodies. -Subsequent development was done in the Billinge group at Columbia University -and then in collaboration between the Billinge group at Columbia and Pavol -Juhas at Brookhaven National Laboratory. Moving forward, PDFgui will be -maintained as a community project with contributions welcomed from many people. + This software was originally developed by the Billinge group as part + of the Distributed Data Analysis of Neutron Scattering Experiments + (DANSE) project funded by the US National Science Foundation under + grant DMR-0520547. Developments of PDFfit2 were funded by NSF grant + DMR-0304391 in the Billinge group, and with support from Michigan State + University and Columbia University. Any opinions, findings, and conclusions + or recommendations expressed in this material are those of the author(s) + and do not necessarily reflect the views of the respective funding bodies. + Subsequent development was done in the Billinge group at Columbia University + and then in collaboration between the Billinge group at Columbia and Pavol + Juhas at Brookhaven National Laboratory. Moving forward, PDFgui will be + maintained as a community project with contributions welcomed from many people. -If you use this program to do productive scientific research that leads -to publication, we ask that you acknowledge use of the program by citing -the following paper in your publication: + If you use this program to do productive scientific research that leads + to publication, we ask that you acknowledge use of the program by citing + the following paper in your publication: - C. L. Farrow, P. Juhas, J. W. Liu, D. Bryndin, E. S. Bozin, - J. Bloch, Th. Proffen and S. J. L. Billinge, PDFfit2 and - PDFgui: computer programs for studying nanostructure in - crystals, J. Phys.: Condens. Matter 19, 335219 (2007) + C. L. Farrow, P. Juhas, J. W. Liu, D. Bryndin, E. S. Bozin, + J. Bloch, Th. Proffen and S. J. L. Billinge, PDFfit2 and + PDFgui: computer programs for studying nanostructure in + crystals, J. Phys.: Condens. Matter 19, 335219 (2007) -Up to the release 1.1.2 (February 2017) the copyright was held by -the institutions that hosted the work as follows: -Copyright 2006-2007, Board of Trustees of Michigan State University, -Copyright 2008-2012, Board of Trustees of Columbia University in the -city of New York. -Copyright 2013, Brookhaven National Laboratory (Copyright holder -indicated in each source file). + Up to the release 1.1.2 (February 2017) the copyright was held by + the institutions that hosted the work as follows: + Copyright 2006-2007, Board of Trustees of Michigan State University, + Copyright 2008-2012, Board of Trustees of Columbia University in the + city of New York. + Copyright 2013, Brookhaven National Laboratory (Copyright holder + indicated in each source file). -As of February 2017, and the 1.1.2 release, PDFgui has moved to a shared copyright model. + As of February 2017, and the 1.1.2 release, PDFgui has moved to a shared copyright model. -PDFgui uses a shared copyright model. Each contributor maintains copyright over their -contributions to PDFgui. But, it is important to note that these contributions are -typically only changes to the repositories. Thus, the PDFgui source code, in its entirety, -is not the copyright of any single person or institution. Instead, it is the collective -copyright of the entire PDFgui Development Team. If individual contributors want to -maintain a record of what changes/contributions they have specific copyright on, they -should indicate their copyright in the commit message of the change, when they commit -the change to one of the PDFgui repositories. + PDFgui uses a shared copyright model. Each contributor maintains copyright over their + contributions to PDFgui. But, it is important to note that these contributions are + typically only changes to the repositories. Thus, the PDFgui source code, in its entirety, + is not the copyright of any single person or institution. Instead, it is the collective + copyright of the entire PDFgui Development Team. If individual contributors want to + maintain a record of what changes/contributions they have specific copyright on, they + should indicate their copyright in the commit message of the change, when they commit + the change to one of the PDFgui repositories. -The PDFgui Development Team is the set of all contributors to the PDFgui project. -A full list can be obtained from the git version control logs. + The PDFgui Development Team is the set of all contributors to the PDFgui project. + A full list can be obtained from the git version control logs. -For more information please visit the project web-page: - https://www.diffpy.org -or email Prof. Simon Billinge at sb2896@columbia.edu + For more information please visit the project web-page: + https://www.diffpy.org + or email Prof. Simon Billinge at sb2896@columbia.edu -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER "AS IS". COPYRIGHT HOLDER + EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES AND CONDITIONS, EITHER + EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY, TITLE, FITNESS, ADEQUACY OR SUITABILITY + FOR A PARTICULAR PURPOSE, AND ANY WARRANTIES OF FREEDOM FROM + INFRINGEMENT OF ANY DOMESTIC OR FOREIGN PATENT, COPYRIGHTS, TRADE + SECRETS OR OTHER PROPRIETARY RIGHTS OF ANY PARTY. IN NO EVENT SHALL + COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE OR RELATING TO THIS AGREEMENT, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. diff --git a/README.rst b/README.rst index b9d7da0a..3f1a9a10 100644 --- a/README.rst +++ b/README.rst @@ -35,45 +35,34 @@ .. |Tracking| image:: https://img.shields.io/badge/issue_tracking-github-blue :target: https://github.com/diffpy/diffpy.pdfgui/issues -diffpy.pdfgui -======================================================================== - Graphical user interface program for structure refinements to atomic pair distribution function. +For users who do not have the expertise or necessity for command +line analysis, PDFgui is a convenient and easy to use graphical front +end for the PDFfit2 refinement program. It is capable of full-profile +fitting of the atomic pair distribution function (PDF) derived from x-ray +or neutron diffraction data and comes with built in graphical and structure +visualization capabilities. + PDFgui is a friendly interface to the PDFfit2 refinement engine, with many powerful extensions. To get started, please open the manual from the -help menu and follow the tutorial instructions. A detailed description -is available in the doc/Farrow-jpcm-2007.pdf paper. - - -Requirements ------------------------------------------------------------------------- - -PDFgui requires Python 3.8+ or 2.7 and several third-party -libraries that are used by PDFgui and its components. +help menu and follow the tutorial instructions. A detailed description +is available in `this paper `_. -* setuptools - tools for installing Python packages -* wxpython - graphical user interface toolkit for Python -* numpy - library for scientific computing with Python -* matplotlib - Python 2D plotting library -* diffpy.pdffit2 - computational engine for PDFgui, - https://github.com/diffpy/diffpy.pdffit2 -* diffpy.structure - simple storage and manipulation of atomic - structures, https://github.com/diffpy/diffpy.structure -* diffpy.utils - shared helper utilities for wx GUI, - https://github.com/diffpy/diffpy.utils +For more information about diffpy.pdfgui, please consult our +`online documentation `_. -We recommend to use `Anaconda Python `_ -which allows to conveniently install PDFgui and all its software -dependencies with a single command. +Citation +-------- -Please note that the Python3 PDFgui will read .ddp3 files. It is also -possible for it to read .ddp files that were saved by the Python2 PDFgui -but it will sometimes fail to read these. We are working on a solution -that will be available in a future version. +If you use diffpy.pdfgui in a scientific publication, we would like you to +cite this package as - diffpy.pdfgui Package, https://github.com/diffpy/diffpy.pdfgui + C L Farrow, P Juhas, J W Liu, D Bryndin, E S Božin, + J Bloch, Th Proffen and S J L Billinge, PDFfit2 and PDFgui: + computer programs for studying nanostructure in crystals, J. Phys.: + Condens. Matter 19 (2007) 335219. doi:10.1088/0953-8984/19/33/335219 Installation ------------ @@ -98,7 +87,8 @@ Then, to fully install ``diffpy.pdfgui`` in our active environment, run :: Another option is to use ``pip`` to download and install the latest release from `Python Package Index `_. -To install using ``pip`` into your ``diffpy.pdfgui_env`` environment, we will also have to install dependencies :: +To install using ``pip`` into your ``diffpy.pdfgui_env`` environment, we will also have to +install dependencies :: pip install -r https://raw.githubusercontent.com/diffpy/diffpy.pdfgui/main/requirements/run.txt @@ -107,17 +97,21 @@ and then install the package :: pip install diffpy.pdfgui If you prefer to install from sources, after installing the dependencies, obtain the source archive from -`GitHub `_. Once installed, ``cd`` into your ``diffpy.pdfgui`` directory -and run the following :: +`GitHub `_. Once installed, ``cd`` into your ``diffpy.pdfgui`` +directory and run the following :: pip install . Support and Contribute ---------------------- -`Diffpy user group `_ is the discussion forum for general questions and discussions about the use of diffpy.pdfgui. Please join the diffpy.pdfgui users community by joining the Google group. The diffpy.pdfgui project welcomes your expertise and enthusiasm! +`Diffpy user group `_ is the discussion forum for general +questions and discussions about the use of diffpy.pdfgui. Please join the diffpy.pdfgui users community +by joining the Google group. The diffpy.pdfgui project welcomes your expertise and enthusiasm! -If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. +If you see a bug or want to request a feature, please `report it as an issue `_ +and/or `submit a fix as a PR `_. You can also post it to the +`Diffpy user group `_. Feel free to fork the project and contribute. To install diffpy.pdfgui in a development mode, with its sources being directly used by Python @@ -145,4 +139,5 @@ Before contribuing, please read our `Code of Conduct `_ or email Prof. Simon Billinge at sb2896@columbia.edu. +For more information on diffpy.pdfgui please visit the project `web-page `_ or email Prof. Simon Billinge +at sb2896@columbia.edu. From 1ae626da6364cb7ede50b83495bf9ee1a11a952b Mon Sep 17 00:00:00 2001 From: Tieqiong <123656525+Tieqiong@users.noreply.github.com> Date: Tue, 20 Aug 2024 09:22:02 -0400 Subject: [PATCH 22/24] remove epydoc (#173) --- doc/epydoc/Makefile | 17 -------------- doc/epydoc/epydoc.cfg | 54 ------------------------------------------- 2 files changed, 71 deletions(-) delete mode 100644 doc/epydoc/Makefile delete mode 100644 doc/epydoc/epydoc.cfg diff --git a/doc/epydoc/Makefile b/doc/epydoc/Makefile deleted file mode 100644 index 7636f7b8..00000000 --- a/doc/epydoc/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -PKGNAME = diffpy.pdfgui -OUTPUT = html -WEBDOCDIR = login.cacr.caltech.edu:/cacr/home/proj/danse/docs.danse.us/docroot/diffraction - - -all: - epydoc --config=epydoc.cfg --output=$(OUTPUT) \ - --name=$(PKGNAME) $(PKGNAME) - - -clean: - /bin/rm -rf $(OUTPUT) - - -publish: - rsync -e /usr/bin/ssh -va --chmod=a+rwx,o-w,Dg+s,Fa-x \ - $(OUTPUT)/ $(WEBDOCDIR)/$(PKGNAME) diff --git a/doc/epydoc/epydoc.cfg b/doc/epydoc/epydoc.cfg deleted file mode 100644 index d2a36bce..00000000 --- a/doc/epydoc/epydoc.cfg +++ /dev/null @@ -1,54 +0,0 @@ -[epydoc] - -# docformat -# The default markup language for docstrings, for modules that do -# not define __docformat__. Defaults to epytext. -docformat: plaintext - -# The type of output that should be generated. Should be one -# of: html, text, latex, dvi, ps, pdf. -output: html - -# An integer indicating how verbose epydoc should be. The default -# value is 0; negative values will supress warnings and errors; -# positive values will give more verbose output. -verbosity: 0 - -# A boolean value indicating that Epydoc should show a tracaback -# in case of unexpected error. By default don't show tracebacks -debug: 0 - -# If True, don't try to use colors or cursor control when doing -# textual output. The default False assumes a rich text prompt -simple-term: 1 - -# The format for showing inheritance objects. -# It should be one of: 'grouped', 'listed', 'included'. -inheritance: grouped - -# Whether or not to inclue private variables. (Even if included, -# private variables will be hidden by default.) -private: yes - -# Whether or not to list each module's imports. -imports: yes - -# Whether or not to include syntax highlighted source code in -# the output (HTML only). -sourcecode: yes - -# Whether or not to includea a page with Epydoc log, containing -# effective option at the time of generation and the reported logs. -include-log: no - -### Output options - -# The documented project's name. -#name: diffpy.FIXME - -# The CSS stylesheet for HTML output. Can be the name of a builtin -# stylesheet, or the name of a file. -css: white - -# The documented project's URL. -url: https://www.diffpy.org/ From 9696402bed860a2deeb1720d18ca806852455dca Mon Sep 17 00:00:00 2001 From: Tieqiong <123656525+Tieqiong@users.noreply.github.com> Date: Tue, 20 Aug 2024 09:29:14 -0400 Subject: [PATCH 23/24] build doc (#174) * build doc * pre commit --- doc/source/api/diffpy.pdfgui.applications.rst | 20 + doc/source/api/diffpy.pdfgui.control.rst | 140 +++++++ .../api/diffpy.pdfgui.example_package.rst | 31 -- doc/source/api/diffpy.pdfgui.gui.design.rst | 9 + doc/source/api/diffpy.pdfgui.gui.rst | 373 ++++++++++++++++++ .../api/diffpy.pdfgui.gui.wxextensions.rst | 60 +++ doc/source/api/diffpy.pdfgui.rst | 26 +- doc/source/index.rst | 61 ++- doc/source/license.rst | 112 ++++-- doc/{TUTORIAL.rst => source/tutorial.rst} | 39 +- 10 files changed, 771 insertions(+), 100 deletions(-) create mode 100644 doc/source/api/diffpy.pdfgui.applications.rst create mode 100644 doc/source/api/diffpy.pdfgui.control.rst delete mode 100644 doc/source/api/diffpy.pdfgui.example_package.rst create mode 100644 doc/source/api/diffpy.pdfgui.gui.design.rst create mode 100644 doc/source/api/diffpy.pdfgui.gui.rst create mode 100644 doc/source/api/diffpy.pdfgui.gui.wxextensions.rst rename doc/{TUTORIAL.rst => source/tutorial.rst} (85%) diff --git a/doc/source/api/diffpy.pdfgui.applications.rst b/doc/source/api/diffpy.pdfgui.applications.rst new file mode 100644 index 00000000..c9fc29a7 --- /dev/null +++ b/doc/source/api/diffpy.pdfgui.applications.rst @@ -0,0 +1,20 @@ +:tocdepth: -1 + +diffpy.pdfgui.applications package +================================== + +.. automodule:: diffpy.pdfgui.applications + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +diffpy.pdfgui.applications.pdfgui module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.applications.pdfgui + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/diffpy.pdfgui.control.rst b/doc/source/api/diffpy.pdfgui.control.rst new file mode 100644 index 00000000..01ed5579 --- /dev/null +++ b/doc/source/api/diffpy.pdfgui.control.rst @@ -0,0 +1,140 @@ +:tocdepth: -1 + +diffpy.pdfgui.control package +============================= + +.. automodule:: diffpy.pdfgui.control + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +diffpy.pdfgui.control.pdfcomponent module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.control.pdfcomponent + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.control.constraint module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.control.constraint + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.control.controlerrors module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.control.controlerrors + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.control.pdflist module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.control.pdflist + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.control.pdfguimacros module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.control.pdfguimacros + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.control.calculation module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.control.calculation + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.control.pdfstructure module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.control.pdfstructure + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.control.fitdataset module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.control.fitdataset + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.control.structureviewer module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.control.structureviewer + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.control.plotter module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.control.plotter + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.control.fitstructure module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.control.fitstructure + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.control.fitting module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.control.fitting + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.control.pdfguicontrol module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.control.pdfguicontrol + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.control.parameter module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.control.parameter + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.control.pdfdataset module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.control.pdfdataset + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.control.organizer module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.control.organizer + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/diffpy.pdfgui.example_package.rst b/doc/source/api/diffpy.pdfgui.example_package.rst deleted file mode 100644 index 0390b965..00000000 --- a/doc/source/api/diffpy.pdfgui.example_package.rst +++ /dev/null @@ -1,31 +0,0 @@ -.. _example_package documentation: - -|title| -======= - -.. |title| replace:: diffpy.pdfgui.example_package package - -.. automodule:: diffpy.pdfgui.example_package - :members: - :undoc-members: - :show-inheritance: - -|foo| ------ - -.. |foo| replace:: diffpy.pdfgui.example_package.foo module - -.. automodule:: diffpy.pdfgui.example_package.foo - :members: - :undoc-members: - :show-inheritance: - -|bar| ------ - -.. |bar| replace:: diffpy.pdfgui.example_package.bar module - -.. automodule:: diffpy.pdfgui.example_package.foo - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/source/api/diffpy.pdfgui.gui.design.rst b/doc/source/api/diffpy.pdfgui.gui.design.rst new file mode 100644 index 00000000..049857ee --- /dev/null +++ b/doc/source/api/diffpy.pdfgui.gui.design.rst @@ -0,0 +1,9 @@ +:tocdepth: -1 + +diffpy.pdfgui.gui.design package +================================ + +.. automodule:: diffpy.pdfgui.gui.design + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/diffpy.pdfgui.gui.rst b/doc/source/api/diffpy.pdfgui.gui.rst new file mode 100644 index 00000000..8e2c9750 --- /dev/null +++ b/doc/source/api/diffpy.pdfgui.gui.rst @@ -0,0 +1,373 @@ +:tocdepth: -1 + +diffpy.pdfgui.gui package +========================= + +.. automodule:: diffpy.pdfgui.gui + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + :titlesonly: + + diffpy.pdfgui.gui.design + diffpy.pdfgui.gui.wxextensions + +Submodules +---------- + +diffpy.pdfgui.gui.phaseresultspanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.phaseresultspanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.tooltips module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.tooltips + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.bondlengthdialog module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.bondlengthdialog + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.datasetresultspanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.datasetresultspanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.phaseconfigurepanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.phaseconfigurepanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.supercelldialog module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.supercelldialog + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.sgstructuredialog module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.sgstructuredialog + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.sgconstraindialog module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.sgconstraindialog + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.bondangledialog module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.bondangledialog + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.adddatapanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.adddatapanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.phaseconstraintspanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.phaseconstraintspanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.temperatureseriespanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.temperatureseriespanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.datasetconstraintpanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.datasetconstraintpanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.journalpanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.journalpanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.debugoptions module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.debugoptions + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.fittree module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.fittree + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.extendedplotframe module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.extendedplotframe + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.preferencespanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.preferencespanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.addphasepanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.addphasepanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.rseriespanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.rseriespanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.fitnotebookpanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.fitnotebookpanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.aboutdialog module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.aboutdialog + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.paneltest module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.paneltest + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.dopingseriespanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.dopingseriespanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.blankpanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.blankpanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.datasetconfigurepanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.datasetconfigurepanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.errorreportdialog_control_fix module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.errorreportdialog_control_fix + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.plotpanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.plotpanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.welcomepanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.welcomepanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.pdfpanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.pdfpanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.resultspanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.resultspanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.outputpanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.outputpanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.insertrowsdialog module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.insertrowsdialog + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.errorreportdialog module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.errorreportdialog + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.parameterspanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.parameterspanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.datasetpanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.datasetpanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.main module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.main + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.pdfguiglobals module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.pdfguiglobals + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.phasepanelutils module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.phasepanelutils + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.phasenotebookpanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.phasenotebookpanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.errorwrapper module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.errorwrapper + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.windowperspective module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.windowperspective + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.calculationpanel module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.calculationpanel + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.mainframe module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.mainframe + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/diffpy.pdfgui.gui.wxextensions.rst b/doc/source/api/diffpy.pdfgui.gui.wxextensions.rst new file mode 100644 index 00000000..eee1258e --- /dev/null +++ b/doc/source/api/diffpy.pdfgui.gui.wxextensions.rst @@ -0,0 +1,60 @@ +:tocdepth: -1 + +diffpy.pdfgui.gui.wxextensions package +====================================== + +.. automodule:: diffpy.pdfgui.gui.wxextensions + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +diffpy.pdfgui.gui.wxextensions.wx12 module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.wxextensions.wx12 + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.wxextensions.listctrls module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.wxextensions.listctrls + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.wxextensions.validators module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.wxextensions.validators + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.wxextensions.autowidthlabelsgrid module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.wxextensions.autowidthlabelsgrid + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.wxextensions.textctrlutils module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.wxextensions.textctrlutils + :members: + :undoc-members: + :show-inheritance: + +diffpy.pdfgui.gui.wxextensions.paneldialog module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.gui.wxextensions.paneldialog + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/diffpy.pdfgui.rst b/doc/source/api/diffpy.pdfgui.rst index 8166640e..eaf4bd3f 100644 --- a/doc/source/api/diffpy.pdfgui.rst +++ b/doc/source/api/diffpy.pdfgui.rst @@ -1,9 +1,7 @@ :tocdepth: -1 -|title| -======= - -.. |title| replace:: diffpy.pdfgui package +diffpy.pdfgui package +===================== .. automodule:: diffpy.pdfgui :members: @@ -14,17 +12,27 @@ Subpackages ----------- .. toctree:: - diffpy.pdfgui.example_package + :titlesonly: + + diffpy.pdfgui.gui + diffpy.pdfgui.applications + diffpy.pdfgui.control Submodules ---------- -|module| --------- +diffpy.pdfgui.utils module +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.pdfgui.utils + :members: + :undoc-members: + :show-inheritance: -.. |module| replace:: diffpy.pdfgui.example_submodule module +diffpy.pdfgui.tui module +^^^^^^^^^^^^^^^^^^^^^^^^ -.. automodule:: diffpy.pdfgui.example_submodule +.. automodule:: diffpy.pdfgui.tui :members: :undoc-members: :show-inheritance: diff --git a/doc/source/index.rst b/doc/source/index.rst index 7a8854ce..f60279c9 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -4,21 +4,66 @@ .. |title| replace:: diffpy.pdfgui documentation -diffpy.pdfgui - GUI for PDF simulation and structure refinement.. +diffpy.pdfgui - GUI for PDF simulation and structure refinement. -| Software version |release|. -| Last updated |today|. +| Software version |release| +| Last updated |today| + +For users who do not have the expertise or necessity for command +line analysis, PDFgui is a convenient and easy to use graphical front +end for the PDFfit2 refinement program. It is capable of full-profile +fitting of the atomic pair distribution function (PDF) derived from x-ray +or neutron diffraction data and comes with built in graphical and structure +visualization capabilities. + +PDFgui is a friendly interface to the PDFfit2 refinement engine, with many +powerful extensions. To get started, please open the `manual <../../manual/pdfgui.html>`_ +from the help menu or follow the `tutorial instructions `_. ======= Authors ======= -diffpy.pdfgui is developed by Billinge Group -and its community contributors. +DiffPy was initiated as part of the Distributed Data Analysis of Neutron +Scattering Experiments (DANSE) project, funded by the National Science +Foundation under grant DMR-0520547. Any opinions, findings, and conclusions or +recommendations expressed in this material are those of the author(s) +and do not necessarily reflect the views of the NSF. + +The main contributors to this package were + + Chris Farrow, + Jiwu Liu, + Pavol Juhas, + Dmitriy Bryndin + +Other current and former contributors of the DiffPy project include + + Simon Billinge, + Chris Farrow, + Emil Bozin, + Wenduo Zhou, + Peng Tian + +The DiffPy team is part of the Billinge Group at Columbia University in New York, +within the Department of Applied Physics and Applied Mathematics. For a detailed list of contributors see https://github.com/diffpy/diffpy.pdfgui/graphs/contributors. +========= +Reference +========= + +If you use this program for a scientific research that leads to publication, +we ask that you acknowledge use of the program by citing the following paper +in your publication: + + C L Farrow, P Juhas, J W Liu, D Bryndin, E S Božin, + J Bloch, Th Proffen and S J L Billinge, `PDFfit2 and PDFgui: + computer programs for studying nanostructure in crystals `_, + J. Phys.: Condens. Matter 19 (2007) 335219. + ============ Installation ============ @@ -30,7 +75,11 @@ file included with the distribution. Tutorial ======== -A tutorial for this package can be found here: `<../TUTORIAL.rst>` +The tutorial for the package can be found here: + +.. toctree:: + + tutorial ================= Table of contents diff --git a/doc/source/license.rst b/doc/source/license.rst index cfab61c2..9273f487 100644 --- a/doc/source/license.rst +++ b/doc/source/license.rst @@ -5,35 +5,83 @@ License ####### -OPEN SOURCE LICENSE AGREEMENT -============================= -BSD 3-Clause License - -Copyright (c) 2024, The Trustees of Columbia University in -the City of New York. -All Rights Reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.. code-block:: text + + This software was originally developed by the Billinge group as part + of the Distributed Data Analysis of Neutron Scattering Experiments + (DANSE) project funded by the US National Science Foundation under + grant DMR-0520547. Developments of PDFfit2 were funded by NSF grant + DMR-0304391 in the Billinge group, and with support from Michigan State + University and Columbia University. Any opinions, findings, and conclusions + or recommendations expressed in this material are those of the author(s) + and do not necessarily reflect the views of the respective funding bodies. + Subsequent development was done in the Billinge group at Columbia University + and then in collaboration between the Billinge group at Columbia and Pavol + Juhas at Brookhaven National Laboratory. Moving forward, PDFgui will be + maintained as a community project with contributions welcomed from many people. + + If you use this program to do productive scientific research that leads + to publication, we ask that you acknowledge use of the program by citing + the following paper in your publication: + + C. L. Farrow, P. Juhas, J. W. Liu, D. Bryndin, E. S. Bozin, + J. Bloch, Th. Proffen and S. J. L. Billinge, PDFfit2 and + PDFgui: computer programs for studying nanostructure in + crystals, J. Phys.: Condens. Matter 19, 335219 (2007) + + Up to the release 1.1.2 (February 2017) the copyright was held by + the institutions that hosted the work as follows: + Copyright 2006-2007, Board of Trustees of Michigan State University, + Copyright 2008-2012, Board of Trustees of Columbia University in the + city of New York. + Copyright 2013, Brookhaven National Laboratory (Copyright holder + indicated in each source file). + + As of February 2017, and the 1.1.2 release, PDFgui has moved to a shared copyright model. + + PDFgui uses a shared copyright model. Each contributor maintains copyright over their + contributions to PDFgui. But, it is important to note that these contributions are + typically only changes to the repositories. Thus, the PDFgui source code, in its entirety, + is not the copyright of any single person or institution. Instead, it is the collective + copyright of the entire PDFgui Development Team. If individual contributors want to + maintain a record of what changes/contributions they have specific copyright on, they + should indicate their copyright in the commit message of the change, when they commit + the change to one of the PDFgui repositories. + + The PDFgui Development Team is the set of all contributors to the PDFgui project. + A full list can be obtained from the git version control logs. + + For more information please visit the project web-page: + https://www.diffpy.org + or email Prof. Simon Billinge at sb2896@columbia.edu + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER "AS IS". COPYRIGHT HOLDER + EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES AND CONDITIONS, EITHER + EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY, TITLE, FITNESS, ADEQUACY OR SUITABILITY + FOR A PARTICULAR PURPOSE, AND ANY WARRANTIES OF FREEDOM FROM + INFRINGEMENT OF ANY DOMESTIC OR FOREIGN PATENT, COPYRIGHTS, TRADE + SECRETS OR OTHER PROPRIETARY RIGHTS OF ANY PARTY. IN NO EVENT SHALL + COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE OR RELATING TO THIS AGREEMENT, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. diff --git a/doc/TUTORIAL.rst b/doc/source/tutorial.rst similarity index 85% rename from doc/TUTORIAL.rst rename to doc/source/tutorial.rst index 2cb5b5ce..d8a1c035 100644 --- a/doc/TUTORIAL.rst +++ b/doc/source/tutorial.rst @@ -1,24 +1,22 @@ -=============================================================================== - Welcome to the PDFgui tutorial -=============================================================================== +:tocdepth: -1 -The latest version of this document is available online at +.. index:: tutorial -`http://danse.us/trac/diffraction/browser/diffraction/diffpy/diffpy/pdfgui/doc`_ +Tutorial +######## Please, have your co-workers or students try it out and let us know if you have any comments. We want to make it really easy for the new users to get started with PDFgui. -------------------------------------------------------------------------------- - +======================================= Lesson 1: Creating simple fit of Ni PDF ----------------------------------------- +======================================= Input files: -* ``_ - experimental X-ray PDF data -* ``_ - Ni f.c.c. structure in PDFfit format +* `Ni-xray.gr <../../tutorial/Ni-xray.gr>`_ - experimental X-ray PDF data +* `Ni.stru <../../tutorial/Ni.stru>`_ - Ni f.c.c. structure in PDFfit format Procedure: @@ -68,10 +66,9 @@ Procedure: 8. Save your project for later use. -------------------------------------------------------------------------------- - +====================================================== Lesson 2: Build structure model using crystal symmetry ------------------------------------------------------- +====================================================== In the previous example the initial structure was defined by an existing file. However, PDFgui makes it very easy to build a structure model from scratch and constrain it with arbitrary crystal symmetry. @@ -101,10 +98,9 @@ In the previous example the initial structure was defined by an existing file. H 5. Continue the fit as in Lesson 1. -------------------------------------------------------------------------------- - +============================= Lesson 3: Multi-stage fitting ------------------------------ +============================= Learn how to string together fits. @@ -136,13 +132,12 @@ Learn how to string together fits. 1. Run the fit as in Lesson 1. 2. Plot the fit as in Lesson 1, but this time hold down Control and select the data sets from "Fit 1" and "Fit 1_copy". You can change the "offset" in the plotting window to 0 to place the plots on top of each other. -------------------------------------------------------------------------------- - -References: ------------ +========== +References +========== -1. `(pdf) `_, +1. `(pdf) <../../manual/Proffen-jac-1999.pdf>`_, Th. Proffen and S. J. L. Billinge, PDFFIT a program for full profile structural refinement of the atomic pair distribution function, J. Appl. Crystallogr. 32, 572-575 (1999) -2. `(pdf) `_, +2. `(pdf) <../../manual/Farrow-jpcm-2007.pdf>`_, C. L. Farrow, P. Juhas, J. W. Liu, D. Bryndin, J. Bloch, Th. Proffen and S. J. L. Billinge, PDFfit2 and PDFgui: Computer programs for studying nanostructure in crystals, J. Phys.: Condens. Matter 19, 335219 (2007) From 53a3720241f36c01f1f0904bcd655e0db4734870 Mon Sep 17 00:00:00 2001 From: Tieqiong <123656525+Tieqiong@users.noreply.github.com> Date: Tue, 20 Aug 2024 09:30:41 -0400 Subject: [PATCH 24/24] Apply the new workflow (#168) * Apply the new workflow * remove prerelease from docs workflow * rename to main --- .github/workflows/codecov.yml | 62 ++++++++++++++++++++++++++++++++ .github/workflows/docs.yml | 47 +++++++++++++----------- .github/workflows/main.yml | 56 ++++++++++++----------------- .github/workflows/pre-commit.yml | 19 ---------- 4 files changed, 110 insertions(+), 74 deletions(-) create mode 100644 .github/workflows/codecov.yml delete mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 00000000..465d42c7 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,62 @@ +name: Gather coverage report and upload to codecov + +on: + push: + branches: + - main + release: + types: + - prereleased + - published + workflow_dispatch: + +defaults: + run: + shell: bash -l {0} + +jobs: + coverage: + runs-on: ubuntu-latest + steps: + - name: Check out diffpy.pdfgui + uses: actions/checkout@v4 + + - name: Initialize miniconda + uses: conda-incubator/setup-miniconda@v3 + with: + activate-environment: test + auto-update-conda: true + environment-file: environment.yml + auto-activate-base: false + + - name: Conda config + run: >- + conda config --set always_yes yes + --set changeps1 no + + - name: Install diffpy.pdfgui and requirements + run: | + conda install --file requirements/run.txt + conda install --file requirements/test.txt + python -m pip install -r requirements/pip.txt + python -m pip install . --no-deps + + - name: Install Xvfb + run: sudo apt-get install -y xvfb + + - name: Start Xvfb + run: | + export DISPLAY=:99 + Xvfb :99 -screen 0 1024x768x16 & + + - name: Validate diffpy.pdfgui + run: | + export DISPLAY=:99 + coverage run -m pytest -vv -s + coverage report -m + codecov + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2909d67f..624a7a66 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,37 +1,42 @@ -name: Build Documentation +name: Build and Deploy Documentation on: - push: - branches: - - main release: + types: + - published + workflow_dispatch: + +defaults: + run: + shell: bash -l {0} jobs: - test: + docs: runs-on: ubuntu-latest - defaults: - run: - shell: bash -l {0} steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 + - name: Check out diffpy.pdfgui + uses: actions/checkout@v4 - - uses: conda-incubator/setup-miniconda@v2 + - name: Initialize miniconda + uses: conda-incubator/setup-miniconda@v3 with: activate-environment: build auto-update-conda: true + environment-file: environment.yml + auto-activate-base: false - - name: install requirements + - name: Conda config run: >- - conda install -n build -c conda-forge - --file requirements/build.txt - --file requirements/run.txt - --file requirements/docs.txt - --quiet --yes - - - name: install the package - run: python -m pip install . --no-deps + conda config --set always_yes yes + --set changeps1 no + + - name: Install diffpy.pdfgui and build requirements + run: | + conda install --file requirements/build.txt + conda install --file requirements/run.txt + conda install --file requirements/docs.txt + python -m pip install -r requirements/pip.txt + python -m pip install . --no-deps - name: build documents run: make -C doc html diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c26194af..1722ee0f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,50 +1,42 @@ -name: CI +name: Test on: push: branches: - main - - CI pull_request: workflow_dispatch: +defaults: + run: + shell: bash -l {0} + jobs: - miniconda: - name: Miniconda ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: ["ubuntu-latest"] + validate: + runs-on: ubuntu-latest steps: - - name: check out diffpy.pdfgui - uses: actions/checkout@v3 - with: - repository: diffpy/diffpy.pdfgui - path: . - fetch-depth: 0 # avoid shallow clone with no tags + - name: Check out diffpy.pdfgui + uses: actions/checkout@v4 - - name: initialize miniconda - # this uses a marketplace action that sets up miniconda in a way that makes - # it easier to use. I tried setting it up without this and it was a pain - uses: conda-incubator/setup-miniconda@v2 + - name: Initialize miniconda + uses: conda-incubator/setup-miniconda@v3 with: activate-environment: test - # environment.yml file is needed by this action. Because I don't want - # maintain this but rather maintain the requirements files it just has - # basic things in it like conda and pip - environment-file: ./environment.yml - python-version: 3 + auto-update-conda: true + environment-file: environment.yml auto-activate-base: false - - name: install diffpy.pdfgui requirements - shell: bash -l {0} + - name: Conda config + run: >- + conda config --set always_yes yes + --set changeps1 no + + - name: Install diffpy.pdfgui and requirements run: | - conda config --set always_yes yes --set changeps1 no - conda config --add channels conda-forge - conda activate test conda install --file requirements/run.txt conda install --file requirements/test.txt - pip install . + python -m pip install -r requirements/pip.txt + python -m pip install . --no-deps - name: Install Xvfb run: sudo apt-get install -y xvfb @@ -55,10 +47,6 @@ jobs: Xvfb :99 -screen 0 1024x768x16 & - name: Validate diffpy.pdfgui - shell: bash -l {0} run: | export DISPLAY=:99 - conda activate test - coverage run -m pytest -vv -s - coverage report -m - codecov + python -m pytest diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index f2ff7e42..00000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: pre-commit - -on: - pull_request: - push: - workflow_dispatch: - -jobs: - pre-commit: - # pull requests are a duplicate of a branch push if within the same repo. - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository - - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - - uses: pre-commit/action@v3.0.0 - with: - extra_args: --all-files