Skip to content

Commit e253bb9

Browse files
authored
Deprecate legacy and separate example galleries (#250)
* Deprecate legacy and separate example galleries * Add changelogs * Fix doc build * Apply suggestions from code review
1 parent 6396b68 commit e253bb9

17 files changed

+57
-35
lines changed

changelog/250.deprecation.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Deprecate the `sunkit_spex.legacy` module.

changelog/250.doc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Split the gallery into `Examples` and `Legacy Examples` sections.

docs/conf.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# http://www.sphinx-doc.org/en/master/config
66

77
import datetime
8-
import pathlib
8+
from pathlib import Path
99

1010
from packaging.version import Version
1111

@@ -76,10 +76,10 @@
7676
# Example configuration for intersphinx: refer to the Python standard library.
7777
intersphinx_mapping = {
7878
"python": ("https://docs.python.org/3/", (None, "http://data.astropy.org/intersphinx/python3.inv")),
79-
"numpy": ("https://docs.scipy.org/doc/numpy/", (None, "http://data.astropy.org/intersphinx/numpy.inv")),
80-
"scipy": ("https://docs.scipy.org/doc/scipy/reference/", (None, "http://data.astropy.org/intersphinx/scipy.inv")),
81-
"matplotlib": ("https://matplotlib.org/", (None, "http://data.astropy.org/intersphinx/matplotlib.inv")),
82-
"astropy": ("http://docs.astropy.org/en/stable/", None),
79+
"numpy": ("https://docs.scipy.org/doc/numpy/", (None, "https://numpy.org/doc/stable/objects.inv")),
80+
"scipy": ("https://docs.scipy.org/doc/scipy/reference/", (None, "https://docs.scipy.org/doc/scipy/objects.inv")),
81+
"matplotlib": ("https://matplotlib.org/", (None, "https://matplotlib.org/stable/objects.inv")),
82+
"astropy": ("http://docs.astropy.org/en/stable/", (None, "https://docs.astropy.org/en/stable/objects.inv")),
8383
"sunpy": ("https://docs.sunpy.org/en/stable/", None),
8484
}
8585

@@ -117,18 +117,15 @@
117117

118118
# -- Options for the Sphinx gallery -------------------------------------------
119119

120-
path = pathlib.Path.cwd()
121-
example_dir = path.parent.joinpath("examples")
122120
sphinx_gallery_conf = {
123-
"backreferences_dir": str(path.joinpath("generated", "modules")),
121+
"backreferences_dir": str(Path("generated") / "modules"),
124122
"filename_pattern": "^((?!skip_).)*$",
125-
"examples_dirs": example_dir,
126-
"gallery_dirs": path.joinpath("generated", "gallery"),
123+
"examples_dirs": str(Path("..") / "examples"),
124+
"gallery_dirs": str(Path("generated") / "gallery"),
127125
"abort_on_example_error": False,
128-
"plot_gallery": "True",
129126
"remove_config_comments": True,
130127
"only_warn_on_example_error": True,
131-
'pypandoc': True
128+
"parallel": True,
132129
}
133130

134131
# -- Other options ----------------------------------------------------------

docs/how_to/index.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@ you quickly accomplish common tasks.
1111
:maxdepth: 1
1212

1313
../generated/gallery/index
14+
.. toctree::
15+
:maxdepth: 1
16+
:hidden:
17+
18+
../generated/gallery/legacy/index

docs/reference/legacy.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Legacy (`sunkit_spex.legacy`)
22
*****************************
33

44
.. warning::
5-
The legacy module contains legacy code which will no longer be maintained and will be removed in the near future.
5+
The legacy module has been deprecated since version 0.4 and will be removed in a future version.
66

77
.. automodapi:: sunkit_spex.legacy
88
.. automodapi:: sunkit_spex.legacy.thermal

examples/legacy/README.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Legacy Examples
2+
---------------
3+
4+
.. warning::
5+
The legacy module has been deprecated since version 0.4 and will be removed in a future version.

examples/fitting_NuSTAR_spectra-duncan2021.py renamed to examples/legacy/fitting_NuSTAR_spectra-duncan2021.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@
5757
]
5858

5959
for fname in file_names:
60-
dl.enqueue_file(base_url + fname, path="./nustar/Duncan2021/")
60+
dl.enqueue_file(base_url + fname, path="../../nustar/Duncan2021/")
6161
files = dl.download()
6262

6363

6464
#####################################################
6565
#
6666
# First, load in your data files, here we load in 2 spectra
6767

68-
_dir = "./nustar/Duncan2021/"
68+
_dir = "../../nustar/Duncan2021/"
6969
spec = Fitter(pha_file=[_dir + "nu80410201001A06_1618_p_chu2_N_sr.pha", _dir + "nu80410201001B06_1618_p_chu2_N_sr.pha"])
7070

7171
#####################################################

examples/fitting_NuSTAR_spectra-general.py renamed to examples/legacy/fitting_NuSTAR_spectra-general.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
]
4848

4949
for fname in file_names:
50-
dl.enqueue_file(base_url + fname, path="./nustar/m3_time2628/")
50+
dl.enqueue_file(base_url + fname, path="../../nustar/m3_time2628/")
5151
files = dl.download()
5252

5353
#####################################################
@@ -56,7 +56,7 @@
5656

5757

5858
# First, load in your data files, here we load in 1 spectrum
59-
_dir = "./nustar/m3_time2628/"
59+
_dir = "../../nustar/m3_time2628/"
6060
spec = Fitter(pha_file=[_dir + "nu80414202001A06_chu23_S_cl_grade0_sr.pha"])
6161

6262
#####################################################

examples/fitting_NuSTAR_spectra-glesener2020.py renamed to examples/legacy/fitting_NuSTAR_spectra-glesener2020.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@
6262
]
6363

6464
for fname in file_names:
65-
dl.enqueue_file(base_url + fname, path="./nustar/Glesener2020/")
65+
dl.enqueue_file(base_url + fname, path="../../nustar/Glesener2020/")
6666
files = dl.download()
6767

6868

6969
#####################################################
7070
#
7171
# First, load in your data files, here we load in 2 spectra
72-
_dir = "./nustar/Glesener2020/"
72+
_dir = "../../nustar/Glesener2020/"
7373
# In the files here, the ARF and RMF file have different names to the PHA files so cannot use the PHA file name to help find the others so...
7474
spec = Fitter(
7575
pha_file=_dir + "nu20312001001B06_cl_grade0_sr_grp.pha",
@@ -141,7 +141,7 @@
141141
# In the original Figure 3(c), a broken power law is used as the cold thick target does not exist ins XPSEC.
142142
#
143143
# First, load in your data files, here we load in 2 spectra
144-
_dir = "./nustar/Glesener2020/"
144+
_dir = "../../nustar/Glesener2020/"
145145
spec = Fitter(
146146
pha_file=[_dir + "nu20312001001A06_cl_grade0_sr_grp.pha", _dir + "nu20312001001B06_cl_grade0_sr_grp.pha"],
147147
arf_file=[_dir + "nu20312001001A06_cl_grade0_sr.arf", _dir + "nu20312001001B06_cl_grade0_sr.arf"],
@@ -227,7 +227,7 @@
227227
#
228228
# First, load in your data files, here we load in 1 spectrum
229229

230-
_dir = "./nustar/Glesener2020/"
230+
_dir = "../../nustar/Glesener2020/"
231231
spec = Fitter(
232232
pha_file=_dir + "nu20312001001B06_cl_grade0_sr_grp.pha",
233233
arf_file=_dir + "nu20312001001B06_cl_grade0_sr.arf",
@@ -286,7 +286,7 @@
286286
#
287287
# First, load in your data files, here we load in 2 spectra
288288

289-
_dir = "./nustar/Glesener2020/"
289+
_dir = "../../nustar/Glesener2020/"
290290
spec = Fitter(
291291
pha_file=[_dir + "nu20312001001A06_cl_grade0_sr_grp.pha", _dir + "nu20312001001B06_cl_grade0_sr_grp.pha"],
292292
arf_file=[_dir + "nu20312001001A06_cl_grade0_sr.arf", _dir + "nu20312001001B06_cl_grade0_sr.arf"],

examples/fitting_NuSTAR_spectra-simultaneously.py renamed to examples/legacy/fitting_NuSTAR_spectra-simultaneously.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@
5050
]
5151

5252
for fname in file_names:
53-
dl.enqueue_file(base_url + fname, path="./nustar/m10_1616_1620/")
53+
dl.enqueue_file(base_url + fname, path="../../nustar/m10_1616_1620/")
5454
files = dl.download()
5555

5656
#####################################################
5757
#
5858
# Load in your data files, here we load in 2 spectra
5959

60-
_dir = "./nustar/m10_1616_1620/"
60+
_dir = "../../nustar/m10_1616_1620/"
6161
spec = Fitter(
6262
pha_file=[_dir + "nu80415202001A06_chu13_N_cl_grade0_sr.pha", _dir + "nu80415202001B06_chu13_N_cl_grade0_sr.pha"]
6363
)

0 commit comments

Comments
 (0)