Skip to content
Snippets Groups Projects
Commit 4b0ac47d authored by Matthias Boljen's avatar Matthias Boljen
Browse files

Update examples

parent 083da83f
No related branches found
No related tags found
No related merge requests found
......@@ -22,31 +22,80 @@ mkgrid - Convert scattered data to regular gridded data in 2D, 3D, and 4D.
- **-m**, **-\-method** *METHOD*
Set interpolation method.
Set interpolation method. If undefined, linear interpolation will be applied.
- **-p**, **-\-plot** [*FILENAME*]
Set filename of plot. If undefined, a plot widget will be raised.
Set filename of plot. If undefined, an interactive plot widget will be raised.
- **-u**, **-\-usecols** *USECOLS*
Set comma-separated list of data columns to use from input file.
Set comma-separated list of data columns to use from input file. If undefined, all available data columns will be used.
- **-r**, **-\-range** *RANGE*
Set comma-separated list of range specifiers for output data.
Set comma-separated list of range specifiers for output data. If undefined, ranges will be auto-detected from input data.
- **-s**, **-\-steps** *STEPS*
Set comma-separated list of discretization steps along each column.
Set comma-separated list of discretization steps along each column. If undefined, a default of 10 discretization steps will be used.
# EXAMPLES
## 2D
## 2D data
```text
time eps1 sig1
0.000 0.000 0.000
1.000 0.005 0.615
2.000 0.010 1.526
3.000 0.014 2.935
4.000 0.019 4.712
5.000 0.024 6.905
6.000 0.029 9.221
7.000 0.033 11.599
[...]
```
```bash
$ mkgrid -i testdata2.csv -u 2,3 -r 0:0.14 -s 14 -p
```
The output will look like the following:
```text
eps1 sig1
0.000 0.000
0.010 1.526
0.020 5.123
0.030 9.808
0.040 14.861
0.050 19.338
0.060 23.308
[...]
0.120 55.220
0.130 63.375
0.140 72.230
```
![Example 2D data](test/testdata2.png)
## 3D data
```bash
$ mkgrid -i testdata3.csv -u 2,4,3 -r 0:0.13,0:0.13 -s 26 -p
```
![Example 3D data](test/testdata3.png)
## 4D data
```bash
$ mkgrid -i testdata4.csv -p
```
## 3D
![Example 4D data](test/testdata4.png)
## 4D
# BUGS
......
#!/usr/bin/env python3
#
# Created: Mon 2024-07-15 18:40:27 CEST (boljen)
# Modified: Tue 2024-07-16 14:30:12 CEST (boljen)
# Modified: Tue 2024-07-16 18:34:55 CEST (boljen)
#
# mkgrid:
# Convert scattered data to regular gridded data in 2D, 3D and 4D
......@@ -282,7 +282,8 @@ def execute_main():
if len(usecols)==2:
# Create 2D plot
fig, ax = plt.subplots()
fig = plt.figure(figsize=(8,6))
ax = fig.add_subplot()
# Add decorations
ax.grid(which='major', color='#DDDDDD', linewidth=0.7)
......@@ -294,14 +295,14 @@ def execute_main():
ax.set_ylabel(label[1], fontsize=10, labelpad=10)
# Add data
ax.plot(xi, yi, label='Interpolated data')
ax.scatter(x, y, label='Input data')
ax.plot(xi, yi, marker='o', label='Interpolated data')
ax.scatter(x, y, color='black', marker='o', label='Input data')
ax.legend(loc='best')
elif len(usecols)==3:
# Create 3D plot
fig = plt.figure()
fig = plt.figure(figsize=(8,6))
ax = fig.add_subplot(projection='3d')
# Add labels
......@@ -309,6 +310,9 @@ def execute_main():
ax.set_ylabel(label[1], fontsize=10, labelpad=10)
ax.set_zlabel(label[2], fontsize=10, labelpad=10)
# Set view angles
ax.view_init(elev=30, azim=-125)
# Add data
plot = ax.plot_surface(xi, yi, zi, cmap='viridis', linewidth=0.3, edgecolor='black')
ax.scatter(x, y, z, s=4, c='black', marker='o')
......@@ -319,7 +323,7 @@ def execute_main():
elif len(usecols)==4:
# Create 4D plot
fig = plt.figure()
fig = plt.figure(figsize=(8,6))
ax = fig.add_subplot(projection='3d')
# Add labels
......
......@@ -5,10 +5,10 @@ OUTFILES = $(addsuffix .out, testdata2 testdata3 testdata4)
default: $(OUTFILES)
testdata2.out: testdata2.csv
$(MKGRID) -i $< -o $@ -p $(subst .csv,.png,$<)
$(MKGRID) -i $< -o $@ -p $(subst .csv,.png,$<) -u 2,3 -r 0:0.14 -s 14 -m cubic
testdata3.out: testdata3.csv
$(MKGRID) -i $< -u 2,4,3 -o $@ -p $(subst .csv,.png,$<)
$(MKGRID) -i $< -o $@ -p $(subst .csv,.png,$<) -u 2,4,3 -r 0:0.13,0:0.13 -s 26
testdata4.out: testdata4.csv
$(MKGRID) -i $< -o $@ -p $(subst .csv,.png,$<)
......
X Y
0.000 0.000
1.000 1.000
2.000 4.000
3.000 9.000
4.000 16.000
5.000 20.000
6.000 10.000
time eps1 sig1
0.000 0.000 0.000
1.000 0.005 0.615
2.000 0.010 1.526
3.000 0.014 2.935
4.000 0.019 4.712
5.000 0.024 6.905
6.000 0.029 9.221
7.000 0.033 11.599
8.000 0.038 13.814
9.000 0.042 15.976
10.000 0.046 17.888
11.000 0.051 19.718
12.000 0.055 21.449
13.000 0.059 22.973
14.000 0.064 24.658
15.000 0.068 26.255
16.000 0.072 27.894
17.000 0.076 29.594
18.000 0.080 31.284
19.000 0.084 33.191
20.000 0.088 35.087
21.000 0.092 37.076
22.000 0.095 39.155
23.000 0.099 41.141
24.000 0.102 43.313
25.000 0.106 45.497
26.000 0.109 47.519
27.000 0.113 49.743
28.000 0.116 51.956
29.000 0.119 54.392
30.000 0.122 56.772
31.000 0.125 59.091
32.000 0.127 61.370
33.000 0.130 63.375
34.000 0.133 65.625
35.000 0.136 68.049
36.000 0.138 70.579
37.000 0.141 73.057
38.000 0.143 75.443
39.000 0.145 77.677
test/testdata2.png

44.9 KiB | W: | H:

test/testdata2.png

62.8 KiB | W: | H:

test/testdata2.png
test/testdata2.png
test/testdata2.png
test/testdata2.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.
test/testdata3.png

88.3 KiB | W: | H:

test/testdata3.png

86.8 KiB | W: | H:

test/testdata3.png
test/testdata3.png
test/testdata3.png
test/testdata3.png
  • 2-up
  • Swipe
  • Onion skin
test/testdata4.png

109 KiB | W: | H:

test/testdata4.png

109 KiB | W: | H:

test/testdata4.png
test/testdata4.png
test/testdata4.png
test/testdata4.png
  • 2-up
  • Swipe
  • Onion skin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment