batplot 1.0.4__tar.gz → 1.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {batplot-1.0.4 → batplot-1.0.6}/PKG-INFO +1 -1
- {batplot-1.0.4 → batplot-1.0.6}/batplot/batplot.py +29 -48
- {batplot-1.0.4 → batplot-1.0.6}/batplot.egg-info/PKG-INFO +1 -1
- {batplot-1.0.4 → batplot-1.0.6}/pyproject.toml +1 -1
- {batplot-1.0.4 → batplot-1.0.6}/batplot/__init__.py +0 -0
- {batplot-1.0.4 → batplot-1.0.6}/batplot.egg-info/SOURCES.txt +0 -0
- {batplot-1.0.4 → batplot-1.0.6}/batplot.egg-info/dependency_links.txt +0 -0
- {batplot-1.0.4 → batplot-1.0.6}/batplot.egg-info/entry_points.txt +0 -0
- {batplot-1.0.4 → batplot-1.0.6}/batplot.egg-info/requires.txt +0 -0
- {batplot-1.0.4 → batplot-1.0.6}/batplot.egg-info/top_level.txt +0 -0
- {batplot-1.0.4 → batplot-1.0.6}/setup.cfg +0 -0
|
@@ -3284,9 +3284,9 @@ parser = argparse.ArgumentParser(
|
|
|
3284
3284
|
formatter_class=argparse.RawDescriptionHelpFormatter
|
|
3285
3285
|
)
|
|
3286
3286
|
parser.add_argument("files", nargs="*")
|
|
3287
|
-
parser.add_argument("--delta", "-d", type=float, default=None
|
|
3288
|
-
|
|
3289
|
-
parser.add_argument("--xrange", nargs=2, type=float)
|
|
3287
|
+
parser.add_argument("--delta", "-d", type=float, default=None)
|
|
3288
|
+
parser.add_argument("--autoscale", action="store_true")
|
|
3289
|
+
parser.add_argument("--xrange", "-r", nargs=2, type=float)
|
|
3290
3290
|
parser.add_argument("--out", "-o", type=str)
|
|
3291
3291
|
parser.add_argument("--errors", action="store_true")
|
|
3292
3292
|
parser.add_argument("--xaxis", choices=["2theta", "Q", "r"])
|
|
@@ -3294,10 +3294,9 @@ parser.add_argument("--convert", "-c", nargs="+")
|
|
|
3294
3294
|
parser.add_argument("--wl", type=float)
|
|
3295
3295
|
parser.add_argument("--fullprof", nargs="+", type=float)
|
|
3296
3296
|
parser.add_argument("--raw", action="store_true")
|
|
3297
|
+
parser.add_argument("--interactive", action="store_true")
|
|
3297
3298
|
parser.add_argument("--savefig", type=str)
|
|
3298
3299
|
parser.add_argument("--stack", action="store_true")
|
|
3299
|
-
parser.add_argument("--interactive", action="store_true")
|
|
3300
|
-
|
|
3301
3300
|
|
|
3302
3301
|
# parser.add_argument("files", nargs="*", help="Files to plot. Optionally specify wavelength per file: file.xye")
|
|
3303
3302
|
# parser.add_argument("--delta", "-d", type=float, default=None,
|
|
@@ -3808,41 +3807,42 @@ for idx_file, file_entry in enumerate(args.files):
|
|
|
3808
3807
|
print(f"Error simulating CIF {fname}: {e_read}")
|
|
3809
3808
|
continue
|
|
3810
3809
|
elif file_ext == ".gr":
|
|
3811
|
-
# ...existing .gr branch...
|
|
3812
3810
|
try:
|
|
3813
3811
|
x, y = read_gr_file(fname); e = None
|
|
3814
3812
|
except Exception as e_read:
|
|
3815
3813
|
print(f"Error reading {fname}: {e_read}"); continue
|
|
3816
|
-
elif file_ext
|
|
3814
|
+
elif file_ext in [".nor", ".xy", ".xye", ".qye", ".dat", ".csv"] or is_chik or is_chir:
|
|
3815
|
+
# Robustly skip header/comment/non-numeric lines until data is found
|
|
3816
|
+
def robust_loadtxt_skipheader(fname):
|
|
3817
|
+
data_lines = []
|
|
3818
|
+
with open(fname, "r") as f:
|
|
3819
|
+
for line in f:
|
|
3820
|
+
ls = line.strip()
|
|
3821
|
+
if not ls or ls.startswith("#"): continue
|
|
3822
|
+
# Try to parse at least 2 floats
|
|
3823
|
+
floats = []
|
|
3824
|
+
for p in ls.replace(",", " ").split():
|
|
3825
|
+
try:
|
|
3826
|
+
floats.append(float(p))
|
|
3827
|
+
except ValueError:
|
|
3828
|
+
break
|
|
3829
|
+
if len(floats) >= 2:
|
|
3830
|
+
data_lines.append(ls)
|
|
3831
|
+
if not data_lines:
|
|
3832
|
+
raise ValueError(f"No numeric data found in {fname}")
|
|
3833
|
+
from io import StringIO
|
|
3834
|
+
return np.loadtxt(StringIO("\n".join(data_lines)))
|
|
3835
|
+
|
|
3817
3836
|
try:
|
|
3818
|
-
data =
|
|
3837
|
+
data = robust_loadtxt_skipheader(fname)
|
|
3819
3838
|
except Exception as e_read:
|
|
3820
3839
|
print(f"Error reading {fname}: {e_read}"); continue
|
|
3821
3840
|
if data.ndim == 1: data = data.reshape(1, -1)
|
|
3822
3841
|
if data.shape[1] < 2:
|
|
3823
|
-
print(f"Invalid
|
|
3842
|
+
print(f"Invalid data format in {fname}"); continue
|
|
3824
3843
|
x, y = data[:, 0], data[:, 1]
|
|
3825
3844
|
e = data[:, 2] if data.shape[1] >= 3 else None
|
|
3826
|
-
|
|
3827
|
-
# EXAFS k-space: (k, χ(k)) or (k, χ(k), error)
|
|
3828
|
-
try:
|
|
3829
|
-
data = np.loadtxt(fname, comments="#")
|
|
3830
|
-
except Exception as e_read:
|
|
3831
|
-
print(f"Error reading {fname}: {e_read}"); continue
|
|
3832
|
-
if data.ndim == 1: data = data.reshape(1, -1)
|
|
3833
|
-
if data.shape[1] < 2:
|
|
3834
|
-
print(f"Invalid .chik data in {fname}"); continue
|
|
3835
|
-
x, y = data[:,0], data[:,1]; e = data[:,2] if data.shape[1] >= 3 else None
|
|
3836
|
-
elif is_chir:
|
|
3837
|
-
# FT-EXAFS R-space: (R, FT magnitude) or with error
|
|
3838
|
-
try:
|
|
3839
|
-
data = np.loadtxt(fname, comments="#")
|
|
3840
|
-
except Exception as e_read:
|
|
3841
|
-
print(f"Error reading {fname}: {e_read}"); continue
|
|
3842
|
-
if data.ndim == 1: data = data.reshape(1, -1)
|
|
3843
|
-
if data.shape[1] < 2:
|
|
3844
|
-
print(f"Invalid .chir data in {fname}"); continue
|
|
3845
|
-
x, y = data[:,0], data[:,1]; e = data[:,2] if data.shape[1] >= 3 else None
|
|
3845
|
+
# For .csv, .dat, .xy, .xye, .qye, .nor, .chik, .chir, this robustly skips headers
|
|
3846
3846
|
elif args.fullprof and file_ext == ".dat":
|
|
3847
3847
|
try:
|
|
3848
3848
|
y_plot, n_rows = read_fullprof_rowwise(fname)
|
|
@@ -3856,25 +3856,6 @@ for idx_file, file_entry in enumerate(args.files):
|
|
|
3856
3856
|
except Exception as e:
|
|
3857
3857
|
print(f"Error reading FullProf-style {fname}: {e}")
|
|
3858
3858
|
continue
|
|
3859
|
-
elif file_ext == ".csv":
|
|
3860
|
-
data = read_csv_file(fname)
|
|
3861
|
-
if data is None:
|
|
3862
|
-
continue
|
|
3863
|
-
x, y = data[:, 0], data[:, 1]
|
|
3864
|
-
e = data[:, 2] if data.shape[1] >= 3 else None
|
|
3865
|
-
else:
|
|
3866
|
-
try:
|
|
3867
|
-
data = np.loadtxt(fname, comments="#")
|
|
3868
|
-
except Exception as e:
|
|
3869
|
-
print(f"Error reading {fname}: {e}")
|
|
3870
|
-
continue
|
|
3871
|
-
if data.ndim == 1:
|
|
3872
|
-
data = data.reshape(1, -1)
|
|
3873
|
-
if data.shape[1] < 2:
|
|
3874
|
-
print(f"Invalid data format in {fname}")
|
|
3875
|
-
continue
|
|
3876
|
-
x, y = data[:, 0], data[:, 1]
|
|
3877
|
-
e = data[:, 2] if data.shape[1]>=3 else None
|
|
3878
3859
|
|
|
3879
3860
|
# ---- X-axis conversion logic updated (no conversion for energy) ----
|
|
3880
3861
|
if use_Q and file_ext not in (".qye", ".gr", ".nor"):
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "batplot"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.6"
|
|
8
8
|
description = "Interactive plotting for XRD, PDF, and XAS data (.xye, .xy, .qye, .dat, .csv, .gr, .nor, .chik, .chir)"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "Your Name", email = "your@email.com" }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|