Skip to content

Commit

Permalink
Merge branch 'develop' into order_sync
Browse files Browse the repository at this point in the history
  • Loading branch information
kbwestfall committed Aug 30, 2024
2 parents 0665fee + bd77c38 commit 1fed401
Show file tree
Hide file tree
Showing 50 changed files with 682 additions and 224 deletions.
50 changes: 50 additions & 0 deletions deprecated/arc_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,3 +855,53 @@ def saturation_mask(a, satlevel):

return mask.astype(int)

def mask_around_peaks(spec, inbpm):
"""
Find peaks in the input spectrum and mask pixels around them.
All pixels to the left and right of a peak is masked until
a pixel has a lower value than the adjacent pixel. At this
point, we assume that spec has reached the noise level.
Parameters
----------
spec: `numpy.ndarray`_
Spectrum (1D array) in counts
inbpm: `numpy.ndarray`_
Input bad pixel mask
Returns
-------
outbpm: `numpy.ndarray`_
Bad pixel mask with pixels around peaks masked
"""
# Find the peak locations
pks = detect_peaks(spec)

# Initialise some useful variables and the output bpm
xarray = np.arange(spec.size)
specdiff = np.append(np.diff(spec), 0.0)
outbpm = inbpm.copy()

# Loop over the peaks and mask pixels around them
for i in range(len(pks)):
# Find all pixels to the left of the peak that are above the noise level
wl = np.where((xarray <= pks[i]) & (specdiff > 0.0))[0]
ww = (pks[i]-wl)[::-1]
# Find the first pixel to the left of the peak that is below the noise level
nmask = np.where(np.diff(ww) > 1)[0]
if nmask.size != 0 and nmask[0] > 5:
# Mask all pixels to the left of the peak
mini = max(0,wl.size-nmask[0]-1)
outbpm[wl[mini]:pks[i]] = True
# Find all pixels to the right of the peak that are above the noise level
ww = np.where((xarray >= pks[i]) & (specdiff < 0.0))[0]
# Find the first pixel to the right of the peak that is below the noise level
nmask = np.where(np.diff(ww) > 1)[0]
if nmask.size != 0 and nmask[0] > 5:
# Mask all pixels to the right of the peak
maxi = min(nmask[0], ww.size)
outbpm[pks[i]:ww[maxi]+2] = True
# Return the output bpm
return outbpm

8 changes: 8 additions & 0 deletions doc/api/pypeit.spectrographs.aat_uhrf.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pypeit.spectrographs.aat\_uhrf module
=====================================

.. automodule:: pypeit.spectrographs.aat_uhrf
:members:
:private-members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions doc/api/pypeit.spectrographs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Submodules
.. toctree::
:maxdepth: 4

pypeit.spectrographs.aat_uhrf
pypeit.spectrographs.bok_bc
pypeit.spectrographs.gemini_flamingos
pypeit.spectrographs.gemini_gmos
Expand Down
3 changes: 2 additions & 1 deletion doc/cookbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ what we recommend:
- We will refer to that folder as ``RAWDIR``

The raw images can be gzip-compressed, although this means opening files will be
slower.
slower. See :ref:`setup-file-searching` for specific comments about the files
in your raw directory.

A word on calibration data
--------------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/help/pypeit_cache_github_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Script to download/cache PypeIt github data
positional arguments:
spectrograph A valid spectrograph identifier: bok_bc,
spectrograph A valid spectrograph identifier: aat_uhrf, bok_bc,
gemini_flamingos1, gemini_flamingos2,
gemini_gmos_north_e2v, gemini_gmos_north_ham,
gemini_gmos_north_ham_ns, gemini_gmos_south_ham,
Expand Down
9 changes: 6 additions & 3 deletions doc/help/pypeit_chk_for_calibs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
options:
-h, --help show this help message and exit
-s SPECTROGRAPH, --spectrograph SPECTROGRAPH
A valid spectrograph identifier: bok_bc,
A valid spectrograph identifier: aat_uhrf, bok_bc,
gemini_flamingos1, gemini_flamingos2,
gemini_gmos_north_e2v, gemini_gmos_north_ham,
gemini_gmos_north_ham_ns, gemini_gmos_south_ham,
Expand All @@ -35,8 +35,11 @@
vlt_xshooter_nir, vlt_xshooter_uvb, vlt_xshooter_vis,
wht_isis_blue, wht_isis_red (default: None)
-e EXTENSION, --extension EXTENSION
File extension; compression indicators (e.g. .gz) not
required. (default: .fits)
File extension to use. Must include the period (e.g.,
".fits") and it must be one of the allowed extensions
for this spectrograph. If None, root directory will be
searched for all files with any of the allowed
extensions. (default: None)
--save_setups If not toggled, remove setup_files/ folder and its
files. (default: False)
9 changes: 6 additions & 3 deletions doc/help/pypeit_obslog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using PypeItMetaData.
positional arguments:
spec A valid spectrograph identifier: bok_bc,
spec A valid spectrograph identifier: aat_uhrf, bok_bc,
gemini_flamingos1, gemini_flamingos2,
gemini_gmos_north_e2v, gemini_gmos_north_ham,
gemini_gmos_north_ham_ns, gemini_gmos_south_ham,
Expand Down Expand Up @@ -75,8 +75,11 @@
-s SORT, --sort SORT Metadata keyword (pypeit-specific) to use to sort the
output table. (default: mjd)
-e EXTENSION, --extension EXTENSION
File extension; compression indicators (e.g. .gz) not
required. (default: .fits)
File extension to use. Must include the period (e.g.,
".fits") and it must be one of the allowed extensions
for this spectrograph. If None, root directory will be
searched for all files with any of the allowed
extensions. (default: None)
-d OUTPUT_PATH, --output_path OUTPUT_PATH
Path to top-level output directory. (default: current
working directory)
Expand Down
2 changes: 1 addition & 1 deletion doc/help/pypeit_ql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Script to produce quick-look PypeIt reductions
positional arguments:
spectrograph A valid spectrograph identifier: bok_bc,
spectrograph A valid spectrograph identifier: aat_uhrf, bok_bc,
gemini_flamingos1, gemini_flamingos2,
gemini_gmos_north_e2v, gemini_gmos_north_ham,
gemini_gmos_north_ham_ns, gemini_gmos_south_ham,
Expand Down
9 changes: 6 additions & 3 deletions doc/help/pypeit_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
options:
-h, --help show this help message and exit
-s SPECTROGRAPH, --spectrograph SPECTROGRAPH
A valid spectrograph identifier: bok_bc,
A valid spectrograph identifier: aat_uhrf, bok_bc,
gemini_flamingos1, gemini_flamingos2,
gemini_gmos_north_e2v, gemini_gmos_north_ham,
gemini_gmos_north_ham_ns, gemini_gmos_south_ham,
Expand Down Expand Up @@ -39,8 +39,11 @@
--extension option to set the types of files to search
for. (default: current working directory)
-e EXTENSION, --extension EXTENSION
File extension; compression indicators (e.g. .gz) not
required. (default: .fits)
File extension to use. Must include the period (e.g.,
".fits") and it must be one of the allowed extensions
for this spectrograph. If None, root directory will be
searched for all files with any of the allowed
extensions. (default: None)
-d OUTPUT_PATH, --output_path OUTPUT_PATH
Path to top-level output directory. (default: current
working directory)
Expand Down
20 changes: 10 additions & 10 deletions doc/help/pypeit_trace_edges.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
default mosaic. (default: None)
-s SPECTROGRAPH, --spectrograph SPECTROGRAPH
A valid spectrograph identifier, which is only used if
providing files directly: bok_bc, gemini_flamingos1,
gemini_flamingos2, gemini_gmos_north_e2v,
gemini_gmos_north_ham, gemini_gmos_north_ham_ns,
gemini_gmos_south_ham, gemini_gnirs_echelle,
gemini_gnirs_ifu, gtc_maat, gtc_osiris, gtc_osiris_plus,
jwst_nircam, jwst_nirspec, keck_deimos, keck_esi,
keck_hires, keck_kcrm, keck_kcwi, keck_lris_blue,
keck_lris_blue_orig, keck_lris_red, keck_lris_red_mark4,
keck_lris_red_orig, keck_mosfire, keck_nires,
keck_nirspec_high, keck_nirspec_high_old,
providing files directly: aat_uhrf, bok_bc,
gemini_flamingos1, gemini_flamingos2,
gemini_gmos_north_e2v, gemini_gmos_north_ham,
gemini_gmos_north_ham_ns, gemini_gmos_south_ham,
gemini_gnirs_echelle, gemini_gnirs_ifu, gtc_maat,
gtc_osiris, gtc_osiris_plus, jwst_nircam, jwst_nirspec,
keck_deimos, keck_esi, keck_hires, keck_kcrm, keck_kcwi,
keck_lris_blue, keck_lris_blue_orig, keck_lris_red,
keck_lris_red_mark4, keck_lris_red_orig, keck_mosfire,
keck_nires, keck_nirspec_high, keck_nirspec_high_old,
keck_nirspec_low, lbt_luci1, lbt_luci2, lbt_mods1b,
lbt_mods1r, lbt_mods2b, lbt_mods2r, ldt_deveny,
magellan_fire, magellan_fire_long, magellan_mage,
Expand Down
2 changes: 1 addition & 1 deletion doc/help/pypeit_view_fits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
View FITS files with ginga
positional arguments:
spectrograph A valid spectrograph identifier: bok_bc,
spectrograph A valid spectrograph identifier: aat_uhrf, bok_bc,
gemini_flamingos1, gemini_flamingos2,
gemini_gmos_north_e2v, gemini_gmos_north_ham,
gemini_gmos_north_ham_ns, gemini_gmos_south_ham,
Expand Down
10 changes: 5 additions & 5 deletions doc/help/run_pypeit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
## PypeIt : The Python Spectroscopic Data Reduction Pipeline v1.16.1.dev336+gdf3013372.d20240827
##
## Available spectrographs include:
## bok_bc, gemini_flamingos1, gemini_flamingos2, gemini_gmos_north_e2v,
## gemini_gmos_north_ham, gemini_gmos_north_ham_ns,
## gemini_gmos_south_ham, gemini_gnirs_echelle, gemini_gnirs_ifu,
## gtc_maat, gtc_osiris, gtc_osiris_plus, jwst_nircam, jwst_nirspec,
## keck_deimos, keck_esi, keck_hires, keck_kcrm, keck_kcwi,
## aat_uhrf, bok_bc, gemini_flamingos1, gemini_flamingos2,
## gemini_gmos_north_e2v, gemini_gmos_north_ham,
## gemini_gmos_north_ham_ns, gemini_gmos_south_ham, gemini_gnirs_echelle,
## gemini_gnirs_ifu, gtc_maat, gtc_osiris, gtc_osiris_plus, jwst_nircam,
## jwst_nirspec, keck_deimos, keck_esi, keck_hires, keck_kcrm, keck_kcwi,
## keck_lris_blue, keck_lris_blue_orig, keck_lris_red,
## keck_lris_red_mark4, keck_lris_red_orig, keck_mosfire, keck_nires,
## keck_nirspec_high, keck_nirspec_high_old, keck_nirspec_low, lbt_luci1,
Expand Down
1 change: 1 addition & 0 deletions doc/include/inst_detector_table.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
============================ === ======== ======== ======== ======== ========================== ====================== ======== ======== ============ ========= ==========
Instrument Det specaxis specflip spatflip namp gain RN darkcurr min sat nonlinear platescale
============================ === ======== ======== ======== ======== ========================== ====================== ======== ======== ============ ========= ==========
``aat_uhrf`` 1 0 False False 1 1.0 0.0 0.0 -1.0e+10 65535.0 0.7600 0.0500
``bok_bc`` 1 1 False False 1 1.5 3.0 5.4 -1.0e+10 65535.0 1.0000 0.2000
``gemini_flamingos1`` 1 0 False False 1 3.8 6.0 1080.0 -1.0e+10 320000.0 0.8750 0.1500
``gemini_flamingos2`` 1 0 True False 1 4.44 5.0 1800.0 -1.0e+10 700000.0 1.0000 0.1787
Expand Down
1 change: 1 addition & 0 deletions doc/include/spectrographs_table.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
======================== ============================================================================ ========= ============ =============================================================================================================================== ========= ========= ========= ===============================================================================================
``PypeIt`` Name ``PypeIt`` Class Telescope Camera URL Pipeline Supported QL Tested Comments
======================== ============================================================================ ========= ============ =============================================================================================================================== ========= ========= ========= ===============================================================================================
aat_uhrf :class:`~pypeit.spectrographs.aat_uhrf.AATUHRFSpectrograph` AAT UHRF `Link <https://aat.anu.edu.au/science/instruments/decomissioned/uhrf/overview>`__ MultiSlit True False
bok_bc :class:`~pypeit.spectrographs.bok_bc.BokBCSpectrograph` BOK BC `Link <http://james.as.arizona.edu/~psmith/90inch/90inch.html>`__ MultiSlit True False Bok B&C spectrometer
gemini_flamingos1 :class:`~pypeit.spectrographs.gemini_flamingos.GeminiFLAMINGOS1Spectrograph` GEMINI-S FLAMINGOS `Link <https://www.gemini.edu/instrumentation/flamingos-2>`__ MultiSlit False False
gemini_flamingos2 :class:`~pypeit.spectrographs.gemini_flamingos.GeminiFLAMINGOS2Spectrograph` GEMINI-S FLAMINGOS `Link <https://www.gemini.edu/instrumentation/flamingos-2>`__ MultiSlit True False Flamingos-2 NIR spectrograph
Expand Down
Loading

0 comments on commit 1fed401

Please sign in to comment.