Skip to content

Commit acec366

Browse files
committed
Fix more sphinx nitpick docs warnings
Mostly adding missing docstrings to classes or fixing syntax. The actual docstring content has not yet been properly updated and needs a refresh which will be done later.
1 parent 85fa33b commit acec366

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

src/atip/simulator.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ class LatticeData:
2222

2323

2424
def calculate_optics(
25-
at_lattice: at.Lattice, refpts: ArrayLike, disable_emittance: bool = False
25+
at_lattice: at.lattice_object.Lattice,
26+
refpts: ArrayLike,
27+
disable_emittance: bool = False,
2628
) -> LatticeData:
2729
"""Perform the physics calculations on the lattice.
2830
@@ -33,7 +35,7 @@ def calculate_optics(
3335
3436
Args:
3537
at_lattice (at.lattice_object.Lattice): AT lattice definition.
36-
refpts (numpy.array): A boolean array specifying the points at which
38+
refpts (numpy.typing.NDArray): A boolean array specifying the points at which
3739
to calculate physics data.
3840
disable_emittance (bool): whether to calculate emittance.
3941
@@ -79,7 +81,7 @@ class ATSimulator:
7981
_at_lat (at.lattice_object.Lattice): The centralised instance of an
8082
AT lattice from which the
8183
physics data is calculated.
82-
_rp (numpy.array): A boolean array to be used as refpts for the
84+
_rp (numpy.typing.NDArray): A boolean array to be used as refpts for the
8385
physics calculations.
8486
_disable_emittance (bool): Whether or not to perform the beam
8587
envelope based emittance calculations.
@@ -388,7 +390,7 @@ def get_orbit(self, field=None):
388390
if None return whole orbit vector.
389391
390392
Returns:
391-
numpy.array: The x, x phase, y or y phase for the AT lattice as an
393+
numpy.typing.NDArray: The x, x phase, y or y phase for the AT lattice as an
392394
array of floats the length of the AT lattice.
393395
394396
Raises:
@@ -417,7 +419,7 @@ def get_dispersion(self, field=None):
417419
None return whole dispersion vector.
418420
419421
Returns:
420-
numpy.array: The eta x, eta prime x, eta y or eta prime y for the
422+
numpy.typing.NDArray: The eta x, eta prime x, eta y or eta prime y for the
421423
AT lattice as an array of floats the length of the AT lattice.
422424
423425
Raises:
@@ -441,31 +443,31 @@ def get_alpha(self):
441443
"""Return the alpha vector at every element in the AT lattice.
442444
443445
Returns:
444-
numpy.array: The alpha vector for each element.
446+
numpy.typing.NDArray: The alpha vector for each element.
445447
"""
446448
return self._lattice_data.twiss["alpha"][:-1]
447449

448450
def get_beta(self):
449451
"""Return the beta vector at every element in the AT lattice.
450452
451453
Returns:
452-
numpy.array: The beta vector for each element.
454+
numpy.typing.NDArray: The beta vector for each element.
453455
"""
454456
return self._lattice_data.twiss["beta"][:-1]
455457

456458
def get_mu(self):
457459
"""Return mu at every element in the AT lattice.
458460
459461
Returns:
460-
numpy.array: The mu array for each element.
462+
numpy.typing.NDArray: The mu array for each element.
461463
"""
462464
return self._lattice_data.twiss["mu"][:-1]
463465

464466
def get_m66(self):
465467
"""Return the 6x6 transfer matrix for every element in the AT lattice.
466468
467469
Returns:
468-
numpy.array: The 6x6 transfer matrix for each element.
470+
numpy.typing.NDArray: The 6x6 transfer matrix for each element.
469471
"""
470472
return self._lattice_data.twiss["M"][:-1]
471473

@@ -506,7 +508,7 @@ def get_radiation_integrals(self):
506508
"""Return the 5 Synchrotron Integrals for the AT lattice.
507509
508510
Returns:
509-
numpy.array: The 5 radiation integrals.
511+
numpy.typing.NDArray: The 5 radiation integrals.
510512
"""
511513
return numpy.asarray(self._lattice_data.radint)
512514

@@ -542,7 +544,7 @@ def get_damping_partition_numbers(self):
542544
"""Return the damping partition numbers for the 3 normal modes.
543545
544546
Returns:
545-
numpy.array: The damping partition numbers of the AT lattice.
547+
numpy.typing.NDArray: The damping partition numbers of the AT lattice.
546548
"""
547549
_, I2, _, I4, _ = self._lattice_data.radint
548550
Jx = 1 - (I4 / I2)
@@ -558,7 +560,7 @@ def get_damping_times(self):
558560
Radiation; August 2013; eqn. 68
559561
560562
Returns:
561-
numpy.array: The damping times of the AT lattice.
563+
numpy.typing.NDArray: The damping times of the AT lattice.
562564
"""
563565
E0 = self.get_energy()
564566
U0 = self.get_energy_loss()

src/virtac/atip_ioc_entry.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919

2020
def parse_arguments():
21+
"""Parse command line arguments sent to virtac"""
2122
parser = argparse.ArgumentParser()
2223
parser.add_argument("ring_mode", nargs="?", type=str, help="Ring mode name")
2324
parser.add_argument(
@@ -39,6 +40,7 @@ def parse_arguments():
3940

4041

4142
def main():
43+
"""Main entrypoint for virtac. Executed when running the 'virtac' command"""
4244
args = parse_arguments()
4345
log_level = logging.DEBUG if args.verbose else logging.INFO
4446
logging.basicConfig(level=log_level, format=LOG_FORMAT)

src/virtac/atip_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ def set_feedback_record(self, index, field, value):
541541
value (number): The value to be set.
542542
543543
Raises:
544-
pytac.exceptions.FieldException: If the lattice or element does
544+
pytac.FieldException: If the lattice or element does
545545
not have the specified field.
546546
"""
547547
try:

src/virtac/create_csv.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
def generate_feedback_pvs(all_elements):
16-
# Also get families for tune feedback
16+
"""Get feedback pvs. Also get families for tune feedback"""
1717
tune_quad_elements = set(
1818
all_elements.q1d
1919
+ all_elements.q2d
@@ -54,8 +54,9 @@ def generate_feedback_pvs(all_elements):
5454

5555

5656
def generate_bba_pvs(all_elements):
57-
# Data to be written is stored as a list of tuples each with structure:
58-
# element index (int), field (str), pv (str), value (int).
57+
"""Data to be written is stored as a list of tuples each with structure:
58+
element index (int), field (str), pv (str), value (int).
59+
"""
5960
data = [("index", "field", "pv", "value", "read-only")]
6061
# Iterate over the BPMs to construct the PV names.
6162
for elem in all_elements.bpm:
@@ -76,6 +77,10 @@ def generate_bba_pvs(all_elements):
7677
def generate_pv_limits(lattice):
7778
"""Get the control limits and precision values from the live machine for
7879
all normal PVS.
80+
81+
Args:
82+
lattice (pytac.lattice.Lattice): The pytac lattice being used by the virtual
83+
machine
7984
"""
8085
data = [("pv", "upper", "lower", "precision")]
8186
for element in lattice:
@@ -271,6 +276,7 @@ def write_data_to_file(data, filename, ring_mode):
271276

272277

273278
def parse_arguments():
279+
"""The arguments passed to this script to configure how the csv is to be created"""
274280
parser = argparse.ArgumentParser(
275281
description="Generate CSV file to define the PVs served by the "
276282
"virtual accelerator IOC."

0 commit comments

Comments
 (0)