Skip to content

Commit c63d984

Browse files
Homogenise how to instantiate firefly in all 3 notebooks
And headings cleanup in NEOWISE LCs notebook
1 parent f4e3abf commit c63d984

File tree

3 files changed

+32
-29
lines changed

3 files changed

+32
-29
lines changed

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.

tutorials/firefly/OpenUniverse2024Preview_Firefly.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,18 @@ Clearly, the simulated Roman coadd has higher spatial resolution than the Rubin
373373
+++
374374

375375
### Launch and initialize Firefly
376+
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.
377+
378+
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.
376379

377380
```{code-cell} ipython3
378-
fc = FireflyClient.make_client()
381+
# Uncomment when using within Jupyter Lab with jupyter_firefly_extensions installed
382+
# fc = FireflyClient.make_lab_client()
383+
384+
# Uncomment for contexts other than above
385+
fc = FireflyClient.make_client(url="https://irsa.ipac.caltech.edu/irsaviewer")
379386
380-
fc.reinit_viewer() #to clean the state, if this cell ran earlier
387+
fc.reinit_viewer() # to clean the state, if this cell ran earlier
381388
```
382389

383390
### Send the simulated Rubin coadd to Firefly using show_fits.
@@ -738,6 +745,6 @@ fc.set_stretch(plot_id=coadd_ff_id_roman_3color, stype='sigma', algorithm='squar
738745

739746
**Author:** Jaladh Singhal and Vandana Desai in conjunction with the IRSA Team
740747

741-
**Updated:** 2024-12-18
748+
**Updated:** 2024-12-19
742749

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

tutorials/firefly/SEDs_in_Firefly.md

Lines changed: 9 additions & 9 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
@@ -62,8 +62,6 @@ The packages needed for this notebook are in the `requirements.txt` file. They c
6262
* _numpy_ - for working with arrays
6363
* _pyvo_ - for queries to Virtual Observatory services at the archives
6464

65-
+++
66-
6765
```{code-cell} ipython3
6866
# Uncomment the next line to install dependencies if needed.
6967
# !pip install numpy astropy pyvo firefly_client
@@ -551,16 +549,18 @@ phot_tbl
551549

552550
+++
553551

554-
This notebook assumes that [jupyter_firefly_extensions](https://github.com/Caltech-IPAC/jupyter_firefly_extensions) has been installed, and that the Firefly server to use has been specified before Jupyterlab was started.
552+
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.
555553

556-
If everything has been properly configured, executing the next cell will bring up a Firefly tab in Jupyterlab with the welcome message.
554+
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.
557555

558556
```{code-cell} ipython3
559-
# Uncomment to use the jupyter_firefly_extensions
560-
#fc = FireflyClient.make_lab_client()
557+
# Uncomment when using within Jupyter Lab with jupyter_firefly_extensions installed
558+
# fc = FireflyClient.make_lab_client()
561559
562-
# Uncomment to use a separate web browser tab
560+
# Uncomment for contexts other than above
563561
fc = FireflyClient.make_client(url="https://irsa.ipac.caltech.edu/irsaviewer")
562+
563+
fc.reinit_viewer() # to clean the state, if this cell ran earlier
564564
```
565565

566566
In the event that there are problems with the tab opened above, run the below command to obtain a web link that can be opened in a browser directly:
@@ -703,6 +703,6 @@ Note that zooming or panning one image will do the same in the other images as w
703703

704704
**Author:** David Shupe (IRSA Scientist) and Joyce Kim (IRSA Scientist) in conjunction with the IRSA Science Team
705705

706-
**Updated:** 2024-12-18
706+
**Updated:** 2024-12-19
707707

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

0 commit comments

Comments
 (0)