|
| 1 | +# SPHEREx Source Discovery Tool |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +The SPHEREx Source Discovery Tool is the Python package `spherex_source_discovery_tool` (included in this directory), which is used to discover and extract sources from SPHEREx Spectral Images and visualize their spectra. |
| 6 | +The notebook [](spherex_source_discovery_tool_demo.md) demonstrates how to use it. |
| 7 | + |
| 8 | +### Directory Contents |
| 9 | + |
| 10 | +- `spherex_source_discovery_tool_demo.md`: Demo notebook. |
| 11 | +- `conda-spherex_sdt.yml`: Conda environment definition file. |
| 12 | +- `spherex_source_discovery_tool/`: Python package, including functions and configuration files to extract and visualize sources. |
| 13 | + - Python modules |
| 14 | + - `aperture_photometry.py`: Functions adapted from Zafar Rustamkulov to perform aperture photometry. |
| 15 | + - `bokeh_viz.py`: Functions for dynamic `bokeh` visualizations. |
| 16 | + - `firefly_viz.py`: Functions for `Firefly` visualizations. |
| 17 | + - `source_extraction.py`: Functions to work with SExtractor. |
| 18 | + - `sdt_utils.py`: Miscellaneous utility functions for working with IRSA tables and SPHEREx image headers. |
| 19 | + - SExtractor files |
| 20 | + - `default.conv`: Convolution mask used as detection filter. |
| 21 | + - `default.nnw`: Table of neural-network weights for star/galaxy separation. |
| 22 | + - `default_sdt.sex`: SExtractor default config file. Specifies catalog, extraction, photometry, etc. options. |
| 23 | + - `default_sdt.param`: SExtractor default parameters file. Specifies columns to include in output SExtractor catalog. |
| 24 | + |
| 25 | +## Setup |
| 26 | + |
| 27 | +### On local machine |
| 28 | + |
| 29 | +All necessary packages and tools (SExtractor) are listed in the `conda-spherex_sdt.yml` file. |
| 30 | + |
| 31 | +To create a conda environment with the dependencies on your local machine use: |
| 32 | + ``` |
| 33 | + conda env create --file conda-spherex_sdt.yml |
| 34 | + ``` |
| 35 | + |
| 36 | +Then, make the environment available in the list of kernels for your JupyterLab: |
| 37 | + ``` |
| 38 | + conda activate spherex_sdt |
| 39 | + python -m ipykernel install --user --name=spherex_sdt |
| 40 | + ``` |
| 41 | + |
| 42 | +To use the environment in your Jupyter notebooks, either start JupyterLab in that environment by typing |
| 43 | + |
| 44 | +``` |
| 45 | +conda activate spherex_sdt |
| 46 | +jupyter-lab |
| 47 | +``` |
| 48 | + |
| 49 | +or select the environment `spherex_sdt` in your Jupyter Notebook using the dropdown on the upper left. |
| 50 | + |
| 51 | +### On Fornax |
| 52 | + |
| 53 | +Installing the conda environment on the [NASA Fornax Science Console](https://science.nasa.gov/astrophysics/programs/physics-of-the-cosmos/community/the-fornax-initiative/) needs slightly different steps. These can be reviewed in the documentation [create a new environment](https://docs.fornax.sciencecloud.nasa.gov/compute-environments/#create-new-env). |
| 54 | + |
| 55 | +In order to install this specific conda environment on Fornax, the file name of the `yml` file specifically needs to be in the following format `conda-*.yml`. The `yml` file distributed here is already in that format (`conda-spherex_sdt.yml`). Once this is set, open a new terminal (click on the large "+" button right under the "File" menu tab) and type to following command _inside_ the same directory where the `yml` file is located: |
| 56 | + ``` |
| 57 | + setup-conda-env --user |
| 58 | + ``` |
| 59 | + |
| 60 | +Note that we use the `--user` option here, which will keep the environment available for subsequent Fornax sessions. |
| 61 | + |
| 62 | +To use the environment in your Jupyter notebooks on Fornax, directly select the environment `spherex_sdt` in your Jupyter Notebook using the dropdown on the upper left. |
0 commit comments