Skip to content

Commit

Permalink
black on everything
Browse files Browse the repository at this point in the history
  • Loading branch information
sbillinge committed Mar 30, 2024
1 parent e509e83 commit 8263276
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 22 deletions.
1 change: 0 additions & 1 deletion diffpy/labpdfproc/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import sys



def get_keywords():
"""Get the keywords needed to look up the version information."""
# these strings will be replaced by git during git-archive.
Expand Down
59 changes: 46 additions & 13 deletions diffpy/labpdfproc/labpdfprocapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,38 @@ def get_args():
p.add_argument("mud", help="Value of mu*D for your sample. Required.", type=float)
p.add_argument("-i", "--input-file", help="The filename of the datafile to load")
p.add_argument("-a", "--anode-type", help=f"X-ray source, allowed values:{*[known_sources],}", default="Mo")
p.add_argument("-w", "--wavelength", help=f"X-ray source wavelength. Not needed if the anode-type is specified. This will override the wavelength if anode type is specified", default=None, type=float)
p.add_argument("-o", "--output-directory", help=f"the name of the output directory. If it doesn't exist it will be created. Not currently implemented", default=None)
p.add_argument("-x", "--xtype", help=f"the quantity on the independnt variable axis. allowed values:{*XQUANTITIES,}. If not specified then two-theta is assumed for the independent variable. Only implemented for tth currently", default="tth")
p.add_argument("-c", "--output-correction", action='store_true', help=f"the quantity on the independnt variable axis. allowed values:{*XQUANTITIES,}. If not specified then two-theta is assumed for the independent variable. Only implemented for tth currently", default="tth")
p.add_argument("-f", "--force-overwrite", action='store_true', help="outputs will not overwrite existing file unless --force is spacified")
p.add_argument(
"-w",
"--wavelength",
help=f"X-ray source wavelength. Not needed if the anode-type is specified. This will override the wavelength if anode type is specified",
default=None,
type=float,
)
p.add_argument(
"-o",
"--output-directory",
help=f"the name of the output directory. If it doesn't exist it will be created. Not currently implemented",
default=None,
)
p.add_argument(
"-x",
"--xtype",
help=f"the quantity on the independnt variable axis. allowed values:{*XQUANTITIES,}. If not specified then two-theta is assumed for the independent variable. Only implemented for tth currently",
default="tth",
)
p.add_argument(
"-c",
"--output-correction",
action="store_true",
help=f"the quantity on the independnt variable axis. allowed values:{*XQUANTITIES,}. If not specified then two-theta is assumed for the independent variable. Only implemented for tth currently",
default="tth",
)
p.add_argument(
"-f",
"--force-overwrite",
action="store_true",
help="outputs will not overwrite existing file unless --force is spacified",
)
args = p.parse_args()
return args

Expand All @@ -35,18 +62,24 @@ def main():
corrfile = Path(corrfilestem + ".chi")

if outfile.exists() and not args.force_overwrite:
sys.exit(f"output file {str(outfile)} already exists. Please rerun specifying -f if you want to overwrite it")
sys.exit(
f"output file {str(outfile)} already exists. Please rerun specifying -f if you want to overwrite it"
)
if corrfile.exists() and args.output_correction and not args.force_overwrite:
sys.exit(f"corrections file {str(corrfile)} was requested and already exists. Please rerun specifying -f if you want to overwrite it")
sys.exit(
f"corrections file {str(corrfile)} was requested and already exists. Please rerun specifying -f if you want to overwrite it"
)

input_pattern = Diffraction_object(wavelength=wavelength)
xarray, yarray = loadData(args.input_file, unpack=True)
input_pattern.insert_scattering_quantity(xarray, yarray, "tth",
scat_quantity="x-ray",
name=str(args.input_file),
metadata={"muD": args.mud,
"anode_type": args.anode_type}
)
input_pattern.insert_scattering_quantity(
xarray,
yarray,
"tth",
scat_quantity="x-ray",
name=str(args.input_file),
metadata={"muD": args.mud, "anode_type": args.anode_type},
)

absorption_correction = compute_cve(input_pattern, args.mud, wavelength)
corrected_data = apply_corr(input_pattern, absorption_correction)
Expand Down
16 changes: 8 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,24 @@
# packages=find_packages(os.path.join(MYDIR, "diffpy"), exclude=["docs", "tests"]),
entry_points={
"console_scripts": [
'labpdfproc = diffpy.labpdfproc.labpdfprocapp:main',
"labpdfproc = diffpy.labpdfproc.labpdfprocapp:main",
],
},
include_package_data=True,
package_data={
"labpdfproc": [ "docs/examples/*" ]
# When adding files here, remember to update MANIFEST.in as well,
# or else they will not be included in the distribution on PyPI!
# 'path/to/data_file',
"labpdfproc": ["docs/examples/*"]
# When adding files here, remember to update MANIFEST.in as well,
# or else they will not be included in the distribution on PyPI!
# 'path/to/data_file',
},
install_requires=requirements,
license="BSD (3-clause)",
classifiers=[
"Development Status :: 2 - Pre-Alpha",
'Intended Audience :: Science/Research',
"Intended Audience :: Science/Research",
"Natural Language :: English",
"Programming Language :: Python :: 3",
'Topic :: Scientific/Engineering :: Chemistry',
'Topic :: Scientific/Engineering :: Physics',
"Topic :: Scientific/Engineering :: Chemistry",
"Topic :: Scientific/Engineering :: Physics",
],
)

0 comments on commit 8263276

Please sign in to comment.