Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/250.deprecation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deprecate the `sunkit-spex.legacy` module.
1 change: 1 addition & 0 deletions changelog/250.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Split the gallery into `Examples` and `Legacy Examples` sections.
21 changes: 9 additions & 12 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# http://www.sphinx-doc.org/en/master/config

import datetime
import pathlib
from pathlib import Path

from packaging.version import Version

Expand Down Expand Up @@ -76,10 +76,10 @@
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", (None, "http://data.astropy.org/intersphinx/python3.inv")),
"numpy": ("https://docs.scipy.org/doc/numpy/", (None, "http://data.astropy.org/intersphinx/numpy.inv")),
"scipy": ("https://docs.scipy.org/doc/scipy/reference/", (None, "http://data.astropy.org/intersphinx/scipy.inv")),
"matplotlib": ("https://matplotlib.org/", (None, "http://data.astropy.org/intersphinx/matplotlib.inv")),
"astropy": ("http://docs.astropy.org/en/stable/", None),
"numpy": ("https://docs.scipy.org/doc/numpy/", (None, "https://numpy.org/doc/stable/objects.inv")),
"scipy": ("https://docs.scipy.org/doc/scipy/reference/", (None, "https://docs.scipy.org/doc/scipy/objects.inv")),
"matplotlib": ("https://matplotlib.org/", (None, "https://matplotlib.org/stable/objects.inv")),
"astropy": ("http://docs.astropy.org/en/stable/", (None, "https://docs.astropy.org/en/stable/objects.inv")),
"sunpy": ("https://docs.sunpy.org/en/stable/", None),
}

Expand Down Expand Up @@ -117,18 +117,15 @@

# -- Options for the Sphinx gallery -------------------------------------------

path = pathlib.Path.cwd()
example_dir = path.parent.joinpath("examples")
sphinx_gallery_conf = {
"backreferences_dir": str(path.joinpath("generated", "modules")),
"backreferences_dir": str(Path("generated") / "modules"),
"filename_pattern": "^((?!skip_).)*$",
"examples_dirs": example_dir,
"gallery_dirs": path.joinpath("generated", "gallery"),
"examples_dirs": str(Path("..") / "examples"),
"gallery_dirs": str(Path("generated") / "gallery"),
"abort_on_example_error": False,
"plot_gallery": "True",
"remove_config_comments": True,
"only_warn_on_example_error": True,
'pypandoc': True
"parallel": True,
}

# -- Other options ----------------------------------------------------------
1 change: 1 addition & 0 deletions docs/how_to/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ you quickly accomplish common tasks.
:maxdepth: 1

../generated/gallery/index
../generated/gallery/legacy/index
2 changes: 1 addition & 1 deletion docs/reference/legacy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Legacy (`sunkit_spex.legacy`)
*****************************

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

.. automodapi:: sunkit_spex.legacy
.. automodapi:: sunkit_spex.legacy.thermal
Expand Down
5 changes: 5 additions & 0 deletions examples/legacy/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Legacy Examples
---------------

.. warning::
The legacy module has been deprecated since version 0.4 and will be removed in a future version.
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@
]

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


#####################################################
#
# First, load in your data files, here we load in 2 spectra

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

#####################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
]

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

#####################################################
Expand All @@ -56,7 +56,7 @@


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

#####################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@
]

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


#####################################################
#
# First, load in your data files, here we load in 2 spectra
_dir = "./nustar/Glesener2020/"
_dir = "../../nustar/Glesener2020/"
# 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...
spec = Fitter(
pha_file=_dir + "nu20312001001B06_cl_grade0_sr_grp.pha",
Expand Down Expand Up @@ -141,7 +141,7 @@
# In the original Figure 3(c), a broken power law is used as the cold thick target does not exist ins XPSEC.
#
# First, load in your data files, here we load in 2 spectra
_dir = "./nustar/Glesener2020/"
_dir = "../../nustar/Glesener2020/"
spec = Fitter(
pha_file=[_dir + "nu20312001001A06_cl_grade0_sr_grp.pha", _dir + "nu20312001001B06_cl_grade0_sr_grp.pha"],
arf_file=[_dir + "nu20312001001A06_cl_grade0_sr.arf", _dir + "nu20312001001B06_cl_grade0_sr.arf"],
Expand Down Expand Up @@ -227,7 +227,7 @@
#
# First, load in your data files, here we load in 1 spectrum

_dir = "./nustar/Glesener2020/"
_dir = "../../nustar/Glesener2020/"
spec = Fitter(
pha_file=_dir + "nu20312001001B06_cl_grade0_sr_grp.pha",
arf_file=_dir + "nu20312001001B06_cl_grade0_sr.arf",
Expand Down Expand Up @@ -286,7 +286,7 @@
#
# First, load in your data files, here we load in 2 spectra

_dir = "./nustar/Glesener2020/"
_dir = "../../nustar/Glesener2020/"
spec = Fitter(
pha_file=[_dir + "nu20312001001A06_cl_grade0_sr_grp.pha", _dir + "nu20312001001B06_cl_grade0_sr_grp.pha"],
arf_file=[_dir + "nu20312001001A06_cl_grade0_sr.arf", _dir + "nu20312001001B06_cl_grade0_sr.arf"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@
]

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

#####################################################
#
# Load in your data files, here we load in 2 spectra

_dir = "./nustar/m10_1616_1620/"
_dir = "../../nustar/m10_1616_1620/"
spec = Fitter(
pha_file=[_dir + "nu80415202001A06_chu13_N_cl_grade0_sr.pha", _dir + "nu80415202001B06_chu13_N_cl_grade0_sr.pha"]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
file_names = ["20021005_103800_spec.fits", "20021005_103800_srm.fits"]

for fname in file_names:
dl.enqueue_file(base_url + fname, path="./rhessi/")
dl.enqueue_file(base_url + fname, path="../../rhessi/")
files = dl.download()

#####################################################
Expand All @@ -61,7 +61,9 @@
#
# Load in the data...

rhess_spec = RhessiLoader(spectrum_fn="./rhessi/20021005_103800_spec.fits", srm_fn="./rhessi/20021005_103800_srm.fits")
rhess_spec = RhessiLoader(
spectrum_fn="../../rhessi/20021005_103800_spec.fits", srm_fn="../../rhessi/20021005_103800_srm.fits"
)

#####################################################
#
Expand Down Expand Up @@ -358,7 +360,7 @@
# ----------------
#

save_filename = "./sunxspexRhessiSpectralFitting.pickle"
save_filename = "../sunxspexRhessiSpectralFitting.pickle"
fitter.save(save_filename)

#####################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
]

for fname in file_names:
dl.enqueue_file(base_url + fname, path="./stix/")
dl.enqueue_file(base_url + fname, path="../../stix/")
files = dl.download()

#####################################################
Expand All @@ -83,7 +83,7 @@
# Load in the data...

stix_spec = STIXLoader(
spectrum_file="./stix/stx_spectrum_2410019944_IM.fits", srm_file="./stix/stx_srm_2410019944_IM.fits"
spectrum_file="../../stix/stx_spectrum_2410019944_IM.fits", srm_file="../../stix/stx_srm_2410019944_IM.fits"
)

#####################################################
Expand Down Expand Up @@ -202,7 +202,7 @@
# ----------------
#

save_filename = "./stix/sunkitspexSTIXpectralFitting.pickle"
save_filename = "../../stix/sunkitspexSTIXpectralFitting.pickle"
fitter.save(save_filename)

#####################################################
Expand Down Expand Up @@ -266,8 +266,8 @@
# ========================================================
# Loading the data into the fitter loader
#
spec_bg, srm_bg = "./stix/stx_spectrum_2410019944_BKG.fits", "./stix/stx_srm_2410019944_BKG.fits"
spec_im, srm_im = "./stix/stx_spectrum_2410019944_IM.fits", "./stix/stx_srm_2410019944_IM.fits"
spec_bg, srm_bg = "../../stix/stx_spectrum_2410019944_BKG.fits", "../../stix/stx_srm_2410019944_BKG.fits"
spec_im, srm_im = "../../stix/stx_spectrum_2410019944_IM.fits", "../../stix/stx_srm_2410019944_IM.fits"

spec_joint = Fitter(pha_file=[spec_bg, spec_im], srm_file=[srm_bg, srm_im])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
file_names = ["rhessi-2011-jul-stixbins-spec.fits", "rhessi-2011-jul-stixbins-srm.fits"]

for fname in file_names:
dl.enqueue_file(base_url + fname, path="./rhessi/")
dl.enqueue_file(base_url + fname, path="../../rhessi/")
files = dl.download()


Expand All @@ -42,7 +42,8 @@
# Load in the spectrum and SRM, notice the warning about attenuator changes!

rl = rhessi.RhessiLoader(
spectrum_fn="./rhessi/rhessi-2011-jul-stixbins-spec.fits", srm_fn="./rhessi/rhessi-2011-jul-stixbins-srm.fits"
spectrum_fn="../../rhessi/rhessi-2011-jul-stixbins-spec.fits",
srm_fn="../../rhessi/rhessi-2011-jul-stixbins-srm.fits",
)

#####################################################
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ docs = [
"packaging",
"sphinx-changelog",
"sphinx-gallery",
"pypandoc"
"joblib", # for sphinx-gallery parallel
]
dev = [
"sunkit-spex[docs,tests]",
Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ filterwarnings =
ignore::pyparsing.warnings.PyparsingDeprecationWarning
ignore::FutureWarning:arviz.*
ignore:The isiterable function.*:astropy.utils.exceptions.AstropyDeprecationWarning
ignore:The legacy module.*:sunpy.util.exceptions.SunpyDeprecationWarning
9 changes: 9 additions & 0 deletions sunkit_spex/legacy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import warnings

from sunpy.util.exceptions import SunpyDeprecationWarning

warnings.warn(
"The legacy module has been deprecated since version 0.4 and will be removed in a future version.",
SunpyDeprecationWarning,
stacklevel=2,
)
Loading