# M101 HETDEX Data Cube and Tutorial Notebooks

This repository accompanies **Garner et al. (2026)**. The released HETDEX data cube is the primary data product used for the M101 analysis described in the article. The tutorial notebooks provide simplified examples of how to inspect and use the cube, including generating collapsed images, quick-look emission line images, and integrated spectra. 

The notebooks do not reproduce every step of the published analysis. In particular, the paper analysis includes additional procedures such as foreground star removal, continuum modeling with `ppxf`, spectral fitting, spatial binning, quality-control cuts, and star formation history extraction that are not included in the introductory materials. 

## Repository Contents

```text
.
├── README.md
├── m101_mosaic_cube.fits
├── notebooks/
│   ├── 01_GettingStarted.ipynb
│   ├── 02_IntegratedSpectrum.ipynb
│   └── M101_HETDEX_integrated_spectrum.txt
```

## Summary of Files

### `m101_mosaic_cube.fits`
Main M101 HETDEX data cube used in the analysis presented in Garner et al. (2026) and Liu et al. (2023). 

The cube contains the spatially resolved spectroscopy of M101. The first axis is the spectral axis and the remaining two axes are spatial dimensions. The wavelength solution and sky-coordinate transformation are stored in the FITS header/WCS. 

### `notebooks/01_GettingStarted.ipynb`
Introductory tutorial notebook demonstrating how to:
- Load the HETDEX cube.
- Inspect the cube dimensions and wavelength axis. 
- Create a collapsed image.
- Create quick-look images around bright optical emission lines. 
- Extract and plot a few example spectra from selected regions.

This notebook is intended to help users become familiar with the structure and contents of the released cube. 

### `notebooks/02_IntegratedSpectrum.ipynb`
Tutorial notebook demonstrating how to extract a simple integrated spectrum from the cube. 
This notebook shows how to
- Define a simple spatial mask.
- Sum the cube over selected spatial pixels. 
- Plot the integrated spectrum. 
- Mark common optical emission lines and absorption lines using `lineid_plot`.
- Optionally save the extracted spectrum to a text file.

The integrated spectrum produced in this notebook does not exactly match the published paper spectrum. In the paper analysis, additional masking and cleaning steps were applied, including masking foreground stars. The tutorial notebook intentionally uses a simpler extraction procedure for clarity. 

### `notebooks/M101_HETDEX_integrated_spectrum.txt`
The second tutorial notebook optionally saves the integrated spectrum as a text file. We include this here for completion. 

## File Formats

### FITS Data Cube

The main data product is provided as a FITS file: 
- File: `m101_mosaic_cube.fits`
- Format: FITS
- Recommended Python readers: 
    - `astropy.io.fits`
    - `spectral_cube.SpectralCube`

The cube can be loaded in Python using

```Python
from spectral_cube import SpectralCube

cube = SpectralCube.read('m101_mosaic_cube.fits')
wave = cube.spectral_axis
```
More information about using `SpectralCube` to analyze data can be found at [https://spectral-cube.readthedocs.io/en/latest/](https://spectral-cube.readthedocs.io/en/latest/). 

### Jupyter Notebooks
The tutorial files are provided as Jupyter notebooks: 
- Format: `.ipynb`
- Language: Python 3
- Main Python packages used
    - `numpy`
    - `matplotlib`
    - `astropy`
    - `spectral_cube`
    - `lineid_plot`

### Analysis Scripts   
The analysis scripts are provided as Python files
- Format: `.py`
- Language: Python 3

These scripts may require additional packages beyond those used in the tutorial notebooks. They may also contain hard-coded paths, project-specific assumptions, or code fragments used during exploratory analysis. 

## Data Dimensions and Units

### Main Spectral Cube

The FITS cube has dimensions: 
```text
N_wavelength x N_y x N_x
```
where `N_wavelength` is the number of spectral pixels, and `N_y` and `N_x` are the spatial dimensions of the mosaic. The spectral axis is stored in the FITS WCS and can be accessed using `cube.spectral_axis`. The spectral axis are in units of angstroms (Å), while the spatial axes are in units of pixels. Transformation into sky coordinates (RA, Dec) is easily done using the FITS WCS and numerous `astropy` routines. The cube values are given in units of 10<sup>-17</sup> erg/s/cm<sup>2</sup>/Å. 

### Tutorial-Derived Spectra

The second tutorial notebook optionally saves a text file (included) containing an integrated spectrum. The columns of this file are `wavelength_A`, the wavelength axis given in units of angstroms (Å), and `integrated_flux`, the spectrum summed over the spatial axes in units of erg/s/cm<sup>2</sup>/Å. 

## Data Sources and References

The data products in this repository are based on observations from the Hobby-Eberly Telescope Dark Energy Experiment (HETDEX) at the Hobby-Eberly Telescope (HET). 

Please cite the following when using these data. 

#### HETDEX 

> "HETDEX is led by the University of Texas at Austin McDonald Observatory and Department of Astronomy with participation from the Ludwig-Maximilians-Universität München, Max-Planck-Institut für Extraterrestrische Physik (MPE), Leibniz-Institut für Astrophysik Potsdam (AIP), Texas A&M University, Pennsylvania State University, Institut fü Astrophysik Göttingen, The University of Oxford, Max-Planck-Institut für Astrophysik (MPA), the University of Tokyo and Missouri University of Science and Technology. In addition to Institutional support, HETDEX is funded by the National Science Foundation (grant AST-0926815), the State of Texas, the US Air Force (AFRL FA9451-04-2-0355), and generous support from private individuals and foundations. 

Please cite the survey overview paper, [Gebhardt et al. (2021)](https://scixplorer.org/abs/2021ApJ...923..217G/abstract). 

#### HET

> The observations were obtained with the Hobby-Eberly Telescope (HET), which is a joint project of the University of Texas at Austin, the Pennsylvania State University, Ludwig-Maximilians-Universität München, and Georg-August-Universität Göttingen. The HET is named in honor of its principal benefactors, William P. Hobby and Robert E. Eberly. 

Please cite the instrumentation papers, [Ramsey et al. (1998)](https://scixplorer.org/abs/1998SPIE.3352...34R/abstract) and [Hill et al. (2021)](https://scixplorer.org/abs/2021AJ....162..298H/abstract).

#### VIRUS

> VIRUS is a joint project of the University of Texas at Austin, Leibniz-Institut für Astrophysik Potsdam (AIP), Texas A&M University (TAMU), Max-Planck-Institut für Extraterrestrische Physik (MPE), Ludwig-Maximilians-Universität München, Pennsylvania State University, Institut für Astrophysik Göttingen, University of Oxford, and the Max-Planck-Institut für Astrophysik (MPA). In addition to Institutional support, VIRUS was partially funded by the National Science Foundation, the State of Texas, and generous support from private individuals and foundations. 

Please cite the instrumentation paper, [Hill et al. (2021)](https://scixplorer.org/abs/2021AJ....162..298H/abstract).

#### Cube Data Reduction

Please cite Garner et al. (2026) that describes the general data cube construction. 
