Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into frb20210912A
Browse files Browse the repository at this point in the history
  • Loading branch information
profxj committed Jan 13, 2025
2 parents 0e4e56a + 0c100e7 commit 2880843
Show file tree
Hide file tree
Showing 342 changed files with 21,564 additions and 2,295 deletions.
85 changes: 85 additions & 0 deletions .github/ci_orig_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: CI Tests

on:
push:
branches:
- master
tags:
pull_request:

env:
SETUP_XVFB: True # avoid issues if mpl tries to open a GUI window

jobs:
ci-tests:
name: Python-${{ matrix.python }}, deps=${{ matrix.deps }}
runs-on: ${{ matrix.os }}
if: "!(contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]'))"

strategy:
matrix:
os: [ubuntu-latest]
python: ['3.11', '3.12']
deps: [current, numpy211, astropydev, numpydev, astropydev-numpydev]

steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
- name: Test with numpy = 2.1.1
if: "contains(matrix.deps, 'numpy211')"
run: |
python -m pip install numpy==2.1.1
- name: Test with dev version of numpy
if: "contains(matrix.deps, 'numpydev')"
run: |
python -m pip install git+https://github.com/numpy/numpy.git#egg=numpy
- name: Test with dev version astropy
if: "contains(matrix.deps, 'astropydev')"
run: |
python -m pip install git+https://github.com/astropy/astropy.git#egg=astropy
- name: Install frb requirements
run: |
python -m pip install wheel scipy IPython
python -m pip install git+https://github.com/FRBs/ne2001.git#egg=ne2001
python -m pip install git+https://github.com/FRBs/astropath.git#egg=astropath
python -m pip install git+https://github.com/linetools/linetools#egg=linetools
python -m pip install -r frb/requirements.txt
- name: Install numba
run: |
python -m pip install numba
- name: Install astroquery
run: |
python -m pip install astroquery
- name: Print Python, pip, astropy, numpy, and setuptools versions
run: |
python -c "import sys; print(f'Python {sys.version}')"
python -c "import pip; print(f'pip {pip.__version__}')"
python -c "import astropy; print(f'astropy {astropy.__version__}')"
python -c "import numpy; print(f'numpy {numpy.__version__}')"
python -c "import setuptools; print(f'setuptools {setuptools.__version__}')"
- name: Run tests
run: tox -e ${{ matrix.python }}-${{ matrix.toxenv }}

codestyle:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v2
- name: Python codestyle check
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pycodestyle
- name: Check for runtime errors using pycodestyle
run: |
pycodestyle frb --count --select=E9
68 changes: 10 additions & 58 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,81 +4,33 @@ on:
push:
branches:
- master
tags:
pull_request:

env:
SETUP_XVFB: True # avoid issues if mpl tries to open a GUI window
SETUP_XVFB: True # avoid issues if something tries to open a GUI window

jobs:
ci-tests:
name: Python-${{ matrix.python }}, deps=${{ matrix.deps }}
name: Tox env ${{ matrix.python }}-${{ matrix.toxenv }}
runs-on: ${{ matrix.os }}
if: "!(contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]'))"

strategy:
matrix:
os: [ubuntu-latest]
python: ['3.9','3.10']
deps: [current, numpy122, astropydev, numpydev, astropydev-numpydev]

python: ['3.11', '3.12']
toxenv: [test, test-astropydev]
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
- name: Test with numpy = 1.22
if: "contains(matrix.deps, 'numpy122')"
run: |
python -m pip install numpy==1.22
- name: Test with dev version of numpy
if: "contains(matrix.deps, 'numpydev')"
run: |
python -m pip install git+https://github.com/numpy/numpy.git#egg=numpy
- name: Test with dev version astropy
if: "contains(matrix.deps, 'astropydev')"
run: |
python -m pip install git+https://github.com/astropy/astropy.git#egg=astropy
- name: Install frb requirements
run: |
python -m pip install wheel scipy IPython
python -m pip install -r frb/requirements.txt --upgrade pip tox
python -m pip install git+https://github.com/FRBs/ne2001.git#egg=ne2001
python -m pip install git+https://github.com/FRBs/astropath.git#egg=astropath
python -m pip install -r frb/requirements.txt
- name: Install numba
run: |
python -m pip install numba
- name: Install astroquery
run: |
python -m pip install astroquery
- name: Print Python, pip, astropy, numpy, and setuptools versions
run: |
python -c "import sys; print(f'Python {sys.version}')"
python -c "import pip; print(f'pip {pip.__version__}')"
python -c "import astropy; print(f'astropy {astropy.__version__}')"
python -c "import numpy; print(f'numpy {numpy.__version__}')"
python -c "import setuptools; print(f'setuptools {setuptools.__version__}')"
- name: Run tests
run: python setup.py test

codestyle:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v2
- name: Python codestyle check
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pycodestyle
- name: Check for runtime errors using pycodestyle
python -m pip install git+https://github.com/linetools/linetools#egg=linetools
- name: Test with tox
run: |
pycodestyle frb --count --select=E9
tox -e ${{ matrix.python }}-${{ matrix.toxenv }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Galaxy_DB/
*.hdf5
.DS_Store
*.json
*.npz

# Tests
./pytest_cache
Expand Down
16 changes: 0 additions & 16 deletions bin/frb_mag_limit

This file was deleted.

8 changes: 4 additions & 4 deletions bin/frb_pz_dm → bin/frb_pzdm_mag
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@


"""
This script performs estimates P(z|DM)
This script performs estimates P(z|DM) and limiting mag
"""

from frb.scripts import pz_dm
from frb.scripts import pzdm_mag

if __name__ == '__main__':
args = pz_dm.parser()
pz_dm.main(args)
args = pzdm_mag.parser()
pzdm_mag.main(args)
19 changes: 10 additions & 9 deletions docs/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ We recommend that you use `Anaconda <https://www.continuum.io/downloads/>`_
to install and/or update these packages.

* `python <http://www.python.org/>`_ versions 3.8 or later
* `numpy <http://www.numpy.org/>`_ version 1.18 or later
* `astropy <http://www.astropy.org/>`_ version 4.5 or later
* `scipy <http://www.scipy.org/>`_ version 1.7 or later
* `healpy <https://healpy.readthedocs.io/en/latest/index.html>`_ version 1.12 or later
* `pandas <https://pandas.pydata.org/>`_ version 1.3 or later
* `numpy <http://www.numpy.org/>`_ version 2.1 or later
* `astropy <http://www.astropy.org/>`_ version 5.1 or later
* `scipy <http://www.scipy.org/>`_ version 1.11 or later
* `healpy <https://healpy.readthedocs.io/en/latest/index.html>`_ version 1.15 or later
* `pandas <https://pandas.pydata.org/>`_ version 1.5 or later
* `requests <https://pillow.readthedocs.io/en/5.3.x/>`_ version 2.18 or later
* `extinction <https://extinction.readthedocs.io/en/latest/>`_ version 0.4.2 or greater
* `matplotlib <https://matplotlib.org/>`_ version 3.3 or greater
* `dust_extinction <https://dust-extinction.readthedocs.io/en/latest/>`_
* `matplotlib <https://matplotlib.org/>`_ version 3.7 or greater
* `linetools <https://github.com/linetools/linetools>`_ version 0.3 or later
* `astropath <https://github.com/FRBs/astropath>`_ version 0.1 or later

Expand All @@ -47,7 +47,7 @@ out all the packages and their version numbers.
The following packages are required to access surveys (e.g. SDSS, DES)
for data that may be associated to an FRB:

* `astroquery <https://astroquery.readthedocs.io/en/latest/>`_ v0.4.4 only (maybe)
* `astroquery <https://astroquery.readthedocs.io/en/latest/>`_ v0.4.7 or later
* `datalab-client <https://github.com/noaodatalab/datalab/>`_ v2.20 or later
* `pyvo <https://pyvo.readthedocs.io/en/latest/>`_ version 0.9.2 or later

Expand All @@ -57,7 +57,8 @@ The following package(s) is/are required to access FRB galaxy spectra:

The following package is required to map a slit onto a finder chart (frb.figures.finder):

* `photutils <https://photutils.readthedocs.io/en/stable/>`_ version 1.2.0 or later
* `photutils <https://photutils.readthedocs.io/en/stable/>`_ version 1.11.0 or later
* `scikit-image <https://scikit-image.org/>`_ version 0.21.0 or later

The following are required to use our KCWI datacube handling tools:

Expand Down
33 changes: 33 additions & 0 deletions docs/mags_to_flux.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
*****************************
Magnitudes to flux conversion
*****************************

Most public photometry tables report brightness of objects
in terms of magnitudes as opposed to flux units (Jy or mJy).
However, using software such as CIGALE and EAZY is made
less ambiguous if fluxes are supplied. To enable this, we provide
the function `frb.surveys.catalog_utils.convert_mags_to_flux`

The definition for magnitude errors arises from the following
equation:

.. math::
m\pm \delta m = ZP-2.5 \log_{10}(f\pm \delta f)
\Rightarrow m = ZP-2.5 \log_{10}(f)
\Rightarrow \delta m = 2.5 \log_{10}(1+\delta f/f)
While the math:`\delta m` formula above is exact, most photometry
software use a first order Taylor expansion in math:`\delta f/f`
assuming the error is typically small. i.e.

.. math::
\delta m \approx \frac{2.5}{\log_{10}}(\delta f/f)
This will obviously break down when looking at really faint objects,
barely at the threshold of detection above the noise floor.
`convert_mags_to_flux` explicitly assumes the catalog mag errors are
produced using this approximation. However, if you have reason to believe
the exact formula was used, you can set `exact_mag_err=True` to get the
correct flux error.
14 changes: 2 additions & 12 deletions docs/nb/DM_cosmic.ipynb

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions docs/nb/FRB_Galaxies.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 2880843

Please sign in to comment.