-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: update functions related to diffpy.utils
update
#151
Changes from 10 commits
da3340b
8264f17
f9a9eb1
eb5b771
e79a2fd
84d0e33
0cad788
0534810
b479cf2
5fecd14
402677b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
**Added:** | ||
|
||
* <news item> | ||
|
||
**Changed:** | ||
|
||
* Functions related to diffraction_objects and tools modules in `diffpy.utils` to reflect changes in version 3.6.0. | ||
|
||
**Deprecated:** | ||
|
||
* <news item> | ||
|
||
**Removed:** | ||
|
||
* <news item> | ||
|
||
**Fixed:** | ||
|
||
* <news item> | ||
|
||
**Security:** | ||
|
||
* <news item> |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
import copy | ||
from pathlib import Path | ||
|
||
from diffpy.labpdfproc.mud_calculator import compute_mud | ||
from diffpy.utils.scattering_objects.diffraction_objects import QQUANTITIES, XQUANTITIES | ||
from diffpy.utils.tools import get_package_info, get_user_info | ||
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} | ||
WAVELENGTHS = {"Mo": 0.71073, "Ag": 0.55941, "Cu": 1.5406} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Cu", "CuKa1", "CuKa1Ka2" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yucongalicechen will need docs to explain what is going on. |
||
known_sources = [key for key in WAVELENGTHS.keys()] | ||
|
||
# Exclude wavelength from metadata to prevent duplication, | ||
|
@@ -154,7 +153,9 @@ def set_xtype(args): | |
""" | ||
if args.xtype.lower() not in XQUANTITIES: | ||
raise ValueError(f"Unknown xtype: {args.xtype}. Allowed xtypes are {*XQUANTITIES, }.") | ||
args.xtype = "q" if args.xtype.lower() in QQUANTITIES else "tth" | ||
args.xtype = ( | ||
"q" if args.xtype.lower() in QQUANTITIES else "tth" if args.xtype.lower() in ANGLEQUANTITIES else "d" | ||
yucongalicechen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) | ||
return args | ||
|
||
|
||
|
@@ -224,7 +225,8 @@ def load_user_metadata(args): | |
|
||
def load_user_info(args): | ||
""" | ||
Update username and email using get_user_info function from diffpy.utils | ||
Load user info into args. If args are not provided, call check_and_build_global_config function from | ||
diffpy.utils to prompt the user for inputs. Otherwise, call get_user_info with the provided arguments. | ||
|
||
Parameters | ||
---------- | ||
|
@@ -236,10 +238,11 @@ def load_user_info(args): | |
the updated argparse Namespace with username and email inserted | ||
|
||
""" | ||
config = {"username": args.username, "email": args.email} | ||
config = get_user_info(config) | ||
args.username = config["username"] | ||
args.email = config["email"] | ||
if args.username is None or args.email is None: | ||
check_and_build_global_config() | ||
config = get_user_info(owner_name=args.username, owner_email=args.email) | ||
args.username = config.get("owner_name") | ||
args.email = config.get("owner_email") | ||
sbillinge marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return args | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,11 @@ def user_filesystem(tmp_path): | |
f.write("good_data.xy \n") | ||
f.write(f"{str(input_dir.resolve() / 'good_data.txt')}\n") | ||
|
||
home_config_data = {"username": "home_username", "email": "[email protected]"} | ||
home_config_data = { | ||
"owner_name": "home_username", | ||
"owner_email": "[email protected]", | ||
"owner_orcid": "home_orcid", | ||
} | ||
with open(home_dir / "diffpyconfig.json", "w") as f: | ||
json.dump(home_config_data, f) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better wording..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really. None of the users reading this will have any idea about diffpy.utils 3.6.0.
Something like