Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip installable package #54

Merged
merged 35 commits into from
Dec 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
de99751
adding top-level files
weaverba137 Dec 1, 2020
5250834
working in README
weaverba137 Dec 1, 2020
61a580b
rename README
weaverba137 Dec 1, 2020
9c83c2a
add setup.py
weaverba137 Dec 1, 2020
05f80f2
move data files inside package
weaverba137 Dec 1, 2020
c22f90c
add test directory
weaverba137 Dec 1, 2020
49a10b6
add docs
weaverba137 Dec 1, 2020
ab776b0
add doc config
weaverba137 Dec 1, 2020
e2e27fd
add readthedocs config
weaverba137 Dec 1, 2020
ea7153c
rename utilities
weaverba137 Dec 1, 2020
5f842d5
rename utilities
weaverba137 Dec 1, 2020
4dd5b2c
add test placeholder
weaverba137 Dec 1, 2020
5009a98
cleaning up scripts
weaverba137 Dec 1, 2020
af13e97
move old per_expo file
weaverba137 Dec 1, 2020
111bd89
update imports
weaverba137 Dec 1, 2020
56ee1e8
clean up documentation
weaverba137 Dec 1, 2020
f0b1912
use package resources wherever possible
weaverba137 Dec 2, 2020
cb18474
add GitHub actions
weaverba137 Dec 9, 2020
9ed8e83
workflow syntax
weaverba137 Dec 9, 2020
00476b4
additional actions
weaverba137 Dec 9, 2020
2c2da10
workflow syntax
weaverba137 Dec 9, 2020
2aa3e29
fix missing doc imports
weaverba137 Dec 9, 2020
b266b4c
trying to simplify matrix
weaverba137 Dec 9, 2020
50013d8
add coveralls
weaverba137 Dec 9, 2020
17b7cc6
different coverage call
weaverba137 Dec 9, 2020
f9edaab
working on coveralls
weaverba137 Dec 9, 2020
e2c34e8
update README
weaverba137 Dec 9, 2020
f9ffa6d
update rtd path
weaverba137 Dec 9, 2020
222da53
badge for branch
weaverba137 Dec 9, 2020
b75f6ea
specutils provides scipy
weaverba137 Dec 9, 2020
80c17dc
remove unused var
weaverba137 Dec 11, 2020
6efb6fd
shorten test names
weaverba137 Dec 11, 2020
658abf3
Notebooks update: Prospect_targetid, the most useful one, is up-to-da…
armengau Dec 15, 2020
fb46ac1
Partial update of Prospect_demo notebook
armengau Dec 15, 2020
12e69fb
Prospect_demo notebook updated
armengau Dec 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[run]
source = py/prospect
omit =
py/prospect/_version.py
py/prospect/conftest*
py/prospect/cython_version*
py/prospect/setup_package*
py/prospect/*/setup_package*
py/prospect/*/*/setup_package*
py/prospect/sphinx/*
py/prospect/test/*
py/prospect/*/test/*
py/prospect/*/*/test/*

[report]
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about packages we have installed
except ImportError

# Don't complain if tests don't hit assertions
raise AssertionError
raise NotImplementedError

# Don't complain about script hooks
def main\(.*\):
115 changes: 115 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Workflow is based on the Astropy GitHub actions workflow, ci_workflows.yml
name: CI

on:
push:
branches:
- '*'
tags:
- '*'
pull_request:

jobs:
tests:
name: Unit tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
python-version: [3.6, 3.7, 3.8]

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run the test
run: pytest

coverage:
name: Test coverage
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
python-version: [3.8]

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install pytest pytest-cov coveralls
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run the test with coverage
run: pytest --cov
- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls

docs:
name: Doc test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.8]

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: python -m pip install --upgrade pip wheel Sphinx
- name: Test the documentation
run: sphinx-build -W --keep-going -b html doc doc/_build/html

style:
name: Style check
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.8]

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: python -m pip install --upgrade pip wheel pycodestyle
- name: Test the style; failures are allowed
# This is equivalent to an allowed falure.
continue-on-error: true
run: pycodestyle --count py/prospect
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# Compiled files
*.py[cod]
__pycache__
*.py[co]

# Other generated files
htmlcov
.coverage
py/prospect/.cache
.pytest_cache

# Sphinx
doc/api
doc/_build

# iPython
docs/nb/.ipynb_checkpoints
doc/nb/.ipynb_checkpoints
.ipynb_checkpoints

# Packages/installer info
Expand All @@ -20,12 +22,14 @@ docs/nb/.ipynb_checkpoints
dist
build
eggs
.eggs
parts
var
sdist
develop-eggs
.installed.cfg
distribute-*.tar.gz
MANIFEST

# Other
.*.swp
Expand Down
18 changes: 18 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the doc/ directory with Sphinx
sphinx:
configuration: doc/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3
# system_packages: true
2 changes: 1 addition & 1 deletion LICENSE.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014-2017, DESI Collaboration <desi-data@desi.lbl.gov>
Copyright (c) 2018-2020, DESI Collaboration <desi-data@desi.lbl.gov>
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
12 changes: 12 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include LICENSE.rst
include README.rst
include requirements.txt

graft bin
graft doc
graft etc

prune build
prune dist
prune htmlcov
prune doc/_build
49 changes: 0 additions & 49 deletions README.md

This file was deleted.

75 changes: 75 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
========
prospect
========
Digging into DESI spectra, looking for stuff.
---------------------------------------------

|Actions Status| |Coveralls Status| |Documentation Status|

This repository is a rewrite of inspector_, which itself is very much a work
in progress. This repository is intended to provide similar functionality
as inspector, but do so without using ipywidgets so that it can be used as
standalone code outside of Jupyter notebooks, while still also working within
Jupyter notebooks.

.. image:: screenshot.png
:alt: Prospect Screenshot

.. _inspector: https://github.com/desihub/inspector

.. |Actions Status| image:: https://github.com/desihub/prospect/workflows/CI/badge.svg
:target: https://github.com/desihub/prospect/actions
:alt: GitHub Actions CI Status

.. |Coveralls Status| image:: https://coveralls.io/repos/desihub/prospect/badge.svg?branch=pip-installable-package
:target: https://coveralls.io/github/desihub/prospect?branch=pip-installable-package
:alt: Test Coverage Status

.. |Documentation Status| image:: https://readthedocs.org/projects/desi-prospect/badge/?version=latest
:target: http://desi-prospect.readthedocs.org/en/latest/
:alt: Documentation Status

What it does
~~~~~~~~~~~~

* Provides an interactive spectral viewer for DESI data at NERSC without
needing to download or install anything locally.
* Interative zoom and pan
* Shows noise estimated for each spectrum.
* Shows redrock results including the redshift, ZWARN flags, and the
best fit model.
* Mouse over a region of the spectrum to get a real-time zoom in a sub-window;
this is handy for inspecting narrow emission lines without zooming in and out
on each one.
* Shows TARGETID and targeting bits from DESI_TARGET, MWS_TARGET,
and BGS_TARGET.
* Highlight common emission / absorption lines.
* Display imaging of target.
* Buttons for saving visual inspection results before moving to next target.

Added here but not in the original inspector
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Restframe wavelengths
* User-defined smoothing
* User-defined redshift
* Viewing spectra that don't yet have redshift fits

What it doesn't do (yet)
~~~~~~~~~~~~~~~~~~~~~~~~

Any of these could be added later but don't yet exist.
If you really want a feature, please consider contributing it.

* Show individual exposures (multiple exposures are coadded prior to display)
* Show masks
* Show the Nth best fit instead of just the best fit
* More target info like mags and shapes
* Displaying model of 2D sky-subtracted raw data
* Filtering to individual exposures or tiles

-----

:Eric Armengaud: Saclay - CEA
:Stephen Bailey: Lawrence Berkeley National Lab
:Benjamin Weaver: NSF's National Optical-Infrared Astronomy Research Laboratory
19 changes: 5 additions & 14 deletions bin/run_cmx_htmlfiles
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
#!/usr/bin/env python
#
# See top-level LICENSE.rst file for Copyright information
#

"""
Write html index pages from existing static pages/images produced by other scripts
"""

import prospect.scripts.prepare_cmx_htmlfiles as prepare_cmx_htmlfiles

if __name__ == '__main__':
args = prepare_cmx_htmlfiles.parse()
prepare_cmx_htmlfiles.main(args)

# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from sys import exit
from prospect.scripts.prepare_cmx_htmlfiles import main
exit(main())
19 changes: 5 additions & 14 deletions bin/run_htmlfiles
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
#!/usr/bin/env python
#
# See top-level LICENSE.rst file for Copyright information
#

"""
Write html index pages from existing static pages/images produced by other scripts
"""

import prospect.scripts.prepare_htmlfiles as prepare_htmlfiles

if __name__ == '__main__':
args = prepare_htmlfiles.parse()
prepare_htmlfiles.main(args)

# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from sys import exit
from prospect.scripts.prepare_htmlfiles import main
exit(main())