Skip to content

Commit

Permalink
Fix typos and spelling errors
Browse files Browse the repository at this point in the history
  • Loading branch information
f0uriest committed Aug 31, 2023
1 parent c0b4441 commit 27bd131
Show file tree
Hide file tree
Showing 43 changed files with 157 additions and 173 deletions.
6 changes: 3 additions & 3 deletions desc/_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# git-archive tarball (such as those provided by github's download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains the computed version number.
Expand Down Expand Up @@ -292,7 +292,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
# TAG-NUM-gHEX
mo = re.search(r"^(.+)-(\d+)-g([0-9a-f]+)$", git_describe)
if not mo:
# unparseable. Maybe git-describe is misbehaving?
# unparsable. Maybe git-describe is misbehaving?
pieces["error"] = "unable to parse git-describe output: '%s'" % describe_out
return pieces

Expand Down Expand Up @@ -409,7 +409,7 @@ def render_pep440_old(pieces):
The ".dev0" means dirty.
Eexceptions:
Exceptions:
1: no tags. 0.postDISTANCE[.dev0]
"""
if pieces["closest-tag"]:
Expand Down
2 changes: 1 addition & 1 deletion desc/basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ def zernike_radial_coeffs(l, m, exact=True):
Returns
-------
coeffs : ndarray
Polynomial coefficients for Zernike polynomials, in descending powers of r.
Notes
-----
Expand Down
2 changes: 1 addition & 1 deletion desc/compute/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def _R_rrt(params, transforms, profiles, data, **kwargs):
label="\\partial_{\\rho \\rho \\theta \\theta} R",
units="m",
units_long="meters",
description="Major radius in lab frame, fouth derivative, wrt radius twice "
description="Major radius in lab frame, fourth derivative, wrt radius twice "
"and poloidal angle twice",
dim=1,
params=["R_lmn"],
Expand Down
2 changes: 1 addition & 1 deletion desc/compute/data_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _decorator(func):
return _decorator


# This allows us to handle subclasses whos data_index stuff should inherit
# This allows us to handle subclasses whose data_index stuff should inherit
# from parent classes.
# This is the least bad solution I've found, since everything else requires
# crazy circular imports
Expand Down
60 changes: 31 additions & 29 deletions desc/compute/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,6 @@

from .data_index import data_index

# defines the order in which objective arguments get concatenated into the state vector
arg_order = (
"R_lmn",
"Z_lmn",
"L_lmn",
"p_l",
"i_l",
"c_l",
"Psi",
"Te_l",
"ne_l",
"Ti_l",
"Zeff_l",
"Ra_n",
"Za_n",
"Rb_lmn",
"Zb_lmn",
)
# map from profile name to equilibrium parameter name
profile_names = {
"pressure": "p_l",
"iota": "i_l",
"current": "c_l",
"electron_temperature": "Te_l",
"electron_density": "ne_l",
"ion_temperature": "Ti_l",
"atomic_number": "Zeff_l",
}


def _parse_parameterization(p):
if isinstance(p, str):
Expand Down Expand Up @@ -1309,3 +1280,34 @@ def body(i, mins):
# The above implementation was benchmarked to be more efficient than
# alternatives without explicit loops in GitHub pull request #501.
return grid.expand(mins, surface_label)


# defines the order in which objective arguments get concatenated into the state vector
arg_order = (
"R_lmn",
"Z_lmn",
"L_lmn",
"p_l",
"i_l",
"c_l",
"Psi",
"Te_l",
"ne_l",
"Ti_l",
"Zeff_l",
"Ra_n",
"Za_n",
"Rb_lmn",
"Zb_lmn",
)

# map from profile name to equilibrium parameter name
profile_names = {
"pressure": "p_l",
"iota": "i_l",
"current": "c_l",
"electron_temperature": "Te_l",
"electron_density": "ne_l",
"ion_temperature": "Ti_l",
"atomic_number": "Zeff_l",
}
12 changes: 6 additions & 6 deletions desc/continuation.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def _solve_axisym(
if mres_step == MIN_MRES_STEP:
raise RuntimeError(
"Automatic continuation failed with mres_step=1, "
+ "something is probaby very wrong with your desired equilibrium."
+ "something is probably very wrong with your desired equilibrium."
)
else:
warnings.warn(
Expand Down Expand Up @@ -297,7 +297,7 @@ def _add_pressure(
if pres_step <= MIN_PRES_STEP:
raise RuntimeError(
"Automatic continuation failed with "
+ f"pres_step={pres_step}, something is probaby very wrong with your "
+ f"pres_step={pres_step}, something is probably very wrong with your "
+ "desired equilibrium."
)
else:
Expand Down Expand Up @@ -430,7 +430,7 @@ def _add_shaping(
if bdry_step <= MIN_BDRY_STEP:
raise RuntimeError(
"Automatic continuation failed with "
+ f"bdry_step={bdry_step}, something is probaby very wrong with your "
+ f"bdry_step={bdry_step}, something is probably very wrong with your "
+ "desired equilibrium."
)
else:
Expand Down Expand Up @@ -485,7 +485,7 @@ def solve_continuation_automatic( # noqa: C901
Unsolved Equilibrium with the final desired boundary, profiles, resolution.
objective : {"force", "energy", "vacuum"}
function to solve for equilibrium solution
optimizer : str or Optimzer (optional)
optimizer : str or Optimizer (optional)
optimizer to use
pert_order : int
order of perturbations to use.
Expand Down Expand Up @@ -609,7 +609,7 @@ def solve_continuation( # noqa: C901
):
"""Solve for an equilibrium by continuation method.
Steps through an EquilibriaFamily, solving each equilibrium, and uses pertubations
Steps through an EquilibriaFamily, solving each equilibrium, and uses perturbations
to step between different profiles/boundaries.
Uses the previous step as an initial guess for each solution.
Expand All @@ -620,7 +620,7 @@ def solve_continuation( # noqa: C901
Equilibria to solve for at each step.
objective : {"force", "energy", "vacuum"}
function to solve for equilibrium solution
optimizer : str or Optimzer (optional)
optimizer : str or Optimizer (optional)
optimizer to use
pert_order : int or array of int
order of perturbations to use. If array-like, should be same length as eqfam
Expand Down
6 changes: 1 addition & 5 deletions desc/derivatives.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ def _compute_grad_or_jac(self, *args, **kwargs):
kwargs : dict
keyword arguments passed to fun
Returns
-------
J : ndarray of float, shape(len(f),len(x))
Expand Down Expand Up @@ -702,7 +701,4 @@ def compute(self, *args, **kwargs):
return self._compute(*args, **kwargs)


if use_jax:
Derivative = AutoDiffDerivative
else:
Derivative = FiniteDiffDerivative
Derivative = AutoDiffDerivative if use_jax else FiniteDiffDerivative
9 changes: 3 additions & 6 deletions desc/equilibrium/equilibrium.py
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,6 @@ def solve(
``message`` which describes the cause of the termination. See
`OptimizeResult` for a description of other attributes.
"""
if constraints is None:
constraints = get_fixed_boundary_constraints(
Expand Down Expand Up @@ -2092,7 +2091,7 @@ def solve_continuation(
"""Solve for an equilibrium by continuation method.
Steps through an EquilibriaFamily, solving each equilibrium, and uses
pertubations to step between different profiles/boundaries.
perturbations to step between different profiles/boundaries.
Uses the previous step as an initial guess for each solution.
Expand All @@ -2102,7 +2101,7 @@ def solve_continuation(
Equilibria to solve for at each step.
objective : str or ObjectiveFunction (optional)
function to solve for equilibrium solution
optimizer : str or Optimzer (optional)
optimizer : str or Optimizer (optional)
optimizer to use
pert_order : int or array of int
order of perturbations to use. If array-like, should be same length as
Expand Down Expand Up @@ -2170,7 +2169,7 @@ def solve_continuation_automatic(
Unsolved Equilibrium with the final desired boundary, profiles, resolution.
objective : str or ObjectiveFunction (optional)
function to solve for equilibrium solution
optimizer : str or Optimzer (optional)
optimizer : str or Optimizer (optional)
optimizer to use
pert_order : int
order of perturbations to use.
Expand Down Expand Up @@ -2236,8 +2235,6 @@ def equilibria(self, equil):
)
self._equilibria = list(equil)

# dunder methods required by MutableSequence

def __getitem__(self, i):
return self._equilibria[i]

Expand Down
2 changes: 1 addition & 1 deletion desc/geometry/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def compute(
Computed quantity and intermediate variables.
"""
# set a default numpts for the SplineXYZCurve
# set a default number of points for the SplineXYZCurve
N = self.N if hasattr(self, "N") else self.X.size
if isinstance(names, str):
names = [names]
Expand Down
3 changes: 2 additions & 1 deletion desc/geometry/curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,17 +751,18 @@ def from_values(cls, coords, knots=None, method="cubic", name="", basis="xyz"):
If supplied, will be rescaled to lie in [0,2pi]
method : str
method of interpolation
- `'nearest'`: nearest neighbor interpolation
- `'linear'`: linear interpolation
- `'cubic'`: C1 cubic splines (aka local splines)
- `'cubic2'`: C2 cubic splines (aka natural splines)
- `'catmull-rom'`: C1 cubic centripetal "tension" splines
name : str
name for this curve
basis : {"rpz", "xyz"}
basis for input coordinates. Defaults to "xyz"
Returns
-------
SplineXYZCurve: SplineXYZCurve
Expand Down
2 changes: 1 addition & 1 deletion desc/geometry/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ class ZernikeRZToroidalSection(Surface):
For L>0, the indexing scheme defines order of the basis functions:
``'ansi'``: ANSI indexing fills in the pyramid with triangles of
decreasing size, ending in a triagle shape. For L == M,
decreasing size, ending in a triangle shape. For L == M,
the traditional ANSI pyramid indexing is recovered. For L>M, adds rows
to the bottom of the pyramid, increasing L while keeping M constant,
giving a "house" shape
Expand Down
2 changes: 1 addition & 1 deletion desc/io/ascii_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def write_ascii(fname, eq):
file.write("NFP = {:3d}\n".format(int(eq.NFP)))
file.write("Psi = {:16.8E}\n".format(eq.Psi))

# boundary paramters
# boundary parameters
if eq.sym:
nbdry = len(np.nonzero(eq.Rb_lmn)[0]) + len(np.nonzero(eq.Zb_lmn)[0])
file.write("Nbdry = {:3d}\n".format(nbdry))
Expand Down
4 changes: 2 additions & 2 deletions desc/io/core_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self):
self.resolve_base()

def __del__(self):
"""Close file upon garbage colleciton or explicit deletion with del function."""
"""Close file upon garbage collection or explicit deletion with del function."""
self.close()

def close(self):
Expand Down Expand Up @@ -53,7 +53,7 @@ def resolve_where(self, where):
-------
if where is None:
base attribute
if where is file with type foundin _file_types_
if where is file with type found in _file_types_
where
"""
Expand Down
4 changes: 2 additions & 2 deletions desc/io/hdf5_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def read_obj(self, obj, where=None):
----------
obj : python object instance
object must have _io_attrs_ attribute to have attributes read and loaded
where : None or file insance
where : None or file instance
specifies where to read obj from
"""
Expand Down Expand Up @@ -217,7 +217,7 @@ def read_list(self, where=None):
Parameters
----------
where : None or file instance
specifies wehre to read dict from
specifies where to read dict from
"""
thelist = []
Expand Down
8 changes: 3 additions & 5 deletions desc/io/input_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def parse_inputs(self, fname=None): # noqa: C901 - FIXME: simplify this
if inputs["objective"] == "vacuum" and (pres_flag or iota_flag or curr_flag):
warnings.warn(
"Vacuum objective does not use any profiles, "
+ "ignoring presssure, iota, and current"
+ "ignoring pressure, iota, and current"
)

# sort axis array
Expand Down Expand Up @@ -901,7 +901,7 @@ def descout_to_input( # noqa: C901 - fxn too complex
f.write("\n")

f.write("\n# fixed-boundary surface shape\n")
# boundary paramters
# boundary parameters
if eq0.sym:
for k, (l, m, n) in enumerate(eq0.surface.R_basis.modes):
if abs(eq0.Rb_lmn[k]) > 1e-8:
Expand Down Expand Up @@ -1615,9 +1615,6 @@ def parse_vmec_inputs(vmec_fname, threshold=0): # noqa: C901 - FIXME: simplify
return inputs_arr


# NOTE: this has to be outside the class to work with autodoc


def get_parser():
"""Get parser for command line arguments.
Expand All @@ -1627,6 +1624,7 @@ def get_parser():
argument parser
"""
# NOTE: this has to be outside the class to work with autodoc
parser = argparse.ArgumentParser(
prog="desc",
allow_abbrev=True,
Expand Down
4 changes: 2 additions & 2 deletions desc/io/pickle_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def read_obj(self, obj=None, where=None):
----------
obj : python object instance
object must have _io_attrs_ attribute to have attributes read and loaded
where : None or file insance
where : None or file instance
specifies where to read obj from
"""
Expand Down Expand Up @@ -107,7 +107,7 @@ def write_obj(self, obj, where=None):
----------
obj : python object instance
object must have _io_attrs_ attribute to have attributes read and loaded
where : None or file insance
where : None or file instance
specifies where to write obj to
"""
Expand Down
Loading

0 comments on commit 27bd131

Please sign in to comment.