Skip to content

Commit 05b6032

Browse files
committed
Last changes before 0.6.0
modified: README.rst modified: doc/conf.py new file: doc/figures/pypeit_spec2d_noise_postscrub.png new file: doc/figures/pypeit_spec2d_noise_prescrub.png new file: doc/figures/scrubber_line_fitting.png modified: doc/include/dependencies_table.rst modified: doc/scrub_deveny_pickup.rst modified: obstools/scrub_deveny_pickup.py modified: setup.cfg
1 parent 4c06df6 commit 05b6032

9 files changed

+59
-12
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ action is to setup a clean python environment into which the installation will
110110
occur. This mitigates any possible dependency conflicts with other packages
111111
you use.
112112

113-
The recommended method of setting up a new envrionment is with ``conda``:
113+
The recommended method of setting up a new environment is with ``conda``:
114114

115115
.. code-block:: console
116116

doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"sphinx.ext.mathjax",
4848
"sphinx.ext.ifconfig",
4949
"sphinx.ext.viewcode",
50+
"sphinx_subfigure",
5051
# "sphinx.ext.autosectionlabel",
5152
]
5253

2.55 MB
Loading
2.55 MB
Loading

doc/figures/scrubber_line_fitting.png

195 KB
Loading

doc/include/dependencies_table.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
================================ ===========================================================================================================================================================================
2-
Python Version ``>=3.10,<3.12``
3-
Required for users ``astropy>=5.1``, ``ccdproc``, ``darkdetect``, ``matplotlib``, ``numpy>=1.22``, ``pysimplegui``, ``requests``, ``scipy>=1.9``, ``setuptools``, ``setuptools_scm``, ``tqdm``
4-
Optional ``pypeit`` requirements ``pypeit[specutils]>=1.14.0``
5-
Required for developers ``black``, ``pylint``, ``pypeit[specutils]>=1.14.0``, ``pyyaml``, ``sphinx``, ``sphinx-automodapi``, ``sphinx_rtd_theme==1.2.2``, ``stomp.py``, ``xmltodict``
6-
================================ ===========================================================================================================================================================================
1+
================================ ===================================================================================================================================================================================
2+
Python Version ``>=3.10,<3.12``
3+
Required for users ``astropy>=5.1``, ``ccdproc``, ``darkdetect``, ``matplotlib``, ``numpy>=1.22``, ``pysimplegui``, ``requests``, ``scipy>=1.9``, ``setuptools``, ``setuptools_scm``, ``tqdm``
4+
Optional ``pypeit`` requirements ``pypeit[specutils]>=1.14.0``
5+
Required for developers ``black``, ``pylint``, ``pypeit[specutils]>=1.14.0``, ``pyyaml``, ``sphinx``, ``sphinx-automodapi``, ``sphinx-subfigure``, ``sphinx_rtd_theme==1.2.2``, ``stomp.py``, ``xmltodict``
6+
================================ ===================================================================================================================================================================================

doc/scrub_deveny_pickup.rst

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ signal. This patten is then subtracted from the original image and saved to
6060
a FITS file for usual data reduction processing (preferably with PypeIt) to
6161
yield an extracted 1D spectrum for analysis.
6262

63+
Example Pre- and Post-Scrubbed Data Products
64+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
65+
6366
To illustrate the need for and utility of this tool, :numref:`spec1d_comps`
6467
shows a comparison of the extracted 1D spectra for two different object types
6568
from two different programs (and nights) from both the original and scrubbed
@@ -81,6 +84,36 @@ from the spectra.
8184
estimates a mean :math:`SNR = 4.8` for the scrubbed galaxy spectrum and
8285
a mean :math:`SNR = 7.2` for the scrubbed white dwarf spectrum.
8386

87+
Of equivalent interest to the quality of the extracted spectra is the noise
88+
remaining after extraction of sky and objects. Shown in :numref:`prepost_noise`
89+
are the noise analysis plots from PyepIt for the pre- and post-scrubbed
90+
versions of the 2D spectral image shown in :numref:`raw_frame`. The images and
91+
pixel histograms are of the residual noise image, which is the science image
92+
minus the object and sky models, and then divided by the uncertainty image.
93+
The ideal pixel histogram would be a gaussian with width :math:`\sigma=1`.
94+
95+
.. _prepost_noise:
96+
.. subfigure:: A|B
97+
:gap: 2px
98+
:class-grid: outline
99+
100+
.. image:: figures/pypeit_spec2d_noise_prescrub.png
101+
:alt: Pre-scrubbed noise analysis plot
102+
103+
.. image:: figures/pypeit_spec2d_noise_postscrub.png
104+
:alt: Post-scrubbed noise analysis plot
105+
106+
-- Noise analysis of the pre- (top) and post-scrubbed (bottom) versions of
107+
the frame shown in :numref:`raw_frame`. Image values are residual image
108+
divided by uncertainty, so the ideal pixel histogram would be a gaussian
109+
with width :math:`\sigma=1`. Note the improvement in both the visual
110+
quality of the scrubbed frame and the width and shape of the pixel histogram
111+
compared to the pre-scrubbed frame.
112+
113+
114+
Outline
115+
^^^^^^^
116+
84117
This document begins with a description of how to use this tool to clean the
85118
EMI pickup noise from your data, and moves on to lay out the details of what
86119
the tool does to your data and other points to consider.
@@ -493,11 +526,11 @@ than that predicted from the FFT (green dashed line in the second panel of
493526
Pickup Noise Pattern Construction
494527
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
495528

496-
Finally, we use the sinusoid fits to produce a pattern image. This is the
529+
The final result of sinusoid fits is a constructed pattern image. This is the
497530
zero-mean sinusoid (sans quadratic polynomial) that *should* represent only the
498-
EMI pickup noise (as an additive AC-only signal). Subtract that and make
499-
additional QA plots to show how totally awesome this is!!!
500-
531+
EMI pickup noise (as an additive AC-only signal). :numref:`image_comparisons`
532+
shows the process of pattern construction and its effect on the processed
533+
science image.
501534

502535
.. _image_comparisons:
503536
.. figure:: figures/scrubber_image_comparisons.*
@@ -629,3 +662,14 @@ panel in :numref:`image_comparisons`). The result is shown in
629662
discussed above) from artifacts and ringing in the FFT. The peak at 169.1
630663
pixels, indicating the frequency with the most power in the flattened array:
631664
most likely the period of the AC EMI pickup noise.
665+
666+
Also, say something about the actual line-by-line fits in terms of how good a
667+
sinusoid fits each one. Show a figure like :numref:`line_by_line`.
668+
669+
.. _line_by_line:
670+
.. figure:: figures/scrubber_line_fitting.png
671+
:class: with-shadow
672+
:alt: Line-by-line fitting examples
673+
674+
-- Examples of individual line fits for 4 randomly selected lines from the
675+
image shown in :numref:`raw_frame`.

obstools/scrub_deveny_pickup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def iterative_pypeit_clean(
131131
try:
132132
# Look for the spec2d file
133133
spec2d_file = [
134-
next(d.joinpath("Science").glob(f"spec2d_{filename.stem}-*"))
134+
next(d.joinpath("Science").glob(f"spec2d_{filename.stem}-*.fits"))
135135
for d in pyp_dir
136136
][0]
137137
except (StopIteration, IndexError):

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ install_requires =
4848
docs =
4949
sphinx
5050
sphinx-automodapi
51+
sphinx-subfigure
5152
sphinx_rtd_theme==1.2.2
5253

5354
broker =
@@ -61,6 +62,7 @@ pypeit =
6162
dev =
6263
sphinx
6364
sphinx-automodapi
65+
sphinx-subfigure
6466
sphinx_rtd_theme==1.2.2
6567
pylint
6668
black

0 commit comments

Comments
 (0)