fix: update functions related to diffpy.utils update#151
fix: update functions related to diffpy.utils update#151sbillinge merged 11 commits intodiffpy:mainfrom
diffpy.utils update#151Conversation
| RADIUS_MM = 1 | ||
| N_POINTS_ON_DIAMETER = 300 | ||
| TTH_GRID = np.arange(1, 180.1, 0.1) | ||
| TTH_GRID = np.round(np.arange(1, 180.1, 0.1), decimals=1) |
There was a problem hiding this comment.
np.arrange causes the value at 180 degree to go above 180 slightly because of floating-point precision errors. I think we can round every value to 1 decimal place here.
There was a problem hiding this comment.
I ran the interpolation and coefficient lists using np.arrange though... but after rerunning a few angles I believe this rounding error is so small that it can be ignored
There was a problem hiding this comment.
mmm., this seems like a slightly dramatic fix to a small edge-case. Is there not a less intrusive fix for this? Let's think about this a bit more.
There was a problem hiding this comment.
Yeah, maybe I can round down 180 only?
There was a problem hiding this comment.
that's what I had in mind.
|
@sbillinge ready for review. This PR includes all updates from diffpy.utils. No significant functionality changes. But it's causing a conflict because I removed the |
sbillinge
left a comment
There was a problem hiding this comment.
exciting! please see inline.
| RADIUS_MM = 1 | ||
| N_POINTS_ON_DIAMETER = 300 | ||
| TTH_GRID = np.arange(1, 180.1, 0.1) | ||
| TTH_GRID = np.round(np.arange(1, 180.1, 0.1), decimals=1) |
There was a problem hiding this comment.
mmm., this seems like a slightly dramatic fix to a small edge-case. Is there not a less intrusive fix for this? Let's think about this a bit more.
|
you will have to merge in main to resolve the conflict (or add the mud calculator back....) |
| N_POINTS_ON_DIAMETER = 300 | ||
| TTH_GRID = np.arange(1, 180.1, 0.1) | ||
| # Round down the last element if it's slightly above 180 due to floating point precision | ||
| TTH_GRID[-1] = 180 |
There was a problem hiding this comment.
round down 180 only
There was a problem hiding this comment.
maybe 180.00 so it is clear you want to keep it as a float?
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #151 +/- ##
==========================================
- Coverage 99.31% 99.27% -0.05%
==========================================
Files 6 5 -1
Lines 293 275 -18
==========================================
- Hits 291 273 -18
Misses 2 2
|
|
@sbillinge ready for another review. I fixed the |
sbillinge
left a comment
There was a problem hiding this comment.
I didn't quite finish the review and have to run, but I am posting this now so you can work on it.
|
|
||
| **Changed:** | ||
|
|
||
| * Updated functions related to changes in `diffpy.utils` version 3.6.0. |
There was a problem hiding this comment.
Can you try and think more precisely about how to say this. "Updated" is the same as "changed" so the message contains close to zero information.....
| N_POINTS_ON_DIAMETER = 300 | ||
| TTH_GRID = np.arange(1, 180.1, 0.1) | ||
| # Round down the last element if it's slightly above 180 due to floating point precision | ||
| TTH_GRID[-1] = 180 |
There was a problem hiding this comment.
maybe 180.00 so it is clear you want to keep it as a float?
| from diffpy.utils.diffraction_objects import ANGLEQUANTITIES, QQUANTITIES, XQUANTITIES | ||
| from diffpy.utils.tools import check_and_build_global_config, compute_mud, get_package_info, get_user_info | ||
|
|
||
| WAVELENGTHS = {"Mo": 0.71, "Ag": 0.59, "Cu": 1.54} |
There was a problem hiding this comment.
I think we want a few more sig figs on these
There was a problem hiding this comment.
I found for Mo and Cu the values should be around 0.7107 and 1.5406. I couldn't find the values for Ag though..
| config = get_user_info(config) | ||
| args.username = config["username"] | ||
| args.email = config["email"] | ||
| check_and_build_global_config() |
There was a problem hiding this comment.
since here we are allowing people to pass in this info as an arg, probably the workflow should be
-
if the arg is set, use the arg and don't even run the config updater
-
if the arg is not set, run the config updater
-
run get_user_info passing in the args if they are not None.
| args.email = config["email"] | ||
| check_and_build_global_config() | ||
| config = get_user_info(owner_name=args.username, owner_email=args.email) | ||
| args.username = config["owner_name"] |
There was a problem hiding this comment.
is there a reason you are not using config.get() here? That is usually better practice.
|
|
||
| **Changed:** | ||
|
|
||
| * Functions related to diffraction_objects and tools modules in `diffpy.utils` to reflect changes in version 3.6.0. |
There was a problem hiding this comment.
better wording..?
There was a problem hiding this comment.
not really. None of the users reading this will have any idea about diffpy.utils 3.6.0.
Something like
* Functions that use DiffractionObject` in `diffpy.utils` to follow the new API.
| from diffpy.utils.tools import check_and_build_global_config, compute_mud, get_package_info, get_user_info | ||
|
|
||
| WAVELENGTHS = {"Mo": 0.71, "Ag": 0.59, "Cu": 1.54} | ||
| WAVELENGTHS = {"Mo": 0.71073, "Ag": 0.55941, "Cu": 1.5406} |
There was a problem hiding this comment.
Need a little help on the value for Ag. I found it here https://x-server.gmca.aps.anl.gov/cgi/www_dbli.exe?x0hdb=waves but it's a bit off from our original value..
There was a problem hiding this comment.
"Cu", "CuKa1", "CuKa1Ka2"
CuKa1 : 1.54056
CuKa1Ka2 : =(1.54056*2 + 1.544398)/3 = 1.54184
Cu : 1.542
There was a problem hiding this comment.
@yucongalicechen will need docs to explain what is going on.
|
@sbillinge ready for some more feedback. The error in the tests is related to the wavelength for Ag. |
|
|
||
| **Changed:** | ||
|
|
||
| * Functions related to diffraction_objects and tools modules in `diffpy.utils` to reflect changes in version 3.6.0. |
There was a problem hiding this comment.
not really. None of the users reading this will have any idea about diffpy.utils 3.6.0.
Something like
* Functions that use DiffractionObject` in `diffpy.utils` to follow the new API.
| from diffpy.utils.tools import check_and_build_global_config, compute_mud, get_package_info, get_user_info | ||
|
|
||
| WAVELENGTHS = {"Mo": 0.71, "Ag": 0.59, "Cu": 1.54} | ||
| WAVELENGTHS = {"Mo": 0.71073, "Ag": 0.55941, "Cu": 1.5406} |
There was a problem hiding this comment.
"Cu", "CuKa1", "CuKa1Ka2"
CuKa1 : 1.54056
CuKa1Ka2 : =(1.54056*2 + 1.544398)/3 = 1.54184
Cu : 1.542
| from diffpy.utils.tools import check_and_build_global_config, compute_mud, get_package_info, get_user_info | ||
|
|
||
| WAVELENGTHS = {"Mo": 0.71, "Ag": 0.59, "Cu": 1.54} | ||
| WAVELENGTHS = {"Mo": 0.71073, "Ag": 0.55941, "Cu": 1.5406} |
There was a problem hiding this comment.
@yucongalicechen will need docs to explain what is going on.
closes #129