batplot 1.8.28__tar.gz → 1.8.30__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.8.30/MANIFEST.in +2 -0
- {batplot-1.8.28/batplot.egg-info → batplot-1.8.30}/PKG-INFO +63 -43
- {batplot-1.8.28 → batplot-1.8.30}/README.md +62 -42
- {batplot-1.8.28 → batplot-1.8.30}/batplot/__init__.py +1 -1
- {batplot-1.8.28 → batplot-1.8.30}/batplot/args.py +21 -4
- {batplot-1.8.28 → batplot-1.8.30}/batplot/batch.py +4 -3
- {batplot-1.8.28 → batplot-1.8.30}/batplot/batplot.py +23 -12
- {batplot-1.8.28 → batplot-1.8.30}/batplot/converters.py +117 -7
- {batplot-1.8.28 → batplot-1.8.30}/batplot/data/CHANGELOG.md +55 -33
- {batplot-1.8.28 → batplot-1.8.30}/batplot/dev_upgrade.py +4 -2
- {batplot-1.8.28 → batplot-1.8.30}/batplot/operando.py +8 -3
- {batplot-1.8.28 → batplot-1.8.30}/batplot/operando_ec_interactive.py +2 -2
- {batplot-1.8.28 → batplot-1.8.30}/batplot/plotting.py +21 -7
- {batplot-1.8.28 → batplot-1.8.30}/batplot/readers.py +92 -50
- {batplot-1.8.28 → batplot-1.8.30}/batplot/version_check.py +2 -1
- {batplot-1.8.28 → batplot-1.8.30/batplot.egg-info}/PKG-INFO +63 -43
- {batplot-1.8.28 → batplot-1.8.30}/batplot.egg-info/SOURCES.txt +1 -3
- {batplot-1.8.28 → batplot-1.8.30}/pyproject.toml +2 -2
- batplot-1.8.30/setup.py +3 -0
- batplot-1.8.28/MANIFEST.in +0 -2
- batplot-1.8.28/USER_MANUAL.md +0 -723
- batplot-1.8.28/batplot/data/USER_MANUAL.md +0 -608
- batplot-1.8.28/setup.py +0 -3
- {batplot-1.8.28 → batplot-1.8.30}/LICENSE +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/NOTICE +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot/cif.py +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot/cli.py +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot/color_utils.py +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot/config.py +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot/cpc_interactive.py +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot/electrochem_interactive.py +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot/interactive.py +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot/manual.py +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot/modes.py +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot/session.py +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot/style.py +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot/ui.py +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot/utils.py +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot.egg-info/dependency_links.txt +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot.egg-info/entry_points.txt +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot.egg-info/requires.txt +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/batplot.egg-info/top_level.txt +0 -0
- {batplot-1.8.28 → batplot-1.8.30}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: batplot
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.30
|
|
4
4
|
Summary: Interactive plotting tool for material science (1D plot) and electrochemistry (GC, CV, dQ/dV, CPC, operando) with batch processing
|
|
5
5
|
Author-email: Tian Dai <tianda@uio.no>
|
|
6
6
|
License: MIT License
|
|
@@ -69,11 +69,14 @@ Dynamic: license-file
|
|
|
69
69
|
|
|
70
70
|
```bash
|
|
71
71
|
pip install batplot
|
|
72
|
+
# It is recommended to use separate environment for batplot to aviod compatability issues with dependencies.
|
|
72
73
|
```
|
|
73
74
|
|
|
74
75
|
## Quick Start
|
|
75
76
|
|
|
76
|
-
Tutorial: https://drive.google.com/file/d/1NTFJWNBbWW4mgz0H5ZelGjuOBWxoFgkr/view
|
|
77
|
+
- Tutorial: https://drive.google.com/file/d/1NTFJWNBbWW4mgz0H5ZelGjuOBWxoFgkr/view
|
|
78
|
+
- Tutorial files: https://github.com/chem-plot/batplot/blob/main/batplot_tutorial.zip
|
|
79
|
+
- Manual: https://github.com/chem-plot/batplot/blob/main/batplot_user_manual.pdf
|
|
77
80
|
|
|
78
81
|
---
|
|
79
82
|
|
|
@@ -88,12 +91,12 @@ In batplot, --xaxis is frequently used to indicate the data type.
|
|
|
88
91
|
# Specify X-axis type (Q, 2theta, r, k, energy, time or any user defined names)
|
|
89
92
|
# By defauly, batplot will skip the header lines, plot the first and second columns as x and y
|
|
90
93
|
# Q and q are equivalent (case-insensitive)
|
|
91
|
-
batplot pattern.xye --xaxis 2theta
|
|
92
|
-
batplot data.qye --xaxis q
|
|
93
|
-
batplot data.txt --xaxis whatever
|
|
94
|
+
batplot pattern.xye --xaxis 2theta --i
|
|
95
|
+
batplot data.qye --xaxis q --i
|
|
96
|
+
batplot data.txt --xaxis whatever --i
|
|
94
97
|
|
|
95
98
|
# Set X-axis range
|
|
96
|
-
batplot pattern.xye --xaxis 2theta --xrange 10 80
|
|
99
|
+
batplot pattern.xye --xaxis 2theta --xrange 10 80 --i
|
|
97
100
|
|
|
98
101
|
# Save to file (default .svg if no extension)
|
|
99
102
|
batplot pattern.xye --xaxis 2theta --out figure
|
|
@@ -104,64 +107,71 @@ batplot pattern.txt --xaxis Energy --out figure.png
|
|
|
104
107
|
|
|
105
108
|
```bash
|
|
106
109
|
# Convert 2θ to Q using wavelength (Å), --xaxis is no longer needed as providing wavelength is implying that user wants to convert and plot the data in Q space
|
|
107
|
-
batplot data.raw --wl 1.5406
|
|
110
|
+
batplot data.raw --wl 1.5406 --i
|
|
108
111
|
|
|
109
112
|
# Per-file wavelength: file.xye:1.54, in this case --xaxis is also not needed and files will be plotted in Q space
|
|
110
|
-
batplot scan1.brml:1.5406 scan2.xye:0.7093
|
|
113
|
+
batplot scan1.brml:1.5406 scan2.xye:0.7093 --i
|
|
111
114
|
|
|
112
115
|
# Convert and export to converted/ subfolder (q and Q equivalent)
|
|
113
116
|
batplot data.xye --convert 1.54 q
|
|
114
117
|
batplot data.qye --convert q 1.54
|
|
118
|
+
|
|
119
|
+
# With --readcol for custom column layout (e.g. 2θ in col 3, intensity in col 4)
|
|
120
|
+
batplot data.csv --readcol 3 4 --convert 1.54 q
|
|
121
|
+
batplot f1.txt --readcol 2 3 f2.txt --readcol 5 6 --convert 1.54 q
|
|
115
122
|
```
|
|
116
123
|
|
|
117
124
|
### Stacking and normalization
|
|
118
125
|
|
|
119
126
|
```bash
|
|
120
127
|
# Stack curves vertically (auto-normalizes)
|
|
121
|
-
batplot file1.xy file2.xy --stack
|
|
128
|
+
batplot file1.xy file2.xy --stack --i
|
|
122
129
|
|
|
123
130
|
# Control spacing between stacked curves
|
|
124
131
|
batplot file1.xy file2.xy --stack --delta 0.15
|
|
125
132
|
|
|
126
133
|
# Normalize intensity to 0–1 (without stacking)
|
|
127
|
-
batplot file.xy --norm
|
|
134
|
+
batplot file.xy --norm --i
|
|
128
135
|
```
|
|
129
136
|
|
|
130
137
|
### Dual y-axis (right y-axis)
|
|
131
138
|
|
|
132
139
|
```bash
|
|
133
140
|
# Plot selected files on the right y-axis (--ry disables --stack)
|
|
134
|
-
batplot file1.xy --ry file2.xy --ry file3.xy file4.xy --ry --
|
|
141
|
+
batplot file1.xy --ry file2.xy --ry file3.xy file4.xy --ry --i
|
|
135
142
|
# Files 1, 2, 4 use right y-axis; file 3 uses left y-axis
|
|
136
143
|
|
|
137
144
|
# With --txaxis: right y-axis curves use the top x-axis (default: shared bottom x)
|
|
138
|
-
batplot file1.xy --ry file2.xy --txaxis --
|
|
145
|
+
batplot file1.xy --ry file2.xy --txaxis --i
|
|
139
146
|
```
|
|
140
147
|
|
|
141
148
|
### Column selection and multi-curve
|
|
142
149
|
|
|
143
150
|
```bash
|
|
144
151
|
# Read columns 2 and 3 as X, Y (1-indexed)
|
|
145
|
-
batplot data.xy --readcol 2 3
|
|
152
|
+
batplot data.xy --readcol 2 3 --wl 1.54 --i
|
|
146
153
|
|
|
147
154
|
# Per-file columns
|
|
148
|
-
batplot file1.xy --readcol 2 3 file2.xy --readcol 4 5
|
|
155
|
+
batplot file1.xy --readcol 2 3 file2.xy --readcol 4 5 --xaxis r --i
|
|
149
156
|
|
|
150
157
|
# Multiple curves from same file (cols 1,2 and 1,3)
|
|
151
|
-
batplot data.xy --readcol 1 2 1 3
|
|
158
|
+
batplot data.xy --readcol 1 2 1 3 --xaxis 2theta --i
|
|
152
159
|
|
|
153
160
|
# Range: col 1 as x, cols 2–20 as 19 y-curves
|
|
154
|
-
batplot file.txt --readcol 1 2-20
|
|
161
|
+
batplot file.txt --readcol 1 2-20 --xaxis Energy --i
|
|
162
|
+
|
|
163
|
+
# With --convert: use custom columns when converting XRD data
|
|
164
|
+
batplot data.csv --readcol 3 4 --convert 1.54 q
|
|
155
165
|
```
|
|
156
166
|
|
|
157
167
|
### Derivatives and EXAFS
|
|
158
168
|
|
|
159
169
|
```bash
|
|
160
170
|
# Plot first derivative (dy/dx)
|
|
161
|
-
batplot file.xy --1d --stack
|
|
171
|
+
batplot file.xy --1d --stack --i
|
|
162
172
|
|
|
163
173
|
# EXAFS k-weighting
|
|
164
|
-
batplot data.chik --chik
|
|
174
|
+
batplot data.chik --chik --i # χ(k)
|
|
165
175
|
batplot data.chik --k2chik # k²χ(k), most common
|
|
166
176
|
batplot data.chik --k3chik --xrange 2 12
|
|
167
177
|
```
|
|
@@ -170,9 +180,9 @@ batplot data.chik --k3chik --xrange 2 12
|
|
|
170
180
|
|
|
171
181
|
```bash
|
|
172
182
|
# Open interactive menu for styling, ranges, export, session save
|
|
173
|
-
batplot pattern.xye --
|
|
174
|
-
batplot file1.xy file2.xy --stack --
|
|
175
|
-
batplot allfiles --xaxis 2theta --xrange 15 75 --
|
|
183
|
+
batplot pattern.xye --i
|
|
184
|
+
batplot file1.xy file2.xy --stack --i
|
|
185
|
+
batplot allfiles --xaxis 2theta --xrange 15 75 --i
|
|
176
186
|
```
|
|
177
187
|
|
|
178
188
|
---
|
|
@@ -186,54 +196,53 @@ batplot allfiles --xaxis 2theta --xrange 15 75 --interactive
|
|
|
186
196
|
|
|
187
197
|
### Galvanostatic cycling (GC)
|
|
188
198
|
|
|
199
|
+
GC mode plots potential vs. capacity for each charge/discharge cycle—the primary visualization for battery cycling data. Batplot automatically detects cycles from Neware `.csv` or Biologic `.mpt` files, assigns each cycle a distinct color, and supports both specific capacity (mAh/g) and raw capacity. For `.mpt` files, pass `--mass` (mg) to compute specific capacity. Discontinuous or paused experiments are handled by splitting data into contiguous charge/discharge segments. Use the interactive menu to customize colors, visibility, and export.
|
|
200
|
+
|
|
189
201
|
```bash
|
|
190
202
|
# From .csv (capacity in file)
|
|
191
|
-
batplot battery.csv --gc
|
|
203
|
+
batplot battery.csv --gc --i
|
|
192
204
|
|
|
193
205
|
# From .mpt (requires --mass in mg)
|
|
194
|
-
batplot battery.mpt --gc --mass 7.0
|
|
206
|
+
batplot battery.mpt --gc --mass 7.0 --i
|
|
195
207
|
|
|
196
|
-
# With interactive menu
|
|
197
|
-
batplot battery.csv --gc --interactive
|
|
198
208
|
```
|
|
199
209
|
|
|
200
210
|
### Cyclic voltammetry (CV)
|
|
201
211
|
|
|
202
212
|
```bash
|
|
203
|
-
batplot cyclic.mpt --cv
|
|
204
|
-
batplot cyclic.mpt --cv --
|
|
213
|
+
batplot cyclic.mpt --cv --i
|
|
214
|
+
batplot cyclic.mpt --cv --i
|
|
205
215
|
```
|
|
206
216
|
|
|
207
217
|
### Differential capacity (dQ/dV)
|
|
208
218
|
|
|
209
219
|
```bash
|
|
210
|
-
batplot battery.csv --dqdv
|
|
211
|
-
batplot battery.csv --dqdv --interactive
|
|
220
|
+
batplot battery.csv --dqdv --i
|
|
212
221
|
```
|
|
213
222
|
|
|
214
223
|
### Capacity per cycle (CPC)
|
|
215
224
|
|
|
216
225
|
```bash
|
|
217
226
|
# Single file
|
|
218
|
-
batplot stability.csv --cpc
|
|
219
|
-
batplot stability.mpt --cpc --mass 5.4
|
|
227
|
+
batplot stability.csv --cpc --i
|
|
228
|
+
batplot stability.mpt --cpc --mass 5.4 --i
|
|
220
229
|
|
|
221
230
|
# Multiple files with individual colors
|
|
222
|
-
batplot file1.csv file2.mpt --cpc --mass 6.0 --
|
|
231
|
+
batplot file1.csv file2.mpt --cpc --mass 6.0 --i
|
|
223
232
|
```
|
|
224
233
|
|
|
225
234
|
### Time vs potential
|
|
226
235
|
|
|
227
236
|
```bash
|
|
228
237
|
# Plot time (h) vs potential from CSV/MPT
|
|
229
|
-
batplot battery.csv --xaxis time --
|
|
238
|
+
batplot battery.csv --xaxis time --i
|
|
230
239
|
```
|
|
231
240
|
|
|
232
241
|
### Potential window (custom potential–time .mpt)
|
|
233
242
|
|
|
234
243
|
```bash
|
|
235
244
|
# Two columns: potential, time. Use --pw and --cd to plot as GC
|
|
236
|
-
batplot custom.mpt --gc --pw 0.01 3 --cd 0.2 --
|
|
245
|
+
batplot custom.mpt --gc --pw 0.01 3 --cd 0.2 --i
|
|
237
246
|
```
|
|
238
247
|
|
|
239
248
|
---
|
|
@@ -242,21 +251,28 @@ batplot custom.mpt --gc --pw 0.01 3 --cd 0.2 --interactive
|
|
|
242
251
|
|
|
243
252
|
```bash
|
|
244
253
|
# Contour from folder of .xy/.xye/.qye/.dat
|
|
245
|
-
batplot --operando --
|
|
254
|
+
batplot --operando --wl 1.54 --i
|
|
246
255
|
|
|
247
256
|
# With folder path
|
|
248
|
-
batplot /path/to/data --operando --
|
|
257
|
+
batplot /path/to/data --operando --xaxis 2theta --i
|
|
249
258
|
|
|
250
259
|
# Q conversion from 2θ
|
|
251
|
-
batplot --operando --wl 0.25995 --
|
|
260
|
+
batplot --operando --wl 0.25995 --i
|
|
261
|
+
|
|
262
|
+
# Column selection: --readcolc for contour, --readcols for side panel (.mpt)
|
|
263
|
+
batplot --operando --readcolc 2 3 --readcols 1 2 --i
|
|
252
264
|
|
|
253
265
|
# Derivative contour
|
|
254
|
-
batplot --operando --1d --
|
|
266
|
+
batplot --operando --1d --i
|
|
255
267
|
|
|
256
268
|
# With CIF tick labels
|
|
257
|
-
batplot folder phase.cif:1.54 --operando --
|
|
269
|
+
batplot folder phase.cif:1.54 --operando --i
|
|
258
270
|
```
|
|
259
271
|
|
|
272
|
+
Operando column selection:
|
|
273
|
+
- `--readcolc <x> <y>`: columns for the contour plot (from .xy/.xye/.qye/.dat files)
|
|
274
|
+
- `--readcols <x> <y>`: columns for the side panel (from .mpt file)
|
|
275
|
+
|
|
260
276
|
---
|
|
261
277
|
|
|
262
278
|
## Plotting multiple files
|
|
@@ -264,27 +280,31 @@ batplot folder phase.cif:1.54 --operando --interactive
|
|
|
264
280
|
```bash
|
|
265
281
|
# All XY files in current directory on same figure
|
|
266
282
|
batplot allfiles
|
|
267
|
-
batplot allfiles --stack --
|
|
283
|
+
batplot allfiles --stack --i
|
|
268
284
|
|
|
269
285
|
# Only specific extension (natural-sorted)
|
|
270
286
|
batplot allxyfiles
|
|
271
|
-
batplot "/path/to/data" allnorfiles --
|
|
287
|
+
batplot "/path/to/data" allnorfiles --i
|
|
272
288
|
|
|
273
289
|
# Explicit file list
|
|
274
|
-
batplot file1.xye file2.qye structure.cif:1.54 --stack --
|
|
290
|
+
batplot file1.xye file2.qye structure.cif:1.54 --stack --i
|
|
275
291
|
```
|
|
276
292
|
|
|
277
293
|
---
|
|
278
294
|
|
|
279
295
|
## Batch export (--all)
|
|
280
296
|
|
|
281
|
-
Export each file as a separate figure to `
|
|
297
|
+
Export each file as a separate figure to `Figures/`:
|
|
282
298
|
|
|
283
299
|
```bash
|
|
284
300
|
batplot --all
|
|
285
301
|
batplot --all --format png
|
|
286
302
|
batplot --all --xaxis 2theta --xrange 10 80
|
|
287
303
|
batplot --all style.bps --gc --mass 7
|
|
304
|
+
|
|
305
|
+
# With --readcol for custom columns (put --readcol before style file)
|
|
306
|
+
batplot --all --readcol 2 3 --xaxis 2theta
|
|
307
|
+
batplot --all --readcol 2 3 style.bps --xaxis 2theta
|
|
288
308
|
```
|
|
289
309
|
|
|
290
310
|
---
|
|
@@ -18,11 +18,14 @@
|
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
20
|
pip install batplot
|
|
21
|
+
# It is recommended to use separate environment for batplot to aviod compatability issues with dependencies.
|
|
21
22
|
```
|
|
22
23
|
|
|
23
24
|
## Quick Start
|
|
24
25
|
|
|
25
|
-
Tutorial: https://drive.google.com/file/d/1NTFJWNBbWW4mgz0H5ZelGjuOBWxoFgkr/view
|
|
26
|
+
- Tutorial: https://drive.google.com/file/d/1NTFJWNBbWW4mgz0H5ZelGjuOBWxoFgkr/view
|
|
27
|
+
- Tutorial files: https://github.com/chem-plot/batplot/blob/main/batplot_tutorial.zip
|
|
28
|
+
- Manual: https://github.com/chem-plot/batplot/blob/main/batplot_user_manual.pdf
|
|
26
29
|
|
|
27
30
|
---
|
|
28
31
|
|
|
@@ -37,12 +40,12 @@ In batplot, --xaxis is frequently used to indicate the data type.
|
|
|
37
40
|
# Specify X-axis type (Q, 2theta, r, k, energy, time or any user defined names)
|
|
38
41
|
# By defauly, batplot will skip the header lines, plot the first and second columns as x and y
|
|
39
42
|
# Q and q are equivalent (case-insensitive)
|
|
40
|
-
batplot pattern.xye --xaxis 2theta
|
|
41
|
-
batplot data.qye --xaxis q
|
|
42
|
-
batplot data.txt --xaxis whatever
|
|
43
|
+
batplot pattern.xye --xaxis 2theta --i
|
|
44
|
+
batplot data.qye --xaxis q --i
|
|
45
|
+
batplot data.txt --xaxis whatever --i
|
|
43
46
|
|
|
44
47
|
# Set X-axis range
|
|
45
|
-
batplot pattern.xye --xaxis 2theta --xrange 10 80
|
|
48
|
+
batplot pattern.xye --xaxis 2theta --xrange 10 80 --i
|
|
46
49
|
|
|
47
50
|
# Save to file (default .svg if no extension)
|
|
48
51
|
batplot pattern.xye --xaxis 2theta --out figure
|
|
@@ -53,64 +56,71 @@ batplot pattern.txt --xaxis Energy --out figure.png
|
|
|
53
56
|
|
|
54
57
|
```bash
|
|
55
58
|
# Convert 2θ to Q using wavelength (Å), --xaxis is no longer needed as providing wavelength is implying that user wants to convert and plot the data in Q space
|
|
56
|
-
batplot data.raw --wl 1.5406
|
|
59
|
+
batplot data.raw --wl 1.5406 --i
|
|
57
60
|
|
|
58
61
|
# Per-file wavelength: file.xye:1.54, in this case --xaxis is also not needed and files will be plotted in Q space
|
|
59
|
-
batplot scan1.brml:1.5406 scan2.xye:0.7093
|
|
62
|
+
batplot scan1.brml:1.5406 scan2.xye:0.7093 --i
|
|
60
63
|
|
|
61
64
|
# Convert and export to converted/ subfolder (q and Q equivalent)
|
|
62
65
|
batplot data.xye --convert 1.54 q
|
|
63
66
|
batplot data.qye --convert q 1.54
|
|
67
|
+
|
|
68
|
+
# With --readcol for custom column layout (e.g. 2θ in col 3, intensity in col 4)
|
|
69
|
+
batplot data.csv --readcol 3 4 --convert 1.54 q
|
|
70
|
+
batplot f1.txt --readcol 2 3 f2.txt --readcol 5 6 --convert 1.54 q
|
|
64
71
|
```
|
|
65
72
|
|
|
66
73
|
### Stacking and normalization
|
|
67
74
|
|
|
68
75
|
```bash
|
|
69
76
|
# Stack curves vertically (auto-normalizes)
|
|
70
|
-
batplot file1.xy file2.xy --stack
|
|
77
|
+
batplot file1.xy file2.xy --stack --i
|
|
71
78
|
|
|
72
79
|
# Control spacing between stacked curves
|
|
73
80
|
batplot file1.xy file2.xy --stack --delta 0.15
|
|
74
81
|
|
|
75
82
|
# Normalize intensity to 0–1 (without stacking)
|
|
76
|
-
batplot file.xy --norm
|
|
83
|
+
batplot file.xy --norm --i
|
|
77
84
|
```
|
|
78
85
|
|
|
79
86
|
### Dual y-axis (right y-axis)
|
|
80
87
|
|
|
81
88
|
```bash
|
|
82
89
|
# Plot selected files on the right y-axis (--ry disables --stack)
|
|
83
|
-
batplot file1.xy --ry file2.xy --ry file3.xy file4.xy --ry --
|
|
90
|
+
batplot file1.xy --ry file2.xy --ry file3.xy file4.xy --ry --i
|
|
84
91
|
# Files 1, 2, 4 use right y-axis; file 3 uses left y-axis
|
|
85
92
|
|
|
86
93
|
# With --txaxis: right y-axis curves use the top x-axis (default: shared bottom x)
|
|
87
|
-
batplot file1.xy --ry file2.xy --txaxis --
|
|
94
|
+
batplot file1.xy --ry file2.xy --txaxis --i
|
|
88
95
|
```
|
|
89
96
|
|
|
90
97
|
### Column selection and multi-curve
|
|
91
98
|
|
|
92
99
|
```bash
|
|
93
100
|
# Read columns 2 and 3 as X, Y (1-indexed)
|
|
94
|
-
batplot data.xy --readcol 2 3
|
|
101
|
+
batplot data.xy --readcol 2 3 --wl 1.54 --i
|
|
95
102
|
|
|
96
103
|
# Per-file columns
|
|
97
|
-
batplot file1.xy --readcol 2 3 file2.xy --readcol 4 5
|
|
104
|
+
batplot file1.xy --readcol 2 3 file2.xy --readcol 4 5 --xaxis r --i
|
|
98
105
|
|
|
99
106
|
# Multiple curves from same file (cols 1,2 and 1,3)
|
|
100
|
-
batplot data.xy --readcol 1 2 1 3
|
|
107
|
+
batplot data.xy --readcol 1 2 1 3 --xaxis 2theta --i
|
|
101
108
|
|
|
102
109
|
# Range: col 1 as x, cols 2–20 as 19 y-curves
|
|
103
|
-
batplot file.txt --readcol 1 2-20
|
|
110
|
+
batplot file.txt --readcol 1 2-20 --xaxis Energy --i
|
|
111
|
+
|
|
112
|
+
# With --convert: use custom columns when converting XRD data
|
|
113
|
+
batplot data.csv --readcol 3 4 --convert 1.54 q
|
|
104
114
|
```
|
|
105
115
|
|
|
106
116
|
### Derivatives and EXAFS
|
|
107
117
|
|
|
108
118
|
```bash
|
|
109
119
|
# Plot first derivative (dy/dx)
|
|
110
|
-
batplot file.xy --1d --stack
|
|
120
|
+
batplot file.xy --1d --stack --i
|
|
111
121
|
|
|
112
122
|
# EXAFS k-weighting
|
|
113
|
-
batplot data.chik --chik
|
|
123
|
+
batplot data.chik --chik --i # χ(k)
|
|
114
124
|
batplot data.chik --k2chik # k²χ(k), most common
|
|
115
125
|
batplot data.chik --k3chik --xrange 2 12
|
|
116
126
|
```
|
|
@@ -119,9 +129,9 @@ batplot data.chik --k3chik --xrange 2 12
|
|
|
119
129
|
|
|
120
130
|
```bash
|
|
121
131
|
# Open interactive menu for styling, ranges, export, session save
|
|
122
|
-
batplot pattern.xye --
|
|
123
|
-
batplot file1.xy file2.xy --stack --
|
|
124
|
-
batplot allfiles --xaxis 2theta --xrange 15 75 --
|
|
132
|
+
batplot pattern.xye --i
|
|
133
|
+
batplot file1.xy file2.xy --stack --i
|
|
134
|
+
batplot allfiles --xaxis 2theta --xrange 15 75 --i
|
|
125
135
|
```
|
|
126
136
|
|
|
127
137
|
---
|
|
@@ -135,54 +145,53 @@ batplot allfiles --xaxis 2theta --xrange 15 75 --interactive
|
|
|
135
145
|
|
|
136
146
|
### Galvanostatic cycling (GC)
|
|
137
147
|
|
|
148
|
+
GC mode plots potential vs. capacity for each charge/discharge cycle—the primary visualization for battery cycling data. Batplot automatically detects cycles from Neware `.csv` or Biologic `.mpt` files, assigns each cycle a distinct color, and supports both specific capacity (mAh/g) and raw capacity. For `.mpt` files, pass `--mass` (mg) to compute specific capacity. Discontinuous or paused experiments are handled by splitting data into contiguous charge/discharge segments. Use the interactive menu to customize colors, visibility, and export.
|
|
149
|
+
|
|
138
150
|
```bash
|
|
139
151
|
# From .csv (capacity in file)
|
|
140
|
-
batplot battery.csv --gc
|
|
152
|
+
batplot battery.csv --gc --i
|
|
141
153
|
|
|
142
154
|
# From .mpt (requires --mass in mg)
|
|
143
|
-
batplot battery.mpt --gc --mass 7.0
|
|
155
|
+
batplot battery.mpt --gc --mass 7.0 --i
|
|
144
156
|
|
|
145
|
-
# With interactive menu
|
|
146
|
-
batplot battery.csv --gc --interactive
|
|
147
157
|
```
|
|
148
158
|
|
|
149
159
|
### Cyclic voltammetry (CV)
|
|
150
160
|
|
|
151
161
|
```bash
|
|
152
|
-
batplot cyclic.mpt --cv
|
|
153
|
-
batplot cyclic.mpt --cv --
|
|
162
|
+
batplot cyclic.mpt --cv --i
|
|
163
|
+
batplot cyclic.mpt --cv --i
|
|
154
164
|
```
|
|
155
165
|
|
|
156
166
|
### Differential capacity (dQ/dV)
|
|
157
167
|
|
|
158
168
|
```bash
|
|
159
|
-
batplot battery.csv --dqdv
|
|
160
|
-
batplot battery.csv --dqdv --interactive
|
|
169
|
+
batplot battery.csv --dqdv --i
|
|
161
170
|
```
|
|
162
171
|
|
|
163
172
|
### Capacity per cycle (CPC)
|
|
164
173
|
|
|
165
174
|
```bash
|
|
166
175
|
# Single file
|
|
167
|
-
batplot stability.csv --cpc
|
|
168
|
-
batplot stability.mpt --cpc --mass 5.4
|
|
176
|
+
batplot stability.csv --cpc --i
|
|
177
|
+
batplot stability.mpt --cpc --mass 5.4 --i
|
|
169
178
|
|
|
170
179
|
# Multiple files with individual colors
|
|
171
|
-
batplot file1.csv file2.mpt --cpc --mass 6.0 --
|
|
180
|
+
batplot file1.csv file2.mpt --cpc --mass 6.0 --i
|
|
172
181
|
```
|
|
173
182
|
|
|
174
183
|
### Time vs potential
|
|
175
184
|
|
|
176
185
|
```bash
|
|
177
186
|
# Plot time (h) vs potential from CSV/MPT
|
|
178
|
-
batplot battery.csv --xaxis time --
|
|
187
|
+
batplot battery.csv --xaxis time --i
|
|
179
188
|
```
|
|
180
189
|
|
|
181
190
|
### Potential window (custom potential–time .mpt)
|
|
182
191
|
|
|
183
192
|
```bash
|
|
184
193
|
# Two columns: potential, time. Use --pw and --cd to plot as GC
|
|
185
|
-
batplot custom.mpt --gc --pw 0.01 3 --cd 0.2 --
|
|
194
|
+
batplot custom.mpt --gc --pw 0.01 3 --cd 0.2 --i
|
|
186
195
|
```
|
|
187
196
|
|
|
188
197
|
---
|
|
@@ -191,21 +200,28 @@ batplot custom.mpt --gc --pw 0.01 3 --cd 0.2 --interactive
|
|
|
191
200
|
|
|
192
201
|
```bash
|
|
193
202
|
# Contour from folder of .xy/.xye/.qye/.dat
|
|
194
|
-
batplot --operando --
|
|
203
|
+
batplot --operando --wl 1.54 --i
|
|
195
204
|
|
|
196
205
|
# With folder path
|
|
197
|
-
batplot /path/to/data --operando --
|
|
206
|
+
batplot /path/to/data --operando --xaxis 2theta --i
|
|
198
207
|
|
|
199
208
|
# Q conversion from 2θ
|
|
200
|
-
batplot --operando --wl 0.25995 --
|
|
209
|
+
batplot --operando --wl 0.25995 --i
|
|
210
|
+
|
|
211
|
+
# Column selection: --readcolc for contour, --readcols for side panel (.mpt)
|
|
212
|
+
batplot --operando --readcolc 2 3 --readcols 1 2 --i
|
|
201
213
|
|
|
202
214
|
# Derivative contour
|
|
203
|
-
batplot --operando --1d --
|
|
215
|
+
batplot --operando --1d --i
|
|
204
216
|
|
|
205
217
|
# With CIF tick labels
|
|
206
|
-
batplot folder phase.cif:1.54 --operando --
|
|
218
|
+
batplot folder phase.cif:1.54 --operando --i
|
|
207
219
|
```
|
|
208
220
|
|
|
221
|
+
Operando column selection:
|
|
222
|
+
- `--readcolc <x> <y>`: columns for the contour plot (from .xy/.xye/.qye/.dat files)
|
|
223
|
+
- `--readcols <x> <y>`: columns for the side panel (from .mpt file)
|
|
224
|
+
|
|
209
225
|
---
|
|
210
226
|
|
|
211
227
|
## Plotting multiple files
|
|
@@ -213,27 +229,31 @@ batplot folder phase.cif:1.54 --operando --interactive
|
|
|
213
229
|
```bash
|
|
214
230
|
# All XY files in current directory on same figure
|
|
215
231
|
batplot allfiles
|
|
216
|
-
batplot allfiles --stack --
|
|
232
|
+
batplot allfiles --stack --i
|
|
217
233
|
|
|
218
234
|
# Only specific extension (natural-sorted)
|
|
219
235
|
batplot allxyfiles
|
|
220
|
-
batplot "/path/to/data" allnorfiles --
|
|
236
|
+
batplot "/path/to/data" allnorfiles --i
|
|
221
237
|
|
|
222
238
|
# Explicit file list
|
|
223
|
-
batplot file1.xye file2.qye structure.cif:1.54 --stack --
|
|
239
|
+
batplot file1.xye file2.qye structure.cif:1.54 --stack --i
|
|
224
240
|
```
|
|
225
241
|
|
|
226
242
|
---
|
|
227
243
|
|
|
228
244
|
## Batch export (--all)
|
|
229
245
|
|
|
230
|
-
Export each file as a separate figure to `
|
|
246
|
+
Export each file as a separate figure to `Figures/`:
|
|
231
247
|
|
|
232
248
|
```bash
|
|
233
249
|
batplot --all
|
|
234
250
|
batplot --all --format png
|
|
235
251
|
batplot --all --xaxis 2theta --xrange 10 80
|
|
236
252
|
batplot --all style.bps --gc --mass 7
|
|
253
|
+
|
|
254
|
+
# With --readcol for custom columns (put --readcol before style file)
|
|
255
|
+
batplot --all --readcol 2 3 --xaxis 2theta
|
|
256
|
+
batplot --all --readcol 2 3 style.bps --xaxis 2theta
|
|
237
257
|
```
|
|
238
258
|
|
|
239
259
|
---
|
|
@@ -227,6 +227,9 @@ def _print_xy_help() -> None:
|
|
|
227
227
|
" - <wl1> <wl2> : convert 2θ from wavelength1 to wavelength2\n"
|
|
228
228
|
" - <wl> q or Q : convert 2θ (with wavelength) to Q space (q and Q equivalent)\n"
|
|
229
229
|
" - q or Q <wl> : convert Q space to 2θ (with wavelength)\n"
|
|
230
|
+
" Works with --readcol for custom column layout (per-file, per-ext, or global):\n"
|
|
231
|
+
" batplot data.csv --readcol 3 4 --convert 1.54 q\n"
|
|
232
|
+
" batplot f1.txt --readcol 2 3 f2.txt --readcol 5 6 --convert 1.54 q\n"
|
|
230
233
|
" Examples:\n"
|
|
231
234
|
" batplot file.xye --convert 1.54 0.25\n"
|
|
232
235
|
" batplot file.xye --convert 1.54 q\n"
|
|
@@ -244,6 +247,7 @@ def _print_xy_help() -> None:
|
|
|
244
247
|
" Multi-curve: file.xy --readcol 1 2 1 3 (plot cols 1,2 and 1,3 as two curves)\n"
|
|
245
248
|
" Range: file.txt --readcol 1 2-20 (col 1 as x, cols 2..20 as 19 y-curves)\n"
|
|
246
249
|
" With wavelength: file.xy:1.54 --readcol 2 3 (col 2 as 2θ, convert to Q using λ=1.54 Å)\n"
|
|
250
|
+
" With --convert: file.csv --readcol 3 4 --convert 1.54 q (custom cols for conversion)\n"
|
|
247
251
|
" --readcolxy <x> <y> : read columns for .xy files only\n"
|
|
248
252
|
" --readcolxye <x> <y> : read columns for .xye files only\n"
|
|
249
253
|
" --readcolqye <x> <y> : read columns for .qye files only\n"
|
|
@@ -335,6 +339,10 @@ def _print_op_help() -> None:
|
|
|
335
339
|
" • If a .mpt file is present, a side panel is added for dual-panel mode (time/potential/temp/etc.).\n"
|
|
336
340
|
" • Without a .mpt file, operando-only mode shows the contour plot alone.\n"
|
|
337
341
|
" • --1d / --2d: plot the first derivative (dy/dx) of each scan as a contour plot.\n\n"
|
|
342
|
+
"Column selection (operando-specific):\n"
|
|
343
|
+
" --readcolc <x> <y> : columns for contour plot (x,y in .xy/.xye/.qye/.dat files)\n"
|
|
344
|
+
" --readcols <x> <y> : columns for side panel (x,y in .mpt file)\n"
|
|
345
|
+
" Example: batplot --operando --readcolc 2 3 --readcols 1 2 --i\n\n"
|
|
338
346
|
"Interactive (--i): menu has (Styles), (Operando), (Side Panel), (Options) columns.\n"
|
|
339
347
|
"Resize axes/canvas, change colormap, set intensity range (oz), side-panel options,\n"
|
|
340
348
|
"geometry tweaks, toggle spines/ticks/labels, print/export/import style, save session.\n"
|
|
@@ -464,6 +472,10 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
464
472
|
help=argparse.SUPPRESS)
|
|
465
473
|
parser.add_argument("--readcolcsv", nargs=2, type=int, metavar=('X_COL', 'Y_COL'),
|
|
466
474
|
help=argparse.SUPPRESS)
|
|
475
|
+
parser.add_argument("--readcolc", nargs=2, type=int, metavar=('X_COL', 'Y_COL'),
|
|
476
|
+
help=argparse.SUPPRESS)
|
|
477
|
+
parser.add_argument("--readcols", nargs=2, type=int, metavar=('X_COL', 'Y_COL'),
|
|
478
|
+
help=argparse.SUPPRESS)
|
|
467
479
|
parser.add_argument("--1d", action="store_true", dest="derivative_1d", help=argparse.SUPPRESS)
|
|
468
480
|
parser.add_argument("--2d", action="store_true", dest="derivative_2d", help=argparse.SUPPRESS)
|
|
469
481
|
return parser
|
|
@@ -537,8 +549,8 @@ def parse_args(argv=None):
|
|
|
537
549
|
match = re.match(r'^--readcol([a-z0-9]+)$', arg)
|
|
538
550
|
if match:
|
|
539
551
|
ext = match.group(1) # Extract extension name
|
|
540
|
-
# Skip predefined extensions (already in parser)
|
|
541
|
-
if ext not in ['xy', 'xye', 'qye', 'nor', 'dat', 'csv']:
|
|
552
|
+
# Skip predefined extensions (already in parser) and operando-specific (readcolc, readcols)
|
|
553
|
+
if ext not in ['xy', 'xye', 'qye', 'nor', 'dat', 'csv', 'c', 's']:
|
|
542
554
|
custom_readcol_exts.add(ext)
|
|
543
555
|
i += 1
|
|
544
556
|
|
|
@@ -574,17 +586,22 @@ def parse_args(argv=None):
|
|
|
574
586
|
# does not consume it. When --readcol appears before any file (global),
|
|
575
587
|
# store in global_readcol_expanded for post-parse.
|
|
576
588
|
# Keys use the exact file token (e.g. "file.xy:1.54") for wavelength match.
|
|
589
|
+
# Style files (.bps, .bpsg, .bpcfg) are NOT treated as file tokens so that
|
|
590
|
+
# "batplot --all style.bps --readcol 2 3" uses global readcol, not per-file.
|
|
577
591
|
# ====================================================================
|
|
578
592
|
readcol_by_file = {}
|
|
579
593
|
global_readcol_expanded = None
|
|
580
594
|
filtered_argv = []
|
|
581
595
|
last_file_token = None
|
|
596
|
+
_STYLE_EXTENSIONS = ('.bps', '.bpsg', '.bpcfg')
|
|
582
597
|
i = 0
|
|
583
598
|
while i < len(argv):
|
|
584
599
|
arg = argv[i]
|
|
585
|
-
# Track non-option tokens as potential file specs
|
|
600
|
+
# Track non-option tokens as potential file specs (exclude style files)
|
|
586
601
|
if not arg.startswith('-'):
|
|
587
|
-
|
|
602
|
+
arg_lower = arg.lower()
|
|
603
|
+
if not arg_lower.endswith(_STYLE_EXTENSIONS):
|
|
604
|
+
last_file_token = arg
|
|
588
605
|
if arg == '--readcol' and i + 1 < len(argv):
|
|
589
606
|
tokens = []
|
|
590
607
|
j = i + 1
|
|
@@ -14,6 +14,7 @@ from .readers import (
|
|
|
14
14
|
read_gr_file,
|
|
15
15
|
read_xrd_vendor_file,
|
|
16
16
|
is_bruker_raw,
|
|
17
|
+
loadtxt_with_decimal_comma,
|
|
17
18
|
robust_loadtxt_skipheader,
|
|
18
19
|
read_mpt_file,
|
|
19
20
|
read_ec_csv_file,
|
|
@@ -593,20 +594,20 @@ def batch_process(directory: str, args):
|
|
|
593
594
|
x, y = read_gr_file(fpath); e = None
|
|
594
595
|
axis_mode = 'r'
|
|
595
596
|
elif ext == '.nor':
|
|
596
|
-
data =
|
|
597
|
+
data = loadtxt_with_decimal_comma(fpath)
|
|
597
598
|
if data.ndim == 1: data = data.reshape(1, -1)
|
|
598
599
|
if data.shape[1] < 2: raise ValueError("Invalid .nor format")
|
|
599
600
|
x, y = data[:,0], data[:,1]
|
|
600
601
|
e = data[:,2] if data.shape[1] >= 3 else None
|
|
601
602
|
axis_mode = 'energy'
|
|
602
603
|
elif 'chik' in ext:
|
|
603
|
-
data =
|
|
604
|
+
data = loadtxt_with_decimal_comma(fpath)
|
|
604
605
|
if data.ndim == 1: data = data.reshape(1, -1)
|
|
605
606
|
if data.shape[1] < 2: raise ValueError("Invalid .chik data")
|
|
606
607
|
x, y = data[:,0], data[:,1]; e = data[:,2] if data.shape[1] >= 3 else None
|
|
607
608
|
axis_mode = 'k'
|
|
608
609
|
elif 'chir' in ext:
|
|
609
|
-
data =
|
|
610
|
+
data = loadtxt_with_decimal_comma(fpath)
|
|
610
611
|
if data.ndim == 1: data = data.reshape(1, -1)
|
|
611
612
|
if data.shape[1] < 2: raise ValueError("Invalid .chir data")
|
|
612
613
|
x, y = data[:,0], data[:,1]; e = data[:,2] if data.shape[1] >= 3 else None
|