Skip to content

Commit 961aa42

Browse files
bendudsongithub-actions[bot]
authored andcommitted
Apply black formatting
1 parent 66c3e2d commit 961aa42

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

xbout/cherab/triangulate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def wall_flux(
114114
115115
Based on the Cherab manual here:
116116
https://www.cherab.info/demonstrations/radiation_loads/symmetric_power_load.html#symmetric-power-load
117-
117+
118118
Parameters
119119
----------
120120
@@ -208,7 +208,7 @@ def wall_flux(
208208
# For checking energy conservation.
209209
# Revolve this tile around the CYLINDRICAL z-axis to get total power collected by these tiles.
210210
# Add up all the tile contributions to get total power collected.
211-
detector_radius = np.sqrt(detector_center.x ** 2 + detector_center.y ** 2)
211+
detector_radius = np.sqrt(detector_center.x**2 + detector_center.y**2)
212212
observed_total_power = power_density * (
213213
y_width * 2 * np.pi * detector_radius
214214
)

xbout/wall.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import numpy as np
66

7+
78
class AxisymmetricWall:
89
def __init__(self, Rs, Zs):
910
"""
@@ -34,8 +35,9 @@ def __iter__(self):
3435
3536
These pairs define wall segment.
3637
"""
37-
return iter(zip(zip(self.Rs, self.Zs),
38-
zip(np.roll(self.Rs, -1), np.roll(self.Zs, -1))))
38+
return iter(
39+
zip(zip(self.Rs, self.Zs), zip(np.roll(self.Rs, -1), np.roll(self.Zs, -1)))
40+
)
3941

4042
def to_polygon(self):
4143
"""
@@ -45,7 +47,7 @@ def to_polygon(self):
4547
"""
4648
return np.stack((self.Rs, self.Zs), axis=-1)
4749

48-
def plot(self, linestyle='k-', ax = None):
50+
def plot(self, linestyle="k-", ax=None):
4951
"""
5052
Plot the wall on given axis. If no axis
5153
is given then a new figure is created.
@@ -64,6 +66,7 @@ def plot(self, linestyle='k-', ax = None):
6466
ax.plot(self.Rs, self.Zs, linestyle)
6567
return ax
6668

69+
6770
def read_geqdsk(filehandle):
6871
"""
6972
Read wall geometry from a GEQDSK file.
@@ -86,31 +89,31 @@ def read_geqdsk(filehandle):
8689
return AxisymmetricWall(data["rlim"], data["zlim"])
8790

8891

89-
def read_csv(filehandle, delimiter=','):
92+
def read_csv(filehandle, delimiter=","):
9093
"""
9194
Parameters
9295
----------
9396
9497
filehandle: File handle
9598
Must contain two columns, for R and Z coordinates [meters]
96-
99+
97100
delimier : character
98101
A single character that separates fields
99102
100103
Notes:
101-
- Uses the python `csv` module
104+
- Uses the python `csv` module
102105
"""
103106
import csv
107+
104108
reader = csv.reader(filehandle, delimiter=delimiter)
105109
Rs = []
106110
Zs = []
107111
for row in reader:
108112
if len(row) == 0:
109-
continue # Skip empty rows
113+
continue # Skip empty rows
110114
if len(row) != 2:
111115
raise ValueError(f"CSV row should contain two columns: {row}")
112116
Rs.append(float(row[0]))
113117
Zs.append(float(row[1]))
114118

115119
return AxisymmetricWall(Rs, Zs)
116-

0 commit comments

Comments
 (0)