-
Notifications
You must be signed in to change notification settings - Fork 19
docs: add NumPy-style docstrings for ReadTheDocs #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
docs: add NumPy-style docstrings for ReadTheDocs #96
Conversation
Add extensions for autodoc, napoleon, mathjax, intersphinx, and viewcode. Configure napoleon for NumPy-style docstrings with math rendering support and cross-references to Python, NumPy, SciPy, and PyTorch documentation.
- Add autodoc_mock_imports for heavy dependencies (torch, numpy, etc.) - Create api.rst with single-page API reference for all modules - Update index.rst to include API Reference section
Document package architecture, class relationships, data flow, potential bugs, and docstring requirements with priority levels.
- experiment.py: Experiment class, interpolate, get_valid_range - datasets.py: ChunkDataset class, __getitem__ - dataloaders.py: get_multisession_dataloader, get_multisession_concat_dataloader - configs.py: module-level docstring with exports documentation
- Create _static directory to fix warning - Fix initialize_statistics, initialize_transforms docstrings (datasets.py) - Fix get_screen_sample_mask_from_meta_conditions docstring (datasets.py) - Fix get_full_valid_sample_times docstring (datasets.py) - Fix add_behavior_as_channels docstring (utils.py) - Remove duplicate device_names property docstring (experiment.py)
interpolators.py: - Interpolator base class and factory method - SequenceInterpolator with linear interpolation math - ScreenInterpolator for visual stimuli - PhaseShiftedSequenceInterpolator - ScreenTrial and subclasses (ImageTrial, VideoTrial, BlankTrial) intervals.py: - TimeInterval class - All interval manipulation functions utils.py: - LongCycler, ShortCycler - FastSessionDataLoader with full parameter documentation
Add extensions for autodoc, napoleon, mathjax, intersphinx, and viewcode. Configure napoleon for NumPy-style docstrings with math rendering support and cross-references to Python, NumPy, SciPy, and PyTorch documentation.
- Add autodoc_mock_imports for heavy dependencies (torch, numpy, etc.) - Create api.rst with single-page API reference for all modules - Update index.rst to include API Reference section
Document package architecture, class relationships, data flow, potential bugs, and docstring requirements with priority levels.
- experiment.py: Experiment class, interpolate, get_valid_range - datasets.py: ChunkDataset class, __getitem__ - dataloaders.py: get_multisession_dataloader, get_multisession_concat_dataloader - configs.py: module-level docstring with exports documentation
- Create _static directory to fix warning - Fix initialize_statistics, initialize_transforms docstrings (datasets.py) - Fix get_screen_sample_mask_from_meta_conditions docstring (datasets.py) - Fix get_full_valid_sample_times docstring (datasets.py) - Fix add_behavior_as_channels docstring (utils.py) - Remove duplicate device_names property docstring (experiment.py)
interpolators.py: - Interpolator base class and factory method - SequenceInterpolator with linear interpolation math - ScreenInterpolator for visual stimuli - PhaseShiftedSequenceInterpolator - ScreenTrial and subclasses (ImageTrial, VideoTrial, BlankTrial) intervals.py: - TimeInterval class - All interval manipulation functions utils.py: - LongCycler, ShortCycler - FastSessionDataLoader with full parameter documentation
…o/experanto into claude/add-docstrings-KhA9Q
- datasets.py: get_data_key_from_root_folder - interpolators.py: rescale_frame - utils.py: SessionBatchSampler.__init__, SessionSpecificSampler.__init__
- Add sphinx.ext.autosummary extension - Create custom class template for detailed docs - Reorganize api.rst with autosummary tables - Each class/function now gets its own page
- Create configuration.rst with full default.yaml embedded - Add documentation for all configuration options - Update index.rst to include configuration page
- Add features section highlighting key capabilities - Include quick start examples for Experiment and DataLoader - Add configuration snippet and documentation links - Add contributing, license, and citation sections
|
Review these changes at https://app.gitnotebooks.com/sensorium-competition/experanto/pull/96 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds NumPy-style docstrings and a Sphinx/ReadTheDocs documentation pipeline to generate API reference pages automatically.
Changes:
- Added/expanded NumPy-style docstrings across core modules (datasets, interpolators, experiment, utils, intervals, dataloaders).
- Added Sphinx configuration (autodoc/napoleon/autosummary) plus API/configuration pages and a custom autosummary class template.
- Updated README with features, quick start, and documentation links; ignored generated API docs output in
.gitignore.
Reviewed changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| experanto/utils.py | Updates docstrings for utilities and cyclers; minor formatting changes. |
| experanto/intervals.py | Adds docstrings and corrects some return type annotations for interval utilities. |
| experanto/interpolators.py | Adds comprehensive class/method docstrings; minor typing fix for rescale_size. |
| experanto/experiment.py | Adds class/method docstrings for the main Experiment interface. |
| experanto/datasets.py | Adds a full NumPy-style class docstring and method docstrings for ChunkDataset. |
| experanto/dataloaders.py | Adds docstrings and examples for multi-session dataloader helpers. |
| experanto/configs.py | Adds module docstring describing exported default config constants. |
| docs/source/index.rst | Cleans up wording and adds API Reference toctree entries. |
| docs/source/configuration.rst | New docs page describing configuration options and embedding default YAML. |
| docs/source/conf.py | Enables Sphinx extensions and configures autodoc/napoleon/autosummary + mocks. |
| docs/source/api.rst | New autosummary-driven API reference index. |
| docs/source/_templates/custom-class-template.rst | New autosummary template to generate per-class pages with methods/attributes. |
| docs/source/_static/.gitkeep | Keeps _static/ directory tracked. |
| README.md | Adds features, quick start examples, and RTD links. |
| .gitignore | Ignores Sphinx autosummary generated output directory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
reneburghardt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice stuff @oliveira-caio
- Add configuration options section to demo_configs.rst - Remove standalone configuration.rst (duplicated content) - Update index.rst to remove configuration from API Reference
…o/experanto into claude/add-docstrings-KhA9Q
- Remove query language from Interpolator base class - Add TimeIntervalInterpolator class docstring with full detail - Minimize all interpolate method docstrings (detail lives in classes) - Add TimeIntervalInterpolator to Interpolator See Also section
…o/experanto into claude/add-docstrings-KhA9Q
schewskone
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool PR! Thanks @oliveira-caio
Not sure about the TeX formatting inside the code itself.
Can it be used for automated docstrings in readthedocs where it is formatted properly?
| ``global_sampling_rate`` | ||
| Override sampling rate for all modalities. Set to ``null`` to use per-modality rates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why null and not None in these examples?
| and ``"standardize"`` (z-score normalization). | ||
|
|
||
| ``interpolation`` | ||
| Interpolation settings including ``interpolation_mode`` (``"linear"`` or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe mention that this is only for Sequence interpolators
|
|
||
| .. math:: | ||
|
|
||
| y(t) = y_0 \\cdot \\frac{t_1 - t}{t_1 - t_0} + y_1 \\cdot \\frac{t - t_0}{t_1 - t_0}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| y(t) = y_0 \\cdot \\frac{t_1 - t}{t_1 - t_0} + y_1 \\cdot \\frac{t - t_0}{t_1 - t_0}, | |
| y = y0 * (t1 - t) / (t1 - t0) + y1 * (t - t0) / (t1 - t0) |
Markdown does not work here right or is this useful for readthedocs?
|
|
||
| y(t) = y_0 \\cdot \\frac{t_1 - t}{t_1 - t_0} + y_1 \\cdot \\frac{t - t_0}{t_1 - t_0}, | ||
|
|
||
| where :math:`t_0` and :math:`t_1` are the surrounding sample times. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| where :math:`t_0` and :math:`t_1` are the surrounding sample times. | |
| where t_0 and t_1 are the surrounding sample times. |
Summary
Changes
Docstrings
experiment.py: Experiment class, interpolate(), get_valid_range()datasets.py: ChunkDataset class and methodsdataloaders.py: get_multisession_dataloader(), get_multisession_concat_dataloader()interpolators.py: All interpolator classes (Interpolator, SequenceInterpolator, ScreenInterpolator, etc.)intervals.py: TimeInterval class and interval functionsutils.py: LongCycler, ShortCycler, FastSessionDataLoader, SessionBatchSampler, etc.Documentation Structure
README