Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

Description

Added 66 docstrings in NumPy format across 33 source files. Focused on high-impact, frequently-used modules to improve code documentation and API clarity.

Related Issue

This addresses the need for comprehensive API documentation following NumPy docstring conventions.

Changes to existing functionality

  • No functional changes - documentation only
  • Pre-commit formatting applied (ruff format modified 22 files)
  • Fixed typo: "ChomaticityMonitor" → "ChromaticityMonitor"

Testing

No new tests required. Documentation-only changes.

Verify that your checklist complies with the project

  • New and existing unit tests pass locally
  • Tests were added to prove that all features/changes are effective (N/A - documentation only)
  • The code is commented where appropriate
  • Any existing features are not broken (unless there is an explicit change to an existing functionality)

Modules Enhanced

Core: accelerator.py (3) - set_energy(), live, design properties

Arrays (14): Configuration classes for bpm, element, magnet, cfm_magnet, serialized_magnet; RWBPMPosition, RWBPMSinglePosition implementations

BPM (9): BPM class properties (model, positions, offset, tilt, attach); BPMModel index checkers

Control (5): Abstract methods in DeviceAccess, DeviceAccessList; Quality enum documentation

Diagnostics (5): TuneMonitor and ChromaticityMonitor properties and attachment methods

Lattice (3): LatticeElementsLinker methods, AttributeLinker.get_element_identifier()

Magnet (13): ConfigModel for all magnet types (quadrupole, sextupole, octupole, correctors, etc.); RWCorrectorAngle methods

RF (4): RFTransmitter.ConfigModel, voltage, phase, attach()

Configuration (4): get_curve(), get_matrix() methods for CSV and inline loaders

Example

def set_energy(self, E: float):
    """
    Set the energy for all simulators and control systems.

    Parameters
    ----------
    E : float
        Energy value to set in GeV
    """

Remaining Work

~300 docstrings remain across: array implementations (32), element_holder (46), factory/loaders (19), control implementations (63), lattice/simulator (78), magnet models (50), rf_plant (9), tuning_tools (12), external interfaces (6). Can be addressed in future PRs.

Quality Checks

  • Security scan: 0 vulnerabilities
  • Code review: 1 typo corrected
  • All docstrings follow NumPy format with Parameters/Returns/Raises sections
Original prompt

Make a Pull request that adds docstrings where they are missing. Docstrings should have numpy docstring format.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 6 commits February 3, 2026 22:16
Co-authored-by: gubaidulinvadim <2589030+gubaidulinvadim@users.noreply.github.com>
Co-authored-by: gubaidulinvadim <2589030+gubaidulinvadim@users.noreply.github.com>
Co-authored-by: gubaidulinvadim <2589030+gubaidulinvadim@users.noreply.github.com>
Co-authored-by: gubaidulinvadim <2589030+gubaidulinvadim@users.noreply.github.com>
Co-authored-by: gubaidulinvadim <2589030+gubaidulinvadim@users.noreply.github.com>
Co-authored-by: gubaidulinvadim <2589030+gubaidulinvadim@users.noreply.github.com>
Copilot AI changed the title [WIP] Add missing docstrings in numpy format Add NumPy-format docstrings to core modules Feb 3, 2026
Copilot AI requested a review from gubaidulinvadim February 3, 2026 22:26
@JeanLucPons
Copy link
Contributor

def set_energy(self, E: float):
    """
    Set the energy for all simulators and control systems.

    Parameters
    ----------
    E : float
        Energy value to set in eV [not GeV]
    """

@gubaidulinvadim gubaidulinvadim marked this pull request as ready for review February 9, 2026 09:20
@gubaidulinvadim gubaidulinvadim requested review from JeanLucPons and removed request for gubaidulinvadim February 9, 2026 09:23
@gubaidulinvadim
Copy link
Contributor

I've looked through it. It looks ok as a start to adding the docs consistently.

Copy link
Contributor

@GamelinAl GamelinAl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation for the fill_array methods is not clear to me but maybe it is because I am not sure to understand the code or what is done there.

Comment on lines +24 to +27
voltage : DeviceAccess or None, optional
Device to apply cavity voltage
phase : DeviceAccess or None, optional
Device to apply cavity phase
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have unit here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, for the moment it will take the unit of the control system. It is DeviceAccess (kind of tango proxy equivalent).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure either, should this be a requierement? We ask for unit in V, or it is to the user to provide their value and then whatever is given is the unit used?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the moment the unit returned by the CS is specified in the DeviceAccess object.
It is possible to get it from TangoDB but for Epics i have no idea if they have a standard.
Then we should implement pint (or an other solution) to provide the unit expected at the PyAML level.

JeanLucPons and others added 6 commits February 9, 2026 14:20
Co-authored-by: GamelinAl <alexis.gamelin@synchrotron-soleil.fr>
Co-authored-by: GamelinAl <alexis.gamelin@synchrotron-soleil.fr>
Co-authored-by: GamelinAl <alexis.gamelin@synchrotron-soleil.fr>
Co-authored-by: GamelinAl <alexis.gamelin@synchrotron-soleil.fr>
@JeanLucPons
Copy link
Contributor

I modifed conf.py and BPMArray to show an example on how to introduce yaml or python code block inside the docstring.

image

@GamelinAl
Copy link
Contributor

@JeanLucPons this looks very nice for the documentation. We should try to have this confg+code example at different locations.

@gubaidulinvadim gubaidulinvadim merged commit 1913bfb into main Feb 10, 2026
3 checks passed
@gubaidulinvadim gubaidulinvadim deleted the copilot/add-missing-docstrings branch February 10, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants