Skip to content

Commit 2678902

Browse files
authored
Minor cleanup of docs (#677)
2 parents 4d22d84 + daf98e0 commit 2678902

9 files changed

Lines changed: 153 additions & 33 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ dist
5050
*misc/
5151
*temp/
5252
*TEST.fits
53-
*temp*
5453
*speclecado*.fits
5554
*inst_pkgs/
5655

docs/source/5_liners/loading_packages.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"\n",
3030
"from tempfile import TemporaryDirectory\n",
3131
"tmpdir = TemporaryDirectory()\n",
32-
"sim.rc.__config__[\"!SIM.file.local_packages_path\"] = tmpdir.name"
32+
"sim.set_inst_pkgs_path(tmpdir.name)"
3333
]
3434
},
3535
{
@@ -139,7 +139,7 @@
139139
"name": "python",
140140
"nbconvert_exporter": "python",
141141
"pygments_lexer": "ipython3",
142-
"version": "3.9.16"
142+
"version": "3.12.7"
143143
}
144144
},
145145
"nbformat": 4,

docs/source/5_liners/scopsim_templates_intro.ipynb

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"source": [
2222
"import numpy as np\n",
2323
"import matplotlib.pyplot as plt\n",
24-
"from matplotlib.colors import LogNorm\n",
2524
"\n",
2625
"import scopesim_templates as sim_tp"
2726
]
@@ -41,9 +40,11 @@
4140
"metadata": {},
4241
"outputs": [],
4342
"source": [
44-
"my_cluster = sim_tp.stellar.clusters.cluster(mass=1000.0, # [Msun]\n",
45-
" distance=8000, # [pc]\n",
46-
" core_radius=1) # [pc]\n",
43+
"my_cluster = sim_tp.stellar.clusters.cluster(\n",
44+
" mass=1000.0, # [Msun]\n",
45+
" distance=8000, # [pc]\n",
46+
" core_radius=1, # [pc]\n",
47+
")\n",
4748
"my_cluster.plot()"
4849
]
4950
},
@@ -63,18 +64,21 @@
6364
"outputs": [],
6465
"source": [
6566
"# See the docstring of `elliptical` for more keywords\n",
66-
"my_elliptical = sim_tp.extragalactic.galaxies.elliptical(half_light_radius=30, # [arcsec]\n",
67-
" pixel_scale=0.1, # [arcsec]\n",
68-
" filter_name=\"Ks\",\n",
69-
" amplitude=10,\n",
70-
" normalization=\"total\", # [Ks=10 for integrated flux]\n",
71-
" n=4, # Sersic index \n",
72-
" ellipticity=0.5,\n",
73-
" angle=30)\n",
67+
"my_elliptical = sim_tp.extragalactic.galaxies.elliptical(\n",
68+
" half_light_radius=30, # [arcsec]\n",
69+
" pixel_scale=0.1, # [arcsec]\n",
70+
" filter_name=\"Ks\",\n",
71+
" amplitude=10,\n",
72+
" normalization=\"total\", # [Ks=10 for integrated flux]\n",
73+
" n=4, # Sersic index \n",
74+
" ellipticity=0.5,\n",
75+
" angle=30, # [deg]\n",
76+
")\n",
7477
"\n",
7578
"plt.figure(figsize=(12, 5))\n",
7679
"plt.subplot(121)\n",
77-
"plt.imshow(my_elliptical.fields[0].data, norm=LogNorm(), extent=[-25.6, 25.6, -25.6, 25.6])\n",
80+
"plt.imshow(my_elliptical.fields[0].data, norm=\"log\",\n",
81+
" extent=[-25.6, 25.6, -25.6, 25.6])\n",
7882
"plt.xlabel(\"[arcsec]\")\n",
7983
"plt.subplot(122)\n",
8084
"wave = np.arange(5000, 25000) # [angstrom]\n",
@@ -99,7 +103,7 @@
99103
"name": "python",
100104
"nbconvert_exporter": "python",
101105
"pygments_lexer": "ipython3",
102-
"version": "3.9.16"
106+
"version": "3.12.7"
103107
}
104108
},
105109
"nbformat": 4,
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{ fullname | escape | underline}}
2+
3+
.. currentmodule:: {{ module }}
4+
5+
.. autoclass:: {{ objname }}
6+
:members:
7+
:show-inheritance:
8+
:inherited-members:
9+
10+
{% block methods %}
11+
.. automethod:: __init__
12+
13+
{% if methods %}
14+
.. rubric:: {{ _('Methods') }}
15+
16+
.. autosummary::
17+
{% for item in methods %}
18+
~{{ name }}.{{ item }}
19+
{%- endfor %}
20+
{% endif %}
21+
{% endblock %}
22+
23+
{% block attributes %}
24+
{% if attributes %}
25+
.. rubric:: {{ _('Attributes') }}
26+
27+
.. autosummary::
28+
{% for item in attributes %}
29+
~{{ name }}.{{ item }}
30+
{%- endfor %}
31+
{% endif %}
32+
{% endblock %}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{{ fullname | escape | underline}}
2+
3+
.. automodule:: {{ fullname }}
4+
5+
{% block attributes %}
6+
{% if attributes %}
7+
.. rubric:: {{ _('Module Attributes') }}
8+
9+
.. autosummary::
10+
:toctree:
11+
{% for item in attributes %}
12+
{{ item }}
13+
{%- endfor %}
14+
{% endif %}
15+
{% endblock %}
16+
17+
{% block functions %}
18+
{% if functions %}
19+
.. rubric:: {{ _('Functions') }}
20+
21+
.. autosummary::
22+
:toctree:
23+
{% for item in functions %}
24+
{{ item }}
25+
{%- endfor %}
26+
{% endif %}
27+
{% endblock %}
28+
29+
{% block classes %}
30+
{% if classes %}
31+
.. rubric:: {{ _('Classes') }}
32+
33+
.. autosummary::
34+
:toctree:
35+
:template: custom-class-template.rst
36+
{% for item in classes %}
37+
{{ item }}
38+
{%- endfor %}
39+
{% endif %}
40+
{% endblock %}
41+
42+
{% block exceptions %}
43+
{% if exceptions %}
44+
.. rubric:: {{ _('Exceptions') }}
45+
46+
.. autosummary::
47+
:toctree:
48+
{% for item in exceptions %}
49+
{{ item }}
50+
{%- endfor %}
51+
{% endif %}
52+
{% endblock %}
53+
54+
{% block modules %}
55+
{% if modules %}
56+
.. rubric:: Modules
57+
58+
.. autosummary::
59+
:toctree:
60+
:template: custom-module-template.rst
61+
:recursive:
62+
{% for item in modules %}
63+
{{ item }}
64+
{%- endfor %}
65+
{% endif %}
66+
{% endblock %}

docs/source/conf.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,26 @@
5757
# ones.
5858
extensions = [
5959
'scopesim_sphinx_ext',
60-
'sphinx.ext.intersphinx',
6160
'sphinx.ext.todo',
62-
'sphinx.ext.mathjax',
63-
'sphinx.ext.viewcode',
64-
'numpydoc',
65-
'matplotlib.sphinxext.plot_directive',
66-
'sphinxcontrib.apidoc',
6761
'sphinx.ext.autodoc',
62+
'sphinx.ext.autosummary',
63+
'sphinx.ext.intersphinx',
64+
'sphinx.ext.inheritance_diagram',
65+
'sphinx.ext.mathjax',
66+
'sphinx.ext.extlinks',
67+
'sphinx.ext.doctest',
68+
'sphinx.ext.napoleon',
6869
'sphinx_copybutton',
6970
'myst_nb',
7071
]
7172

7273
# apidoc settings
73-
numpydoc_show_class_members = False
74-
apidoc_module_dir = pth.abspath('../../scopesim/')
75-
apidoc_output_dir = 'reference'
76-
apidoc_separate_modules = True
74+
autosummary_generate = True
75+
autoclass_content = "class"
76+
autodoc_default_flags = ["members", "inherited-members"]
77+
autodoc_docstring_signature = False
78+
napoleon_numpy_docstring = True
79+
napoleon_use_admonition_for_references = True
7780
apidoc_excluded_paths = ["tests/", "docs/"]
7881

7982
# Matplotlib plot directive config parameters

docs/source/faqs/bind_to_local_irdb.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This is quite easy and involves only two steps:
88
1. `Make a local copy of the IRDB`_
99
2. `Tell ScopeSim where to find the IRDB`_
1010

11-
- `By using runtime ScopeSIm commands`_
11+
- `By using runtime ScopeSim commands`_
1212
- `By editing the ScopeSim config file`_
1313

1414
Make a local copy of the IRDB
@@ -32,8 +32,8 @@ By using runtime ScopeSim commands
3232
At the beginning of any script or jupyter notebook we can run the following command to set the default location of the instrument packages:
3333
This is by far the simplest method, but it requires this lone of code in every script::
3434

35-
import scopesim
36-
scopesim.rc.__config__["!SIM.file.local_packages_path"] = "<path/to/IRDB>"
35+
import scopesim as sim
36+
sim.link_irdb("<path/to/IRDB>")
3737

3838

3939
By editing the ScopeSim config file

docs/source/index.rst

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ ScopeSim_ is on pip::
3232
examples/index
3333
5_liners/index
3434
faqs/index
35-
effects_docstrings/index
36-
Reference API <reference/modules>
3735

3836

3937
The ScopeSim python ecosystem
@@ -80,3 +78,20 @@ Contact
8078
8179

8280
- For friendly chat, join the slack at https://join.slack.com/t/scopesim/shared_invite/zt-143s42izo-LnyqoG7gH5j~aGn51Z~4IA
81+
82+
API reference
83+
-------------
84+
85+
.. autosummary::
86+
:toctree: _autosummary
87+
:template: custom-module-template.rst
88+
:recursive:
89+
:caption: Package Contents
90+
91+
scopesim.commands
92+
scopesim.detector
93+
scopesim.effects
94+
scopesim.optics
95+
scopesim.server
96+
scopesim.source
97+
scopesim.utils

scopesim/commands/user_commands.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ class UserCommands(NestedChainMap):
151151
152152
.. versionchanged:: v0.8.0
153153
154-
This now inherits from (a subclass of) `collections.ChainMap`.
154+
This now inherits from (a subclass of) `collections.ChainMap`.
155+
155156
"""
156157

157158
@top_level_catch

0 commit comments

Comments
 (0)