sdss / sdss/dr20_tutorials

Using_BHM_Visual_Inspection_VAC.ipynb. Enhancement

Open
#6 1 comment 0 reactions 1 assignee View on GitHub

@JosephKarpinski is already working on this.

Since Aug 6, 2026.

Dominant language
Jupyter Notebook
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

https://github.com/sdss/dr20_tutorials/blob/main/vac_tutorials/Using_BHM_Visual_Inspection_VAC.ipynb

Enhancement

------------------------------------------------------------

NEW CELL: Small-multiples gallery of failure spectra

------------------------------------------------------------

'''
Replaces the single random spectrum in Cell 24-26 with a 3x3 grid so
recurring failure patterns (broad absorption, weak-line QSOs, sky
residuals) are visible at a glance instead of requiring many reruns.
Reuses xm from Cell 22.
'''

NB: xm from Cell 22 is the tuple returned by np.where(condition) -- xm[0] is the index array

n_panels = min(9, len(xm[0]))
idx = np.random.choice(xm[0], size=n_panels, replace=False)

fig, axes = plt.subplots(3, 3, figsize=(16, 9))
for ax, i in zip(axes.flat, idx):
s = j[i]
try:
specFile = access.full('specLite_coadd', run2d=run2d, obs=s['OBS'],
mjd=s['MJD'], catalogid=s['CATALOGID'], coadd=coadd)
if not access.exists('', full=specFile):
access.remote()
access.add('specLite_coadd', run2d=run2d, obs=s['OBS'],
mjd=s['MJD'], catalogid=s['CATALOGID'], coadd=coadd)
access.set_stream()
access.commit()
access.reset()
spectra = fits.getdata(specFile, 'COADD')
wave = np.power(10, spectra['LOGLAM'])
mask = (spectra['AND_MASK'] == 0)
ax.plot(wave[mask], spectra['FLUX'][mask], lw=0.7, label='Flux')
ax.plot(wave[mask], spectra['MODEL'][mask], lw=0.7, label='Model')
ax.set_title(f"z_pipe={s['Z']:.2f} z_vi={s['z_vi']:.2f}", fontsize=9)
except Exception as e:
ax.set_title(f"load failed: {e}", fontsize=8)
ax.set_xlabel('Wavelength (A)', fontsize=8)
axes.flat[0].legend(fontsize=8)
plt.tight_layout()
plt.show()

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.