Skip to content

SPHEREx Mosaic Tool#311

Open
afaisst wants to merge 5 commits into
mainfrom
spherexmosaic_tutorial_faisst
Open

SPHEREx Mosaic Tool#311
afaisst wants to merge 5 commits into
mainfrom
spherexmosaic_tutorial_faisst

Conversation

@afaisst
Copy link
Copy Markdown
Contributor

@afaisst afaisst commented May 8, 2026

First version of the SPHEREx mosaic tool tutorial notebook.

There is also a FITS file attached, which is the SPHEREx mosaic created by the IRSA SPHEREX mosaic tool GUI. The notebook needs it to run. It's currently blocked from pushing that file because I guess it's on the git-ignore list (because FITS file...)

@afaisst afaisst requested review from bsipocz and troyraen May 8, 2026 20:58
@afaisst afaisst self-assigned this May 8, 2026
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We plan to post the data file on the IRSA website so that we don't have to store it in the repo (IRSA-7723). Assuming that works out, I think this .md notebook file can be moved up a level so it's directly under tutorials/spherex/ rather than in a dedicated spherex_mosaic directory.

Comment thread tutorials/spherex/spherex_mosaic/spherex_mosaic.md Outdated
@troyraen
Copy link
Copy Markdown
Contributor

@jkrick will you review this?

@troyraen troyraen requested a review from jkrick May 12, 2026 18:04
Copy link
Copy Markdown
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some formatting issues that result in this failing all the tests. And I have also done a first round run through, eyes mostly on design and API considerations as well as minor cleanups.

We have also talked about hiding some cells in dropdowns. For now you have have code cells that uses the source_hidden metadata as we already use it in other notebooks. While it doesn't hide the cell in the HTML rendering, I'm working on finding a solution that does and it would be easier to fix these all at once if the same metadata is being used everywhere.

```{code-cell} ipython3
---
jupyter:
  source_hidden: true
---

Comment thread tutorials/spherex/spherex_mosaic/spherex_mosaic.md
Comment thread tutorials/spherex/spherex_mosaic/spherex_mosaic.md Outdated
wave_tab
```

<!-- #region -->
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to double check how this region thing looks in rendering

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not quite sure what that is...? The output is a table in that cell.

Comment thread tutorials/spherex/spherex_mosaic/spherex_mosaic.md
<!-- #endregion -->

```python
def get_aperture_photometry(cube , r_aperture_px , r_inner_px , r_outer_px, MAKEPLOT):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preferably we should use keyword arguments for API design, so it won't end up in lines of somewhat cryptic numbers like in old IRAF/IDL days.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tried to fix this. Check...

Comment thread tutorials/spherex/spherex_mosaic/spherex_mosaic.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please squash out these changes from the commit

@bsipocz bsipocz added the content: spherex Content related issues/PRs for notebooks with SPHEREx relevance label May 12, 2026
@jkrick
Copy link
Copy Markdown
Contributor

jkrick commented May 12, 2026

@afaisst can you please send me the fits file some other way (google drive?) so I can test/review while we wait for whatever else needs to be worked out?

@troyraen
Copy link
Copy Markdown
Contributor

@jkrick you can get the fits file from the jira ticket I linked above.

@bsipocz
Copy link
Copy Markdown
Member

bsipocz commented May 12, 2026

We plan to post the data file on the IRSA website so that we don't have to store it in the repo

That is great, thank you. If we know we won't be changing the file ever then we can get away with adding it into the repo (it's ~83MB), but if there will be iterations with it then it can very quickly blow things up.

Copy link
Copy Markdown
Contributor

@jkrick jkrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the tutorial is a great idea. I have a few major comments below to simplify things (use WCS.celestial and plane identification by wavelength not plane number), and other smaller comments.



## Plotting stuff
def load_plotting_defaults():
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be hidden, if/when we figure out how to hide cells.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeap, then just add that heading to any of the cells you want to dropdown/hide, so we don't need to do a content review again once the technical part is figured out.

Comment thread tutorials/spherex/spherex_mosaic/spherex_mosaic.md Outdated
Comment thread tutorials/spherex/spherex_mosaic/spherex_mosaic.md Outdated
Comment thread tutorials/spherex/spherex_mosaic/spherex_mosaic.md Outdated
Comment thread tutorials/spherex/spherex_mosaic/spherex_mosaic.md Outdated
Comment thread tutorials/spherex/spherex_mosaic/spherex_mosaic.md

In addition, we also adjust the `BUNIT` keyword in the header to reflect the changes.

```{warning}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this whole messiness can be simplified by using WCS.celestial (thanks Claude for figuring that out). @afaisst I have a commit that makes this change, let me know if you want me to push it here.

Comment thread tutorials/spherex/spherex_mosaic/spherex_mosaic.md
Comment thread tutorials/spherex/spherex_mosaic/spherex_mosaic.md
Comment thread tutorials/spherex/spherex_mosaic/spherex_mosaic.md Outdated
Comment thread tutorials/spherex/spherex_mosaic/spherex_mosaic.md Outdated
@afaisst
Copy link
Copy Markdown
Contributor Author

afaisst commented May 13, 2026

ok, I resolved most comments. There are a few left:

@bsipocz : can you check the syntax in the functions? Doc strings and keyword arguments? Also, I separated out the cell with the plotting stuff in it so we can make this dropdown/hide cell.
@jkrick : when you can, push your fork with the changes in wavelength identification and WCS.celestial

Comment on lines +203 to +208
def measure_aperture_photometry_cube(cube,
r_aperture_px = 20,
r_inner_px = 60,
r_outer_px = 100,
MAKEPLOT = True
):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's something like this instead:

Suggested change
def measure_aperture_photometry_cube(cube,
r_aperture_px = 20,
r_inner_px = 60,
r_outer_px = 100,
MAKEPLOT = True
):
def measure_aperture_photometry_cube(cube, *, r_aperture_px=20, r_inner_px=60, r_outer_px=100, makeplot=True):

note that I also changed the caps on makeplot here, but not in the code below, it should not be all caps.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

# !pip install astropy matplotlib numpy photutils reproject astroquery
```

```python
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```python
```{code-cell} ipython3

@afaisst
Copy link
Copy Markdown
Contributor Author

afaisst commented May 13, 2026

Tried to redo the conversion:
converted the old .md back to ipynb and then back to .md using
jupytext --to md:myst notebook.ipynb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

content: spherex Content related issues/PRs for notebooks with SPHEREx relevance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants