Skip to content

Conversation

@zmx27
Copy link
Collaborator

@zmx27 zmx27 commented Aug 28, 2025

No description provided.

@zmx27
Copy link
Collaborator Author

zmx27 commented Aug 28, 2025

@sbillinge ready for review. Here is the work that still needs to be done:

check yaml...........................................(no files to check)Skipped
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
check for case conflicts.................................................Passed
check for merge conflicts................................................Passed
check toml...............................................................Passed
check for added large files..............................................Passed
black....................................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

<unknown>:122: SyntaxWarning: invalid escape sequence '\s'
src/diffpy/srxconfutils/__init__.py:16:1: F401 'diffpy.srxconfutils.config.ConfigBase' imported but unused
src/diffpy/srxconfutils/__init__.py:19:1: F401 'diffpy.srxconfutils.version.__version__' imported but unused
src/diffpy/srxconfutils/config.py:25:1: F401 're' imported but unused
src/diffpy/srxconfutils/config.py:26:1: F401 'sys' imported but unused
src/diffpy/srxconfutils/config.py:28:1: F401 'functools.partial' imported but unused
src/diffpy/srxconfutils/config.py:32:1: E722 do not use bare 'except'
src/diffpy/srxconfutils/config.py:35:1: F401 'diffpy.srxconfutils.tools._configPropertyR' imported but unused
src/diffpy/srxconfutils/config.py:35:1: F401 'diffpy.srxconfutils.tools._configPropertyRad' imported but unused
src/diffpy/srxconfutils/config.py:35:1: F401 'diffpy.srxconfutils.tools._configPropertyRW' imported but unused
src/diffpy/srxconfutils/config.py:35:1: F401 'diffpy.srxconfutils.tools.str2bool' imported but unused
src/diffpy/srxconfutils/config.py:51:80: E501 line too long (80 > 79 characters)
src/diffpy/srxconfutils/config.py:131:80: E501 line too long (83 > 79 characters)
src/diffpy/srxconfutils/config.py:230:80: E501 line too long (103 > 79 characters)
src/diffpy/srxconfutils/config.py:231:80: E501 line too long (109 > 79 characters)
src/diffpy/srxconfutils/config.py:268:9: F841 local variable 'rv' is assigned to but never used
src/diffpy/srxconfutils/config.py:295:21: E711 comparison to None should be 'if cond is not None:'
src/diffpy/srxconfutils/config.py:297:17: E711 comparison to None should be 'if cond is not None:'
src/diffpy/srxconfutils/config.py:319:15: E711 comparison to None should be 'if cond is None:'
src/diffpy/srxconfutils/config.py:321:52: E711 comparison to None should be 'if cond is None:'
src/diffpy/srxconfutils/config.py:502:21: E711 comparison to None should be 'if cond is not None:'
src/diffpy/srxconfutils/config.py:524:21: E711 comparison to None should be 'if cond is not None:'
src/diffpy/srxconfutils/config.py:578:21: E711 comparison to None should be 'if cond is not None:'
src/diffpy/srxconfutils/config.py:610:21: E711 comparison to None should be 'if cond is not None:'
src/diffpy/srxconfutils/config.py:612:17: E711 comparison to None should be 'if cond is not None:'
src/diffpy/srxconfutils/config.py:618:23: E711 comparison to None should be 'if cond is None:'
src/diffpy/srxconfutils/config.py:619:24: E711 comparison to None should be 'if cond is None:'
src/diffpy/srxconfutils/config.py:645:61: E711 comparison to None should be 'if cond is not None:'
src/diffpy/srxconfutils/config.py:648:69: E711 comparison to None should be 'if cond is not None:'
src/diffpy/srxconfutils/config.py:714:55: E711 comparison to None should be 'if cond is None:'
src/diffpy/srxconfutils/config.py:759:21: E711 comparison to None should be 'if cond is None:'
src/diffpy/srxconfutils/config.py:768:80: E501 line too long (82 > 79 characters)
src/diffpy/srxconfutils/configtraits.py:18:80: E501 line too long (92 > 79 characters)
src/diffpy/srxconfutils/configtraits.py:20:80: E501 line too long (90 > 79 characters)
src/diffpy/srxconfutils/configtraits.py:23:1: F401 'argparse' imported but unused
src/diffpy/srxconfutils/configtraits.py:24:1: F401 'os' imported but unused
src/diffpy/srxconfutils/configtraits.py:25:1: F401 're' imported but unused
src/diffpy/srxconfutils/configtraits.py:26:1: F401 'sys' imported but unused
src/diffpy/srxconfutils/configtraits.py:27:1: F401 'configparser.ConfigParser' imported but unused
src/diffpy/srxconfutils/configtraits.py:28:1: F401 'functools.partial' imported but unused
src/diffpy/srxconfutils/configtraits.py:30:1: F401 'traits.api.Event' imported but unused
src/diffpy/srxconfutils/configtraits.py:30:1: F401 'traits.api.Float' imported but unused
src/diffpy/srxconfutils/configtraits.py:30:1: F401 'traits.api.Instance' imported but unused
src/diffpy/srxconfutils/configtraits.py:30:1: F401 'traits.api.Int' imported but unused
src/diffpy/srxconfutils/configtraits.py:30:1: F401 'traits.api.Property' imported but unused
src/diffpy/srxconfutils/configtraits.py:30:1: F401 'traits.api.Range' imported but unused
src/diffpy/srxconfutils/configtraits.py:30:1: F401 'traits.api.Str' imported but unused
src/diffpy/srxconfutils/configtraits.py:30:1: F401 'traits.api.cached_property' imported but unused
src/diffpy/srxconfutils/configtraits.py:30:1: F401 'traits.api.on_trait_change' imported but unused
src/diffpy/srxconfutils/configtraits.py:51:1: F401 'traitsui.api.Group' imported but unused
src/diffpy/srxconfutils/configtraits.py:51:1: F401 'traitsui.api.Item' imported but unused
src/diffpy/srxconfutils/configtraits.py:51:1: F401 'traitsui.api.View' imported but unused
src/diffpy/srxconfutils/configtraits.py:54:1: F401 'diffpy.srxconfutils.tools.StrConv' imported but unused
src/diffpy/srxconfutils/configtraits.py:54:1: F401 'diffpy.srxconfutils.tools._configPropertyR' imported but unused
src/diffpy/srxconfutils/configtraits.py:54:1: F401 'diffpy.srxconfutils.tools._configPropertyRad' imported but unused
src/diffpy/srxconfutils/configtraits.py:54:1: F401 'diffpy.srxconfutils.tools._configPropertyRW' imported but unused
src/diffpy/srxconfutils/configtraits.py:54:1: F401 'diffpy.srxconfutils.tools.opt2Str' imported but unused
src/diffpy/srxconfutils/configtraits.py:54:1: F401 'diffpy.srxconfutils.tools.str2bool' imported but unused
src/diffpy/srxconfutils/configtraits.py:54:1: F401 'diffpy.srxconfutils.tools.str2Opt' imported but unused
src/diffpy/srxconfutils/configtraits.py:69:80: E501 line too long (80 > 79 characters)
src/diffpy/srxconfutils/configtraits.py:168:80: E501 line too long (83 > 79 characters)
src/diffpy/srxconfutils/configtraits.py:272:80: E501 line too long (103 > 79 characters)
src/diffpy/srxconfutils/configtraits.py:273:80: E501 line too long (109 > 79 characters)
src/diffpy/srxconfutils/tools.py:62:48: F821 undefined name 'nm'
src/diffpy/srxconfutils/tools.py:63:55: F821 undefined name 'nm'
src/diffpy/srxconfutils/tools.py:64:41: F821 undefined name 'nm'
src/diffpy/srxconfutils/tools.py:122:26: W605 invalid escape sequence '\s'
src/diffpy/srxconfutils/tools.py:122:30: W605 invalid escape sequence '\s'
src/diffpy/srxconfutils/tools.py:174:5: E722 do not use bare 'except'
src/diffpy/srxconfutils/tools.py:193:5: E722 do not use bare 'except'

isort....................................................................Passed
nbstripout...........................................(no files to check)Skipped
Prevent Commit to Main Branch............................................Passed
codespell................................................................Failed
- hook id: codespell
- exit code: 65

src/diffpy/srxconfutils/configtraits.py:258: Filp ==> Flip
src/diffpy/srxconfutils/configtraits.py:259: filp ==> flip
README.rst:26: enviroment ==> environment
src/diffpy/srxconfutils/tools.py:77: truned ==> turned
src/diffpy/srxconfutils/tools.py:79: opitons ==> options
src/diffpy/srxconfutils/tools.py:114: opitons ==> options
src/diffpy/srxconfutils/config.py:208: filp ==> flip
src/diffpy/srxconfutils/config.py:546: comming ==> coming
src/diffpy/srxconfutils/config.py:643: specfied ==> specified
src/diffpy/srxconfutils/config.py:654: compatiable ==> compatible
src/diffpy/srxconfutils/config.py:665: wirte ==> write
src/diffpy/srxconfutils/config.py:709: writen ==> written
src/diffpy/srxconfutils/config.py:717: wirte ==> write

prettier.................................................................Passed
docformatter.............................................................Passed

@sbillinge
Copy link
Contributor

This is great! Just checking, we worked hard to get xPDFsuite to run so that we could test all changes we make. Did you do the last step of that work and come up with the test that we will run to make sure we didn't break anything? What I have in mind is that there is something like a set of data and maybe a saved project file and to test it we run xpdfsuite and load the project file and run a few things to make sure it hasn't broken. This will be a bit of a pain to do on every commit, but at least to do it before anything gets merged for example. It is probably not worth it for these codespell and black changes, but at least if we have a plan in our head of what the workflow is going to be as we move forward on this. Of course, extensive unit tests make this much easier, but we don't really have those yet......

tl;dr, let's have an idea in our heads about what our testing protocol is going to be as we move ahead making all these py2-py3 changes and skpkg level 5 migrations. Not too much, but enough..... I would like you to decide what you think is best here.

@sbillinge sbillinge merged commit f7b773e into diffpy:migration Aug 29, 2025
@sbillinge sbillinge deleted the pre-commit-auto branch August 29, 2025 07:27
@zmx27
Copy link
Collaborator Author

zmx27 commented Aug 29, 2025

@sbillinge I've downloaded Ni.chi and kapton.chi from the PDFttp_data repo to do my testing. These images are how the 2d plot of Ni.chi and kapton.chi look in the 2theta data format:
image
Similarly, these are how the data files look in the Q(a^-1) data format:
image
And this is for the Q(nm^-1) data format:
image
Do these look okay? If so, I can use these images as references for how the plots are supposed to look given the default parameters when I do my future testing. According to the tutorial, I can also press "Save Project" and then "Load Project" to come back.

I did have some points of concern though. When first opening the GUI, some parameters in the PDF tab (particularly Qmax-inst or Q-max) will be initialized to a maximum of 0 like so:
image
The above is how it looks before adjusting any sliders. When I try adjust the sliders for Qmax-inst in this case, the max for Q-max will also get dragged down to 0. Here is how it looks:
image
The only way to fix it currently in the GUI is to press "Reset", in which both Q-max and Qmax-inst will return to a reasonable max. However, pressing "Reset" will not fix this issue when the program is plotting something; the maximum value for Qmax-inst will stay at 0. These mostly apply when attempting to plot things using the 2theta data format. This problem is much more minor for the other two data formats; sometimes the values will be initialized to a maximum of 0 as well, but pressing reset will immediately restore all of the parameters back to reasonable values. Additionally, adjusting the sliders do not change the plots at all under the 2theta data format, but adjusting the sliders will change the plots in the other data formats in real time. Am I right to assume that these are unintended bugs that I should be trying to fix in future PRs?

P.S. I am not able to use the PDFgui and the Distance Calculator features. For PDFgui, the icon in the toolbox on the top is grayed out. When I try pressing "Start PDFgui" in the dropdown, nothing happens. For the distance calculator, the icon is also grayed out in the toolbox. Pressing "Distance Calculator" in the dropdown does open another GUI window, but then the "browse" feature is not allowing me to select a structure file (I had downloaded Pt.cif from the PDFttp_data for this purpose, but not sure if that's the right thing to do). Instead, it prompts me to save a new file to one of the directories in my computer. Naturally, none of the functions in the GUI window will work in this case: the "Atom i" and "Atom j" dropdowns are empty, the "Results" box is empty, and the "calculate" button is grayed out. Next, the SrXgui listed in the reference manual does not exist anywhere in the program, or at least I wasn't able to find it. But here are the Pearson Correlation data for each of the data formats.
For 2theta:

Data files selected from workspace
2 files selected
Ni	kapton	1.000000

For Q(a^-1) (note that the other types other than gr say "length not equal"):

Data files selected from workspace
2 files selected
Ni	kapton	0.001294

For Q(nm^-1) (note that the other types other than gr say "length not equal"):

Data files selected from workspace
2 files selected
Ni	kapton	0.705570

Do these look okay as well? If so, I'll keep these for my future testing!

@zmx27
Copy link
Collaborator Author

zmx27 commented Sep 2, 2025

@sbillinge just a gentle ping here... I was wondering if the images I sent previously look alright? Is clicking through the GUI as I make changes to the repo to verify that these graphs look the same an ample test to make sure that the code is still working properly? And of course, there's also the weird bug that I found. I just wanted to confirm that it isn't an intentional feature?

@sbillinge
Copy link
Contributor

sorry for the delay, I saw this, but was not able to respond. The images look good. There are some things i would like to fix, for example the first mage where there is a diagonal line from 0 to 1 in F(Q), g(r) etc.. I have wanted to fix this for a long time. But as a way of testing that the code is working, this is good.

The problem that the default Qmaxinst is 0 is a bug. This doesn't happen in the old version. So I guess there is soemthing we would like to look at there to get it to work. It should set, by default, to the maximum Q-value of the data.

The Qmax being set to the Qmaxinst is correct. This is a feature, not a bug, because we never want Qmax to excexed Qmaxinst.

Some of the other behaviors, I am not sure whether they are in the old version or not, but we should decide what we want, for example, the reset not working when a plot is open. It is good that you found these behaviors. Let's capture them on issues and we can check them on the next released version and make them behave how we want.

For PDFgui, I think it greys out if PDFgui is not installed. I think it might be a bug that it is looking for some old version of PDFgui, so we will have to look at that. For the other feature, distanceprinter, I am not sure how it works either. It may compute distances from a selected cif file in the fit-tree, and then ask for a file to write the result out to. Did you try that? In that case, it would logically grey out if a cif was not pre-selected. Could you check that?

I think the pearson correlations look ok, though it doesn't make too much sense to allow them to be computed on different grids, so later we can look at that.

@zmx27
Copy link
Collaborator Author

zmx27 commented Sep 4, 2025

Hi Professor Simon, I just saw the news that you posted on Slack. First, I wanted to give you a huge congratulation on your new roles at UCSB/CNSI. They both sound like incredible opportunities! While it's definitely a little bittersweet to hear you're leaving, I really appreciate what you said about your students. Your guidance has meant a lot to me, and I've learned so much from you over the summer. I was also hoping to ask if it would be okay for me to continue contributing to the GitHub repos like I have been? I'd love to keep helping out with the projects. But time permitting, haha.

I wish you all the best in your new roles!

P.S. I've made an issue for the Qmax-inst bug. For the PDFgui issue, the PDFgui icon on the menu bar is still grayed out even after I installed the package. However, pressing Start PDFgui in the dropdown after pressing the top left will start the program as expected. Similarly, the distanceprinter icon is grayed out on the menu bar on the top, but I am able to access the tool using the dropdown menu. Should I make an issue about this as well? As for the distanceprinter error itself, I don't see any way of actually selecting a cif file. Here is how it looks:
image
The "folder" icon on the top right brings me to the following dialog box:
image
This dialog box will prompt me to save a file into one of the directories I can select. The "Save to file" button on the bottom will create a txt file to write out the results to. In this situation, there is no way to pre-select a .cif file for the program to use, which seems to be the reason that the options are grayed out as you've suggested. I should also make an issue for this, right?

@sbillinge
Copy link
Contributor

Thanks so much for the kind words! It means a lot to me to hear this.

Ok, it all makes sense. Please make an issue for the things that work but are greyed out. That sounds like a bug

I have an old version of the program so let me test the distanceprinter and see what the behavior is in the old program and I will report back on that. Great work!

I would obviously be delighted if you wanted to stay engaged and kept contributing at whatever level you are able. I am happy to keep you in the loop and share what our priorities are, but you could contribute with PRs on any issues you find in our diffpy and regolith stacks...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants