Update README.md
Browse files
README.md
CHANGED
|
@@ -368,17 +368,15 @@ import datasets
|
|
| 368 |
import torch
|
| 369 |
from torch.utils.data import DataLoader
|
| 370 |
|
| 371 |
-
|
| 372 |
-
|
| 373 |
if c.startswith("boundary.")
|
| 374 |
or c.startswith("metrics.")])
|
| 375 |
|
| 376 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 377 |
-
ds_torch =
|
| 378 |
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
for batch in dataloader:
|
| 382 |
print(batch)
|
| 383 |
break
|
| 384 |
```
|
|
@@ -387,105 +385,112 @@ for batch in dataloader:
|
|
| 387 |
<summary>Output</summary>
|
| 388 |
|
| 389 |
```python
|
| 390 |
-
{'
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
'
|
| 395 |
-
'
|
| 396 |
-
'boundary.r_cos(0, 4)': tensor([ 2.7140e-06, -5.2107e-04, 4.1021e-04, 4.6007e-04]),
|
| 397 |
-
'boundary.r_cos(1, -1)': tensor([-0.0774, -0.0480, 0.0674, 0.0142]),
|
| 398 |
-
'boundary.r_cos(1, -2)': tensor([-0.0254, 0.0015, 0.0327, 0.0565]),
|
| 399 |
-
'boundary.r_cos(1, -3)': tensor([-0.0036, -0.0002, 0.0047, -0.0110]),
|
| 400 |
-
'boundary.r_cos(1, -4)': tensor([ 0.0009, -0.0007, 0.0019, -0.0007]),
|
| 401 |
-
'boundary.r_cos(1, 0)': tensor([0.2136, 0.1506, 0.0668, 0.0835]),
|
| 402 |
-
'boundary.r_cos(1, 1)': tensor([-0.0430, -0.0009, -0.0421, -0.0468]),
|
| 403 |
-
'boundary.r_cos(1, 2)': tensor([ 0.0070, 0.0099, 0.0148, -0.0137]),
|
| 404 |
-
'boundary.r_cos(1, 3)': tensor([-0.0019, 0.0014, -0.0013, 0.0040]),
|
| 405 |
-
'boundary.r_cos(1, 4)': tensor([-0.0001, -0.0001, -0.0001, 0.0001]),
|
| 406 |
-
'boundary.r_cos(2, -1)': tensor([ 0.0222, -0.0189, -0.0043, -0.0197]),
|
| 407 |
-
'boundary.r_cos(2, -2)': tensor([ 0.0252, -0.0124, -0.0106, 0.0008]),
|
| 408 |
-
'boundary.r_cos(2, -3)': tensor([ 0.0063, -0.0054, -0.0039, 0.0047]),
|
| 409 |
-
'boundary.r_cos(2, -4)': tensor([ 0.0011, 0.0021, -0.0010, -0.0004]),
|
| 410 |
-
'boundary.r_cos(2, 0)': tensor([-0.0170, -0.0226, -0.0083, -0.0095]),
|
| 411 |
-
'boundary.r_cos(2, 1)': tensor([-1.9742e-03, 2.4878e-03, -6.7278e-05, -5.8859e-03]),
|
| 412 |
-
'boundary.r_cos(2, 2)': tensor([0.0030, 0.0017, 0.0003, 0.0010]),
|
| 413 |
-
'boundary.r_cos(2, 3)': tensor([-0.0009, 0.0002, -0.0010, 0.0009]),
|
| 414 |
-
'boundary.r_cos(2, 4)': tensor([ 0.0002, 0.0002, 0.0002, -0.0002]),
|
| 415 |
-
'boundary.r_cos(3, -1)': tensor([-0.0052, -0.0055, 0.0013, -0.0080]),
|
| 416 |
-
'boundary.r_cos(3, -2)': tensor([-0.0019, -0.0035, 0.0026, -0.0004]),
|
| 417 |
-
'boundary.r_cos(3, -3)': tensor([-0.0030, 0.0013, 0.0007, 0.0002]),
|
| 418 |
-
'boundary.r_cos(3, -4)': tensor([-0.0011, 0.0003, 0.0003, 0.0029]),
|
| 419 |
-
'boundary.r_cos(3, 0)': tensor([-0.0057, -0.0003, -0.0014, 0.0013]),
|
| 420 |
-
'boundary.r_cos(3, 1)': tensor([ 0.0021, 0.0029, 0.0010, -0.0005]),
|
| 421 |
-
'boundary.r_cos(3, 2)': tensor([-0.0001, 0.0011, -0.0008, -0.0007]),
|
| 422 |
-
'boundary.r_cos(3, 3)': tensor([1.6793e-04, 3.4548e-04, 4.4246e-04, 3.4558e-05]),
|
| 423 |
-
'boundary.r_cos(3, 4)': tensor([-4.5783e-05, 1.1368e-04, -1.1460e-04, 1.4845e-04]),
|
| 424 |
-
'boundary.r_cos(4, -1)': tensor([ 7.2199e-05, 1.2212e-04, 5.9814e-05, -5.6161e-04]),
|
| 425 |
-
'boundary.r_cos(4, -2)': tensor([ 0.0004, 0.0004, -0.0001, -0.0003]),
|
| 426 |
-
'boundary.r_cos(4, -3)': tensor([-0.0002, -0.0002, -0.0001, -0.0005]),
|
| 427 |
-
'boundary.r_cos(4, -4)': tensor([ 2.3317e-04, 7.7059e-05, 3.5259e-05, -1.2475e-04]),
|
| 428 |
-
'boundary.r_cos(4, 0)': tensor([ 1.3698e-04, -2.1361e-04, -5.7761e-04, 8.3187e-05]),
|
| 429 |
-
'boundary.r_cos(4, 1)': tensor([-7.0448e-05, -5.2118e-04, 3.7886e-04, -1.2714e-04]),
|
| 430 |
-
'boundary.r_cos(4, 2)': tensor([ 0.0003, -0.0002, -0.0002, -0.0002]),
|
| 431 |
-
'boundary.r_cos(4, 3)': tensor([-9.0838e-05, -1.6513e-04, 6.7852e-05, 4.1940e-06]),
|
| 432 |
-
'boundary.r_cos(4, 4)': tensor([-6.2693e-06, 1.4236e-06, -3.0395e-05, -4.5643e-05]),
|
| 433 |
-
'boundary.z_sin(0, 1)': tensor([-0.1963, -0.4660, 0.0626, -0.0143]),
|
| 434 |
-
'boundary.z_sin(0, 2)': tensor([ 0.0197, -0.0487, 0.0186, 0.0149]),
|
| 435 |
-
'boundary.z_sin(0, 3)': tensor([-0.0022, -0.0056, 0.0017, -0.0066]),
|
| 436 |
-
'boundary.z_sin(0, 4)': tensor([ 6.1945e-04, -2.5693e-03, 3.3028e-05, -3.0652e-04]),
|
| 437 |
-
'boundary.z_sin(1, -1)': tensor([-0.0737, -0.0783, 0.0069, -0.0228]),
|
| 438 |
-
'boundary.z_sin(1, -2)': tensor([-0.0346, 0.0154, 0.0488, 0.0576]),
|
| 439 |
-
'boundary.z_sin(1, -3)': tensor([-0.0038, -0.0004, 0.0128, -0.0016]),
|
| 440 |
-
'boundary.z_sin(1, -4)': tensor([-5.1524e-04, -2.2537e-03, 1.7765e-03, 9.6958e-05]),
|
| 441 |
-
'boundary.z_sin(1, 0)': tensor([-0.0947, -0.1091, -0.1901, -0.1610]),
|
| 442 |
-
'boundary.z_sin(1, 1)': tensor([0.0144, 0.0656, 0.0731, 0.0166]),
|
| 443 |
-
'boundary.z_sin(1, 2)': tensor([-0.0049, 0.0008, -0.0216, 0.0150]),
|
| 444 |
-
'boundary.z_sin(1, 3)': tensor([ 0.0011, -0.0014, 0.0032, -0.0012]),
|
| 445 |
-
'boundary.z_sin(1, 4)': tensor([ 0.0002, 0.0015, -0.0005, -0.0004]),
|
| 446 |
-
'boundary.z_sin(2, -1)': tensor([-0.0140, 0.0100, 0.0049, -0.0189]),
|
| 447 |
-
'boundary.z_sin(2, -2)': tensor([ 0.0140, 0.0016, -0.0162, -0.0114]),
|
| 448 |
-
'boundary.z_sin(2, -3)': tensor([ 0.0048, -0.0015, -0.0107, 0.0036]),
|
| 449 |
-
'boundary.z_sin(2, -4)': tensor([ 0.0009, 0.0024, -0.0018, -0.0010]),
|
| 450 |
-
'boundary.z_sin(2, 0)': tensor([ 0.0142, -0.0110, 0.0052, -0.0008]),
|
| 451 |
-
'boundary.z_sin(2, 1)': tensor([ 0.0004, -0.0072, -0.0033, 0.0095]),
|
| 452 |
-
'boundary.z_sin(2, 2)': tensor([-0.0008, -0.0030, 0.0036, -0.0005]),
|
| 453 |
-
'boundary.z_sin(2, 3)': tensor([-2.4587e-04, -1.4641e-03, -6.1073e-05, -5.5180e-04]),
|
| 454 |
-
'boundary.z_sin(2, 4)': tensor([-4.4745e-05, 1.1328e-04, -5.3629e-05, 3.2248e-04]),
|
| 455 |
-
'boundary.z_sin(3, -1)': tensor([ 0.0137, 0.0037, -0.0037, 0.0090]),
|
| 456 |
-
'boundary.z_sin(3, -2)': tensor([-0.0037, -0.0089, -0.0025, -0.0084]),
|
| 457 |
-
'boundary.z_sin(3, -3)': tensor([-0.0052, 0.0009, -0.0015, -0.0025]),
|
| 458 |
-
'boundary.z_sin(3, -4)': tensor([-0.0011, 0.0014, -0.0002, 0.0023]),
|
| 459 |
-
'boundary.z_sin(3, 0)': tensor([ 0.0012, -0.0005, -0.0001, -0.0020]),
|
| 460 |
-
'boundary.z_sin(3, 1)': tensor([-0.0007, 0.0040, 0.0003, -0.0016]),
|
| 461 |
-
'boundary.z_sin(3, 2)': tensor([-0.0006, -0.0003, 0.0005, 0.0008]),
|
| 462 |
-
'boundary.z_sin(3, 3)': tensor([ 0.0002, 0.0003, -0.0004, 0.0004]),
|
| 463 |
-
'boundary.z_sin(3, 4)': tensor([-5.6412e-05, 1.0018e-04, 5.2259e-05, -6.8400e-05]),
|
| 464 |
-
'boundary.z_sin(4, -1)': tensor([ 3.2419e-05, -4.5468e-04, 1.1803e-03, 5.0270e-04]),
|
| 465 |
-
'boundary.z_sin(4, -2)': tensor([ 3.0922e-04, -2.3282e-03, -6.1121e-05, 6.0890e-04]),
|
| 466 |
-
'boundary.z_sin(4, -3)': tensor([ 0.0006, 0.0007, -0.0003, -0.0002]),
|
| 467 |
-
'boundary.z_sin(4, -4)': tensor([ 1.5477e-04, 2.9187e-04, 9.7048e-05, -3.6228e-04]),
|
| 468 |
-
'boundary.z_sin(4, 0)': tensor([ 0.0002, 0.0010, -0.0004, -0.0007]),
|
| 469 |
-
'boundary.z_sin(4, 1)': tensor([-6.8060e-04, 6.0775e-04, 4.5423e-04, -7.6356e-05]),
|
| 470 |
-
'boundary.z_sin(4, 2)': tensor([ 0.0002, -0.0004, -0.0003, 0.0002]),
|
| 471 |
-
'boundary.z_sin(4, 3)': tensor([-5.1384e-05, 5.7630e-05, 9.2855e-05, -3.2524e-05]),
|
| 472 |
-
'boundary.z_sin(4, 4)': tensor([ 3.9863e-05, -1.2590e-04, -4.8167e-06, 5.3396e-05]),
|
| 473 |
'metrics.aspect_ratio': tensor([7.7955, 8.7009, 8.3073, 9.6474]),
|
| 474 |
-
'metrics.
|
| 475 |
'metrics.average_triangularity': tensor([ 0.6554, -0.6067, -0.3194, -0.5184]),
|
| 476 |
'metrics.axis_magnetic_mirror_ratio': tensor([0.2098, 0.2465, 0.5243, 0.2823]),
|
| 477 |
-
'metrics.axis_rotational_transform_over_n_field_periods': tensor([0.3285, 0.2195, 0.2377, 0.2333]),
|
| 478 |
'metrics.edge_magnetic_mirror_ratio': tensor([0.3518, 0.2744, 0.7742, 0.4869]),
|
| 479 |
-
'metrics.
|
| 480 |
'metrics.flux_compression_in_regions_of_bad_curvature': tensor([2.0642, 1.6771, 1.6702, 1.4084]),
|
| 481 |
-
'metrics.
|
| 482 |
-
|
| 483 |
-
'DLfSjAoEr26nCNet4S84XET',
|
| 484 |
-
'DBVNupAx3tW54uUz5bGQfyT'],
|
| 485 |
-
'metrics.max_elongation': tensor([7.9947, 5.7292, 5.6427, 6.7565]),
|
| 486 |
'metrics.minimum_normalized_magnetic_gradient_scale_length': tensor([5.0333, 4.4903, 2.7130, 5.9777]),
|
| 487 |
-
'
|
| 488 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 489 |
```
|
| 490 |
</details>
|
| 491 |
</div>
|
|
@@ -502,15 +507,15 @@ full_json_ds = datasets.load_dataset("proxima-fusion/constellaration", "full_jso
|
|
| 502 |
full_json_df = full_json_ds.to_pandas().set_index("plasma_config_id")
|
| 503 |
|
| 504 |
plasma_config_id = "DQ4abEQAQjFPGp9nPQN9Vjf"
|
| 505 |
-
boundary_json = full_json_df.loc[plasma_config_id]["boundary.
|
| 506 |
boundary = surface_rz_fourier.SurfaceRZFourier.model_validate_json(boundary_json)
|
| 507 |
```
|
| 508 |
Plot boundary:
|
| 509 |
```python
|
| 510 |
from constellaration.utils import visualization
|
| 511 |
|
| 512 |
-
visualization.plot_surface(boundary)
|
| 513 |
-
visualization.plot_boundary(boundary)
|
| 514 |
```
|
| 515 |
Boundary | Cross-sections
|
| 516 |
:-------------------------:|:-------------------------:
|
|
@@ -520,19 +525,21 @@ Stream and instantiate the VMEC ideal MHD equilibria:
|
|
| 520 |
```python
|
| 521 |
import datasets
|
| 522 |
from constellaration.mhd import vmec_utils
|
|
|
|
| 523 |
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
ds = ds.filter(lambda row: row["vmecpp_wout_json"] is not None)
|
| 527 |
|
| 528 |
-
row = next(
|
| 529 |
|
| 530 |
vmecpp_wout_json = row["vmecpp_wout_json"]
|
| 531 |
vmecpp_wout = vmec_utils.VmecppWOut.model_validate_json(vmecpp_wout_json)
|
| 532 |
|
| 533 |
# Fetch corresponding boundary
|
|
|
|
|
|
|
| 534 |
plasma_config_id = row["plasma_config_id"]
|
| 535 |
-
boundary_json = full_json_df.loc[plasma_config_id]["boundary.
|
| 536 |
boundary = surface_rz_fourier.SurfaceRZFourier.model_validate_json(boundary_json)
|
| 537 |
```
|
| 538 |
Plot flux surfaces:
|
|
|
|
| 368 |
import torch
|
| 369 |
from torch.utils.data import DataLoader
|
| 370 |
|
| 371 |
+
full_flat_ds = datasets.load_dataset("proxima-fusion/constellaration", "full_flat")["train"]
|
| 372 |
+
full_flat_ds = full_flat_ds.select_columns([c for c in full_flat_ds.column_names
|
| 373 |
if c.startswith("boundary.")
|
| 374 |
or c.startswith("metrics.")])
|
| 375 |
|
| 376 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 377 |
+
ds_torch = full_flat_ds.with_format("torch", device=device) # other options: "jax", "tensorflow" etc.
|
| 378 |
|
| 379 |
+
for batch in DataLoader(ds_torch, batch_size=4):
|
|
|
|
|
|
|
| 380 |
print(batch)
|
| 381 |
break
|
| 382 |
```
|
|
|
|
| 385 |
<summary>Output</summary>
|
| 386 |
|
| 387 |
```python
|
| 388 |
+
{'metrics.id': ['DfpsEPzxXHTUgveVPNFVxyw',
|
| 389 |
+
'D6ydRp85utx9ZXqZVXbez8G',
|
| 390 |
+
'DLfSjAoEr26nCNet4S84XET',
|
| 391 |
+
'DBVNupAx3tW54uUz5bGQfyT'],
|
| 392 |
+
'metrics.qi': tensor([0.0101, 0.0007, 0.0249, 0.0148]),
|
| 393 |
+
'metrics.vacuum_well': tensor([-0.0216, -0.0756, -0.1321, -0.2297]),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 394 |
'metrics.aspect_ratio': tensor([7.7955, 8.7009, 8.3073, 9.6474]),
|
| 395 |
+
'metrics.max_elongation': tensor([7.9947, 5.7292, 5.6427, 6.7565]),
|
| 396 |
'metrics.average_triangularity': tensor([ 0.6554, -0.6067, -0.3194, -0.5184]),
|
| 397 |
'metrics.axis_magnetic_mirror_ratio': tensor([0.2098, 0.2465, 0.5243, 0.2823]),
|
|
|
|
| 398 |
'metrics.edge_magnetic_mirror_ratio': tensor([0.3518, 0.2744, 0.7742, 0.4869]),
|
| 399 |
+
'metrics.aspect_ratio_over_edge_rotational_transform': tensor([ 4.7622, 39.3853, 7.4686, 9.3211]),
|
| 400 |
'metrics.flux_compression_in_regions_of_bad_curvature': tensor([2.0642, 1.6771, 1.6702, 1.4084]),
|
| 401 |
+
'metrics.axis_rotational_transform_over_n_field_periods': tensor([0.3285, 0.2195, 0.2377, 0.2333]),
|
| 402 |
+
'metrics.edge_rotational_transform_over_n_field_periods': tensor([0.3274, 0.1105, 0.2225, 0.3450]),
|
|
|
|
|
|
|
|
|
|
| 403 |
'metrics.minimum_normalized_magnetic_gradient_scale_length': tensor([5.0333, 4.4903, 2.7130, 5.9777]),
|
| 404 |
+
'boundary.r_cos': tensor([[[ 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 9.9949e-01,
|
| 405 |
+
7.6796e-04, -1.6605e-02, 5.5780e-04, 2.7140e-06],
|
| 406 |
+
[ 9.0751e-04, -3.6262e-03, -2.5385e-02, -7.7356e-02, 2.1363e-01,
|
| 407 |
+
-4.3046e-02, 7.0488e-03, -1.9437e-03, -1.4148e-04],
|
| 408 |
+
[ 1.1192e-03, 6.2549e-03, 2.5220e-02, 2.2216e-02, -1.7012e-02,
|
| 409 |
+
-1.9742e-03, 3.0245e-03, -8.5555e-04, 1.9455e-04],
|
| 410 |
+
[-1.0992e-03, -3.0390e-03, -1.9017e-03, -5.2155e-03, -5.7048e-03,
|
| 411 |
+
2.0575e-03, -1.1494e-04, 1.6793e-04, -4.5783e-05],
|
| 412 |
+
[ 2.3317e-04, -2.0280e-04, 4.0296e-04, 7.2199e-05, 1.3698e-04,
|
| 413 |
+
-7.0448e-05, 2.9516e-04, -9.0838e-05, -6.2693e-06]],
|
| 414 |
+
|
| 415 |
+
[[ 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 9.9334e-01,
|
| 416 |
+
9.5655e-02, -5.2197e-02, -9.8426e-03, -5.2107e-04],
|
| 417 |
+
[-6.9068e-04, -2.0027e-04, 1.4961e-03, -4.8040e-02, 1.5062e-01,
|
| 418 |
+
-8.6001e-04, 9.8727e-03, 1.3859e-03, -1.4257e-04],
|
| 419 |
+
[ 2.1268e-03, -5.4152e-03, -1.2367e-02, -1.8891e-02, -2.2634e-02,
|
| 420 |
+
2.4878e-03, 1.7472e-03, 1.7854e-04, 1.5837e-04],
|
| 421 |
+
[ 2.9863e-04, 1.3137e-03, -3.4623e-03, -5.5232e-03, -2.7664e-04,
|
| 422 |
+
2.9050e-03, 1.1163e-03, 3.4548e-04, 1.1368e-04],
|
| 423 |
+
[ 7.7059e-05, -2.3845e-04, 4.4021e-04, 1.2212e-04, -2.1361e-04,
|
| 424 |
+
-5.2118e-04, -1.5413e-04, -1.6513e-04, 1.4236e-06]],
|
| 425 |
+
|
| 426 |
+
[[ 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 1.0000e+00,
|
| 427 |
+
9.7826e-02, -3.5796e-02, 4.3583e-04, 4.1021e-04],
|
| 428 |
+
[ 1.8546e-03, 4.6983e-03, 3.2687e-02, 6.7351e-02, 6.6784e-02,
|
| 429 |
+
-4.2107e-02, 1.4765e-02, -1.3257e-03, -1.3003e-04],
|
| 430 |
+
[-9.6934e-04, -3.8986e-03, -1.0552e-02, -4.2583e-03, -8.3177e-03,
|
| 431 |
+
-6.7278e-05, 3.3263e-04, -1.0408e-03, 2.2868e-04],
|
| 432 |
+
[ 2.6668e-04, 6.7729e-04, 2.6165e-03, 1.2503e-03, -1.4094e-03,
|
| 433 |
+
9.9661e-04, -8.1563e-04, 4.4246e-04, -1.1460e-04],
|
| 434 |
+
[ 3.5259e-05, -1.1595e-04, -1.3741e-04, 5.9814e-05, -5.7761e-04,
|
| 435 |
+
3.7886e-04, -1.9925e-04, 6.7852e-05, -3.0395e-05]],
|
| 436 |
+
|
| 437 |
+
[[ 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 1.0000e+00,
|
| 438 |
+
-6.5763e-02, -3.8500e-02, 2.2178e-03, 4.6007e-04],
|
| 439 |
+
[-6.6648e-04, -1.0976e-02, 5.6475e-02, 1.4193e-02, 8.3476e-02,
|
| 440 |
+
-4.6767e-02, -1.3679e-02, 3.9562e-03, 1.0087e-04],
|
| 441 |
+
[-3.5474e-04, 4.7144e-03, 8.3967e-04, -1.9705e-02, -9.4592e-03,
|
| 442 |
+
-5.8859e-03, 1.0172e-03, 9.2020e-04, -2.0059e-04],
|
| 443 |
+
[ 2.9056e-03, 1.6125e-04, -4.0626e-04, -8.0189e-03, 1.3228e-03,
|
| 444 |
+
-5.3636e-04, -7.3536e-04, 3.4558e-05, 1.4845e-04],
|
| 445 |
+
[-1.2475e-04, -4.9942e-04, -2.6091e-04, -5.6161e-04, 8.3187e-05,
|
| 446 |
+
-1.2714e-04, -2.1174e-04, 4.1940e-06, -4.5643e-05]]]),
|
| 447 |
+
'boundary.z_sin': tensor([[[ 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
|
| 448 |
+
-1.9626e-01, 1.9675e-02, -2.2323e-03, 6.1945e-04],
|
| 449 |
+
[-5.1524e-04, -3.8208e-03, -3.4611e-02, -7.3697e-02, -9.4725e-02,
|
| 450 |
+
1.4401e-02, -4.8538e-03, 1.1153e-03, 1.8119e-04],
|
| 451 |
+
[ 8.8862e-04, 4.7645e-03, 1.4034e-02, -1.3992e-02, 1.4160e-02,
|
| 452 |
+
3.7312e-04, -7.9215e-04, -2.4587e-04, -4.4745e-05],
|
| 453 |
+
[-1.1121e-03, -5.1679e-03, -3.6563e-03, 1.3666e-02, 1.2211e-03,
|
| 454 |
+
-7.2069e-04, -6.1250e-04, 2.2509e-04, -5.6412e-05],
|
| 455 |
+
[ 1.5477e-04, 6.2145e-04, 3.0922e-04, 3.2419e-05, 2.4620e-04,
|
| 456 |
+
-6.8060e-04, 1.9615e-04, -5.1384e-05, 3.9863e-05]],
|
| 457 |
+
|
| 458 |
+
[[ 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
|
| 459 |
+
-4.6604e-01, -4.8706e-02, -5.5774e-03, -2.5693e-03],
|
| 460 |
+
[-2.2537e-03, -3.5303e-04, 1.5423e-02, -7.8331e-02, -1.0906e-01,
|
| 461 |
+
6.5595e-02, 8.1187e-04, -1.4336e-03, 1.4737e-03],
|
| 462 |
+
[ 2.4240e-03, -1.4512e-03, 1.5746e-03, 1.0027e-02, -1.0979e-02,
|
| 463 |
+
-7.1742e-03, -3.0459e-03, -1.4641e-03, 1.1328e-04],
|
| 464 |
+
[ 1.3788e-03, 9.4350e-04, -8.9247e-03, 3.6596e-03, -5.4934e-04,
|
| 465 |
+
4.0136e-03, -2.9544e-04, 3.2837e-04, 1.0018e-04],
|
| 466 |
+
[ 2.9187e-04, 7.0291e-04, -2.3282e-03, -4.5468e-04, 1.0021e-03,
|
| 467 |
+
6.0775e-04, -3.5128e-04, 5.7630e-05, -1.2590e-04]],
|
| 468 |
+
|
| 469 |
+
[[ 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
|
| 470 |
+
6.2592e-02, 1.8552e-02, 1.7140e-03, 3.3028e-05],
|
| 471 |
+
[ 1.7765e-03, 1.2827e-02, 4.8849e-02, 6.8718e-03, -1.9011e-01,
|
| 472 |
+
7.3130e-02, -2.1610e-02, 3.1883e-03, -5.4797e-04],
|
| 473 |
+
[-1.7520e-03, -1.0653e-02, -1.6171e-02, 4.8786e-03, 5.1656e-03,
|
| 474 |
+
-3.2699e-03, 3.5506e-03, -6.1073e-05, -5.3629e-05],
|
| 475 |
+
[-2.1859e-04, -1.4518e-03, -2.4928e-03, -3.6855e-03, -1.1030e-04,
|
| 476 |
+
2.5252e-04, 4.9944e-04, -3.5102e-04, 5.2259e-05],
|
| 477 |
+
[ 9.7048e-05, -3.4866e-04, -6.1121e-05, 1.1803e-03, -4.2218e-04,
|
| 478 |
+
4.5423e-04, -2.6355e-04, 9.2855e-05, -4.8167e-06]],
|
| 479 |
+
|
| 480 |
+
[[ 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00, 0.0000e+00,
|
| 481 |
+
-1.4295e-02, 1.4929e-02, -6.6461e-03, -3.0652e-04],
|
| 482 |
+
[ 9.6958e-05, -1.6067e-03, 5.7568e-02, -2.2848e-02, -1.6101e-01,
|
| 483 |
+
1.6560e-02, 1.5032e-02, -1.2463e-03, -4.0128e-04],
|
| 484 |
+
[-9.9541e-04, 3.6108e-03, -1.1401e-02, -1.8894e-02, -7.7459e-04,
|
| 485 |
+
9.4527e-03, -4.6871e-04, -5.5180e-04, 3.2248e-04],
|
| 486 |
+
[ 2.3465e-03, -2.4885e-03, -8.4212e-03, 8.9649e-03, -1.9880e-03,
|
| 487 |
+
-1.6269e-03, 8.4700e-04, 3.7171e-04, -6.8400e-05],
|
| 488 |
+
[-3.6228e-04, -1.8575e-04, 6.0890e-04, 5.0270e-04, -6.9953e-04,
|
| 489 |
+
-7.6356e-05, 2.3796e-04, -3.2524e-05, 5.3396e-05]]]),
|
| 490 |
+
'boundary.r_sin': tensor([nan, nan, nan, nan]),
|
| 491 |
+
'boundary.z_cos': tensor([nan, nan, nan, nan]),
|
| 492 |
+
'boundary.n_field_periods': tensor([5., 2., 5., 3.]),
|
| 493 |
+
'boundary.is_stellarator_symmetric': tensor([True, True, True, True])}
|
| 494 |
```
|
| 495 |
</details>
|
| 496 |
</div>
|
|
|
|
| 507 |
full_json_df = full_json_ds.to_pandas().set_index("plasma_config_id")
|
| 508 |
|
| 509 |
plasma_config_id = "DQ4abEQAQjFPGp9nPQN9Vjf"
|
| 510 |
+
boundary_json = full_json_df.loc[plasma_config_id]["boundary.json"]
|
| 511 |
boundary = surface_rz_fourier.SurfaceRZFourier.model_validate_json(boundary_json)
|
| 512 |
```
|
| 513 |
Plot boundary:
|
| 514 |
```python
|
| 515 |
from constellaration.utils import visualization
|
| 516 |
|
| 517 |
+
visualization.plot_surface(boundary).show()
|
| 518 |
+
visualization.plot_boundary(boundary).get_figure().show()
|
| 519 |
```
|
| 520 |
Boundary | Cross-sections
|
| 521 |
:-------------------------:|:-------------------------:
|
|
|
|
| 525 |
```python
|
| 526 |
import datasets
|
| 527 |
from constellaration.mhd import vmec_utils
|
| 528 |
+
from constellaration.geometry import surface_rz_fourier
|
| 529 |
|
| 530 |
+
vmec_wout_ds = datasets.load_dataset("proxima-fusion/constellaration", "vmecpp_ideal_mhd_equilibria", streaming=True)["train"]
|
| 531 |
+
vmec_wout_ds = vmec_wout_ds.filter(lambda row: row["vmecpp_wout_json"] is not None)
|
|
|
|
| 532 |
|
| 533 |
+
row = next(vmec_wout_ds.__iter__())
|
| 534 |
|
| 535 |
vmecpp_wout_json = row["vmecpp_wout_json"]
|
| 536 |
vmecpp_wout = vmec_utils.VmecppWOut.model_validate_json(vmecpp_wout_json)
|
| 537 |
|
| 538 |
# Fetch corresponding boundary
|
| 539 |
+
full_json_ds = datasets.load_dataset("proxima-fusion/constellaration", "full_json")["train"]
|
| 540 |
+
full_json_df = full_json_ds.to_pandas().set_index("plasma_config_id")
|
| 541 |
plasma_config_id = row["plasma_config_id"]
|
| 542 |
+
boundary_json = full_json_df.loc[plasma_config_id]["boundary.json"]
|
| 543 |
boundary = surface_rz_fourier.SurfaceRZFourier.model_validate_json(boundary_json)
|
| 544 |
```
|
| 545 |
Plot flux surfaces:
|