Skip to content

Commit

Permalink
Formatting changes from black-23
Browse files Browse the repository at this point in the history
New major version of black introduced some minor changes to code
formatting.
  • Loading branch information
johnomotani committed Feb 13, 2023
1 parent da502ac commit df9eb14
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 30 deletions.
1 change: 0 additions & 1 deletion hypnotoad/cases/torpex.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ class TORPEXMagneticField(Equilibrium):
)

def __init__(self, equilibOptions, meshOptions):

# Set up options read from user input
self.user_options = self.user_options_factory.create(meshOptions)

Expand Down
8 changes: 0 additions & 8 deletions hypnotoad/core/equilibrium.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,6 @@ def __init__(self, parentContour, settings, *, psi):
self.equaliseSpacing(psi=psi)

def extend(self, *, psi, extend_lower=0, extend_upper=0):

Nfine = self.user_options.finecontour_Nfine

parentCopy = self.parentContour.newContourFromSelf()
Expand Down Expand Up @@ -732,7 +731,6 @@ def equaliseSpacing(self, *, psi, reallocate=False):
# endInd unchanged - makes iteration more stable.
count = 1
while ds_error > self.user_options.finecontour_atol:

if (
self.user_options.finecontour_maxits
and count > self.user_options.finecontour_maxits
Expand Down Expand Up @@ -1862,7 +1860,6 @@ def checkFineContourExtend(self, *, psi):
(fine_contour.positions[1, :] - fine_contour.positions[0, :]) ** 2
)
):

ds = fine_contour.distance[1] - fine_contour.distance[0]
n_extend_lower = max(int(numpy.ceil(distances[0] / ds)), 1)
else:
Expand All @@ -1882,7 +1879,6 @@ def checkFineContourExtend(self, *, psi):
(fine_contour.positions[-1, :] - fine_contour.positions[-2, :]) ** 2
)
):

ds = fine_contour.distance[-1] - fine_contour.distance[-2]
n_extend_upper = max(int(numpy.ceil(distances[-1] / ds)), 1)
else:
Expand Down Expand Up @@ -2995,7 +2991,6 @@ def combineSfuncs(
spacings["nonorthogonal_range_lower"] is not None
and spacings["nonorthogonal_range_upper"] is not None
):

if sfunc_orthogonal is None:
# Define new_sfunc in a sensible way to create the initial distribution
# of points on the separatrix that is then used to create the orthogonal
Expand Down Expand Up @@ -3082,7 +3077,6 @@ def new_sfunc(i):
)

elif spacings["nonorthogonal_range_lower"] is not None:

if sfunc_orthogonal is None:
# Fix spacing so that if we call combineSfuncs again for this contour
# with sfunc_orthogonal from self.contourSfunc() then we get the same
Expand Down Expand Up @@ -3114,7 +3108,6 @@ def new_sfunc(i):
return (weight_lower) * sfixed_lower + (1.0 - weight_lower) * sorth

elif spacings["nonorthogonal_range_upper"] is not None:

if sfunc_orthogonal is None:
# Fix spacing so that if we call combineSfuncs again for this contour
# with sfunc_orthogonal from self.contourSfunc() then we get the same
Expand Down Expand Up @@ -4410,7 +4403,6 @@ def wallIntersection(self, p1, p2):
and numpy.abs(intersect.Z - second_intersect.Z)
< intersect_tolerance
):

print("Multiple intersections with the wall")

import matplotlib.pyplot as plt
Expand Down
2 changes: 0 additions & 2 deletions hypnotoad/core/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ def __init__(
settings,
parallel_map,
):

self.user_options = self.user_options_factory.create(settings)

self.name = equilibriumRegion.name + "(" + str(radialIndex) + ")"
Expand Down Expand Up @@ -3240,7 +3239,6 @@ class BoutMesh(Mesh):
)

def __init__(self, equilibrium, settings):

super().__init__(equilibrium, settings)

# nx, ny both include boundary guard cells
Expand Down
1 change: 0 additions & 1 deletion hypnotoad/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,6 @@ def __init__(self, parent):
self.saveFullYamlCheckBox.setChecked(self.parent.gui_options["save_full_yaml"])

def accept(self):

self.parent.gui_options["grid_file"] = self.defaultGridFileNameLineEdit.text()
self.parent.gui_options["plot_xlow"] = self.plotXlowCheckBox.isChecked()
self.parent.gui_options["plot_ylow"] = self.plotYlowCheckBox.isChecked()
Expand Down
1 change: 0 additions & 1 deletion hypnotoad/gui/matplotlib_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

class MatplotlibWidget:
def __init__(self, parent):

self.figure = Figure()
self.canvas = FigureCanvas(self.figure)
self.canvas.setParent(parent)
Expand Down
11 changes: 0 additions & 11 deletions hypnotoad/test_suite/test_tokamak.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def fpolprime_func(psi):

@pytest.mark.parametrize("psi_interpolation_method", ["spline", "dct"])
def test_read_geqdsk(psi_interpolation_method):

settings = {"psi_interpolation_method": psi_interpolation_method}

# Number of mesh points
Expand Down Expand Up @@ -210,7 +209,6 @@ def test_bounding():

@pytest.mark.parametrize("psi_interpolation_method", ["spline", "dct"])
def test_xpoint(psi_interpolation_method):

settings = {"psi_interpolation_method": psi_interpolation_method}

nx = 65
Expand Down Expand Up @@ -521,7 +519,6 @@ def psi_func(R, Z):

@pytest.mark.parametrize("psi_interpolation_method", ["spline", "dct"])
def test_findlegs(psi_interpolation_method):

settings = {"psi_interpolation_method": psi_interpolation_method}

eq = make_lower_single_null(settings)
Expand All @@ -540,7 +537,6 @@ def test_findlegs(psi_interpolation_method):

@pytest.mark.parametrize("psi_interpolation_method", ["spline", "dct"])
def test_findlegs_upper(psi_interpolation_method):

settings = {"psi_interpolation_method": psi_interpolation_method}

eq = make_upper_single_null(settings)
Expand All @@ -559,7 +555,6 @@ def test_findlegs_upper(psi_interpolation_method):

@pytest.mark.parametrize("psi_interpolation_method", ["spline", "dct"])
def test_makeregions_lsn(psi_interpolation_method):

settings = {"psi_interpolation_method": psi_interpolation_method}

eq = make_lower_single_null(settings)
Expand All @@ -570,7 +565,6 @@ def test_makeregions_lsn(psi_interpolation_method):

@pytest.mark.parametrize("psi_interpolation_method", ["spline", "dct"])
def test_makeregions_usn(psi_interpolation_method):

settings = {"psi_interpolation_method": psi_interpolation_method}

eq = make_upper_single_null(settings)
Expand All @@ -581,7 +575,6 @@ def test_makeregions_usn(psi_interpolation_method):

@pytest.mark.parametrize("psi_interpolation_method", ["spline", "dct"])
def test_makeregions_cdn(psi_interpolation_method):

settings = {"psi_interpolation_method": psi_interpolation_method}

eq = make_connected_double_null(settings)
Expand All @@ -592,7 +585,6 @@ def test_makeregions_cdn(psi_interpolation_method):

@pytest.mark.parametrize("psi_interpolation_method", ["spline", "dct"])
def test_makeregions_udn(psi_interpolation_method):

settings = {"psi_interpolation_method": psi_interpolation_method}

eq = make_upper_double_null(settings)
Expand All @@ -603,7 +595,6 @@ def test_makeregions_udn(psi_interpolation_method):

@pytest.mark.parametrize("psi_interpolation_method", ["spline", "dct"])
def test_makeregions_ldn(psi_interpolation_method):

settings = {"psi_interpolation_method": psi_interpolation_method}

eq = make_lower_double_null(settings)
Expand All @@ -614,7 +605,6 @@ def test_makeregions_ldn(psi_interpolation_method):

@pytest.mark.parametrize("psi_interpolation_method", ["spline", "dct"])
def test_makeregions_udn_largesep_1(psi_interpolation_method):

settings = {"psi_interpolation_method": psi_interpolation_method}

eq = make_upper_double_null_largesep(settings)
Expand All @@ -624,7 +614,6 @@ def test_makeregions_udn_largesep_1(psi_interpolation_method):

@pytest.mark.parametrize("psi_interpolation_method", ["spline", "dct"])
def test_makeregions_udn_largesep_2(psi_interpolation_method):

settings = {
"psinorm_sol": 1.2,
"psi_interpolation_method": psi_interpolation_method,
Expand Down
2 changes: 0 additions & 2 deletions hypnotoad/utils/critical.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ def find_critical(R, Z, psi, atol, maxits, discard_xpoints=False):
and (Bp2[i, j] < Bp2[i, j + 1])
and (Bp2[i, j] < Bp2[i, j - 1])
):

# Found local minimum

R0 = R[i, j]
Expand All @@ -112,7 +111,6 @@ def find_critical(R, Z, psi, atol, maxits, discard_xpoints=False):

count = 0
while True:

Br = -f(R1, Z1, dy=1, grid=False) / R1
Bz = f(R1, Z1, dx=1, grid=False) / R1

Expand Down
2 changes: 1 addition & 1 deletion hypnotoad/utils/parallel_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def __call__(self, function, args_list, **kwargs):
psi=self.psi,
f_R=self.f_R,
f_Z=self.f_Z,
**kwargs
**kwargs,
)
for args in args_list
]
Expand Down
1 change: 0 additions & 1 deletion hypnotoad/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@


def with_default(value, default):

if value is not None:
return value

Expand Down
2 changes: 0 additions & 2 deletions utils/compare_grid_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@


def check_missing_variables(ds1, ds2, *, ignore_ylow=False):

variables = list(set(v for v in ds1).union(v for v in ds2))

variables.sort()
Expand Down Expand Up @@ -132,7 +131,6 @@ def trim_yboundaries(ds):


def plot_arrays(ds1, ds2, variables, *, atol, poloidal_plot, show_all):

# Need to drop 'dimension coordinates' as xarray arithmetic operations by default
# work on the intersection of two DataArrays, as determined by the dimension
# coordinates, but the coordinates are not necessarily the same between the two grid
Expand Down

0 comments on commit df9eb14

Please sign in to comment.