Skip to content

Commit

Permalink
Merge branch 'develop' into staged
Browse files Browse the repository at this point in the history
  • Loading branch information
kbwestfall committed Aug 12, 2021
2 parents 5b88ee9 + 247e2d3 commit 4e2c3e1
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 7 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,44 @@ jobs:
run: |
tox -e ${{ matrix.toxenv }}
centos:
# Some PypeIt users have to run under CentOS and have run into unique issues. GitHub Actions does not
# provide CentOS as a runtime environment like it does Ubuntu. However, it can be used by running
# it as a container within a provided Ubuntu environment.
name: CentOS ${{ matrix.centos_ver }} ${{ matrix.toxenv }}
runs-on: ubuntu-latest

strategy:
matrix:
# Test both CentOS 7 and 8
centos_ver: [7, 8]
# Test both pip and conda for installing dependencies
toxenv: [test-alldeps, conda]

container:
image: "centos:${{ matrix.centos_ver }}"

steps:
- name: Install base CentOS dependencies
run: |
yum update -y && yum install -y wget git gcc
- name: Check out repository
uses: actions/checkout@v1
with:
fetch-depth: 0
- name: Install and configure miniconda
run: |
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash ./miniconda.sh -b -p /conda
/conda/bin/conda update -y --all
/conda/bin/conda init
- name: Install base dependencies
run: |
source ~/.bashrc && python -m pip install --upgrade pip tox && python --version
- name: Test with tox
run: |
source ~/.bashrc && tox -e ${{ matrix.toxenv }}
codestyle:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ dependencies:
- ginga>=3.0
- qtpy>=1.9
- pytest>=3.0.7
- bottleneck>=1.3
- bottleneck
- pip
- linetools>=0.3dev2231
7 changes: 5 additions & 2 deletions pypeit/core/skysub.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def optimal_bkpts(bkpts_optimal, bsp_min, piximg, sampmask, samp_frac=0.80,
def local_skysub_extract(sciimg, sciivar, tilts, waveimg, global_sky, rn2_img,
thismask, slit_left, slit_righ, sobjs, ingpm=None,
spat_pix=None, adderr=0.01, bsp=0.6, trim_edg=(3,3),
std=False, prof_nsigma=None, niter=4, box_rad=7, sigrej=3.5, bkpts_optimal=True,
std=False, prof_nsigma=None, niter=4, extract_good_frac=0.005, box_rad=7, sigrej=3.5, bkpts_optimal=True,
debug_bkpts=False, force_gauss=False, sn_gauss=4.0, model_full_slit=False, model_noise=True, show_profile=False,
show_resids=False, use_2dmodel_mask=True, no_local_sky=False):
"""Perform local sky subtraction and extraction
Expand Down Expand Up @@ -535,6 +535,8 @@ def local_skysub_extract(sciimg, sciivar, tilts, waveimg, global_sky, rn2_img,
exponential at large distances from the trace.
niter: int, default = 4
Number of iterations for successive profile fitting and local sky-subtraction
extract_good_frac: float, default = 0.005
Minimum fraction of pixels along the spectral direction with good optimal extraction
box_rad: int or float, default = 7
Boxcar radius in *pixels* used for boxcar extraction.
sigrej:
Expand Down Expand Up @@ -735,7 +737,8 @@ def local_skysub_extract(sciimg, sciivar, tilts, waveimg, global_sky, rn2_img,
last_profile, box_rad, sobjs[iobj])
# If the extraction is bad do not update
if sobjs[iobj].OPT_MASK is not None:
if sobjs[iobj].OPT_MASK.any():
# if there is only one good pixel `extract.fit_profile` fails
if np.sum(sobjs[iobj].OPT_MASK) > extract_good_frac * nspec:
flux = sobjs[iobj].OPT_COUNTS
fluxivar = sobjs[iobj].OPT_COUNTS_IVAR*sobjs[iobj].OPT_MASK
wave = sobjs[iobj].OPT_WAVE
Expand Down
3 changes: 2 additions & 1 deletion pypeit/core/wavecal/autoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -1431,8 +1431,9 @@ def __init__(self, spec, par = None, ok_mask=None, islinelist=False,
self._line_lists = line_lists_all[np.where(line_lists_all['ion'] != 'UNKNWN')]
self._unknwns = line_lists_all[np.where(line_lists_all['ion'] == 'UNKNWN')]
else:
restrict = spectrograph if self._par['use_instr_flag'] else None
self._line_lists = waveio.load_line_lists(
self._lines, restrict_on_instr=spectrograph)
self._lines, restrict_on_instr=restrict)
self._unknwns = waveio.load_unknown_list(self._lines)

if self._use_unknowns:
Expand Down
2 changes: 1 addition & 1 deletion pypeit/core/wavecal/waveio.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def load_line_lists(lines, unknown=False, skip=False, all=False, NIST=False,
line_lists = vstack(lists, join_type='exact')

# Restrict on the spectrograph?
if restrict_on_instr:
if restrict_on_instr is not None:
instr_dict = defs.instruments()
gdI = (line_lists['Instr'] & instr_dict[restrict_on_instr]) > 0
line_lists = line_lists[gdI]
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ install_requires =
ginga>=3.0
linetools
qtpy>=1.9
bottleneck>=1.3
bottleneck
scripts =
bin/pypeit_c_enabled
bin/pypeit_chk_plugins
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ commands = pycodestyle pypeit --count --select=E9

[testenv:conda]
description = run tests in environment created via conda
deps = tox-conda
requires = tox-conda
conda_deps = numpy,astropy,scipy,bottleneck
conda_env = {toxinidir}/environment.yml
commands = pytest --pyargs pypeit {posargs}

0 comments on commit 4e2c3e1

Please sign in to comment.