Skip to content

Commit e0e1b94

Browse files
authored
Merge pull request #40 from jaladh-singhal/openuniverse-firefly
Add OpenUniverse2024 Firefly notebook and update other firefly notebooks
2 parents 56fa0e8 + 9568068 commit e0e1b94

File tree

6 files changed

+777
-29
lines changed

6 files changed

+777
-29
lines changed

.binder/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ ray
1414
s3fs
1515
firefly-client
1616
jupyter-firefly-extensions
17+
reproject
1718
# For supporting myst-based notebooks
1819
jupytext

index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ caption: Visualizations with Firefly
5656
5757
tutorials/firefly/SEDs_in_Firefly
5858
tutorials/firefly/NEOWISE_light_curve_demo
59+
tutorials/firefly/OpenUniverse2024Preview_Firefly
5960
6061
```
6162

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ requires =
99
description = run tests
1010

1111
setenv =
12+
FIREFLY_URL = https://irsa.ipac.caltech.edu/irsaviewer # fallback url for firefly notebooks if not defined in code
1213
devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/scientific-python-nightly-wheels/simple https://pypi.anaconda.org/astropy/simple
1314

1415
passenv = CI, CIRCLECI

tutorials/firefly/NEOWISE_light_curve_demo.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jupytext:
44
extension: .md
55
format_name: myst
66
format_version: 0.13
7-
jupytext_version: 1.16.2
7+
jupytext_version: 1.16.3
88
kernelspec:
99
display_name: Python 3 (ipykernel)
1010
language: python
@@ -19,7 +19,6 @@ By the end of this tutorial, you will:
1919

2020
- Construct a TAP query to download the necessary data and visualize it via the web browser with an instantiated Firefly environment.
2121
- Plot light curves from NEOWISE data using the Firefly Python API.
22-
- Format cells containing tables, charts and images viewed in the client.
2322
- Overlay a catalog of data onto a HiPS image.
2423

2524
+++
@@ -53,26 +52,23 @@ import astropy.utils.data
5352
import urllib.parse
5453
```
5554

56-
## Step 1
55+
## Instantiate the Firefly client
5756

58-
Instantiate the client and view it in a different tab in the web browser.
57+
There are two ways to initialize a Firefly client from Python, depending on whether you're running the notebook in JupyterLab or not. Assuming you have `jupyter-firefly-extensions` set up in your environment as explained [here](https://github.com/Caltech-IPAC/jupyter_firefly_extensions/blob/master/README.md), you can use `make_lab_client()` in JupyterLab, which will open the Firefly viewer in a new tab within the Lab. Otherwise, you can use `make_client()` in a Jupyter Notebook (or even a Python shell), which will open the Firefly viewer in a new web browser tab.
5958

60-
In this example, we use the IRSA Viewer - a public firefly server. The firefly server can also be run locally, e.g. via a Firefly Docker image obtained from https://hub.docker.com/r/ipac/firefly/tags/.
59+
You also need a Firefly server to communicate with your Firefly Python client. In this notebook, we use a public Firefly server: the IRSA Viewer (https://irsa.ipac.caltech.edu/irsaviewer). However, you can also run a local Firefly server via a [Firefly Docker image](https://hub.docker.com/r/ipac/firefly) and access it at `http://localhost:8080/firefly`. The URL of the Firefly server is read by both `make_client()` and `make_lab_client()` through the environment variable `FIREFLY_URL`. However, `make_client()` also allows you to pass the URL directly as the `url` parameter.
6160

6261
```{code-cell} ipython3
63-
url = 'https://irsa.ipac.caltech.edu/irsaviewer'
64-
# url='http://127.0.0.1:8080/firefly' # if you have firefly server running locally (preferably through docker)
62+
# Uncomment when using within Jupyter Lab with jupyter_firefly_extensions installed
63+
# fc = FireflyClient.make_lab_client()
6564
66-
fc = FireflyClient.make_client(url)
67-
```
68-
69-
You can re-initizialize the viewer to return to a clean state with [`reinit_viewer`](https://caltech-ipac.github.io/firefly_client/api/firefly_client.FireflyClient.html#firefly_client.FireflyClient.reinit_viewer).
65+
# Uncomment for contexts other than above
66+
fc = FireflyClient.make_client(url="https://irsa.ipac.caltech.edu/irsaviewer")
7067
71-
```{code-cell} ipython3
72-
# fc.reinit_viewer(); # The semi-colon suppresses the output of the method when ran
68+
fc.reinit_viewer() # to clean the state, if this cell ran earlier
7369
```
7470

75-
## Step 2
71+
## Construct a TAP Query and display the retrieved table in Firefly
7672

7773
TAP search the 'Known Solar System Object Possible Association List' catalog from the NEOWISE-R database. The specific target we are looking for is minor planet `558 Carmen`. We can query this target using a TAP search through IRSA; the `table_url` is broken down as follows:
7874

@@ -110,15 +106,15 @@ Note that along with the table, firefly also displays the coverage and chart ass
110106

111107
+++
112108

113-
## Step 3
109+
## Plot Light Curves in Firefly
114110

115111
After retrieving the data and displaying it in the client, we can now create a light curve by plotting the Modified Julian Date ('mjd') in the abscissa and the magnitude from band W1 ('w1mpro') in the ordinate. We also flip the ordinate to accurately display magnitude.
116112

117113
```{code-cell} ipython3
118114
fc.show_xyplot(tbl_id='tableneo', xCol='mjd', yCol='w1mpro', yOptions='flip')
119115
```
120116

121-
## Step 4
117+
## Overlay the catalog on a HiPS image
122118

123119
Finally, we can overlay the catalog of data in the table onto a HiPS image of our choice, using the method [`show_hips`](https://caltech-ipac.github.io/firefly_client/api/firefly_client.FireflyClient.html#firefly_client.FireflyClient.show_hips). However, this method requires target coordinates for the object you want to analyze.
124120

@@ -153,6 +149,6 @@ Firefly allows you to visualize data for specific targets. In conjuction with As
153149

154150
**Author:** Eric Bratton II (IRSA Scientist) in conjunction with the IRSA Science Team
155151

156-
**Updated:** 2024-10-17
152+
**Updated:** 2024-12-19
157153

158154
**Contact:** [the IRSA Helpdesk](https://irsa.ipac.caltech.edu/docs/help_desk.html) with questions or reporting problems.

0 commit comments

Comments
 (0)