MEGARA Pipeline
Overview
MEGARA (Multi-Espectrografo en GTC de Alta Resolucion para Astronomia) is an optical IFU and multi-object spectrograph on the 10.4 m Gran Telescopio Canarias (GTC). It features a hexagonal fiber bundle of 623 fibers covering a 12.5” x 11.3” field of view, with fiber core diameter of 0.62”.
3DCubeGen provides a complete pipeline for MEGARA that integrates the
numina / megaradrp Data Reduction Pipeline (DRP) with the kernel
interpolation cube reconstruction.
CLI Entry Point
The MEGARA pipeline is accessed via the pipemegara command:
pipemegara <command> [options]
Two commands are available:
Command |
Purpose |
|---|---|
|
Manual step-by-step DRP execution + cube reconstruction |
|
Fully automated pipeline: sort observations, reduce calibrations, calibrate science data, and reconstruct cubes |
rundrp
The rundrp command runs the MEGARA DRP reduction steps individually and
then reconstructs a data cube. It requires the numina framework to be
installed and the MEGARA DRP configuration files (obsresult-*.yaml,
requirements-*.yaml) to be present in the working directory.
The reduction follows this calibration chain:
Bias – master bias creation
Traces – fiber trace identification
Wavelength calibration – arc lamp wavelength solution
Fiber flat – fiber-to-fiber response correction
Standard star – spectrophotometric calibration
Science – final science frame reduction + cube reconstruction
pipemegara rundrp --redux_dir /path/to/data --stdar_t HD12345 --vph LR-R
Key options:
Option |
Default |
Description |
|---|---|---|
|
|
Output directory for the final cube |
|
|
Path to the working directory with raw data |
|
|
Smoothing kernel size (arcsec) |
|
|
Spaxel size (0 = same as |
|
|
Kernel shape factor |
|
– |
Name of the spectrophotometric standard star |
|
|
VPH grating name (e.g., LR-B, LR-R, LR-Z, MR-R, HR-R) |
|
|
Aperture radius for spectrophotometric calibration (arcsec) |
|
|
Output cube basename template |
runfulldrp
The runfulldrp command automates the entire reduction workflow. It:
Sorts observation files by type (bias, arc, flat, standard, science)
Generates the DRP configuration files automatically
Runs all calibration steps
Performs spectrophotometric calibration iteratively
Reconstructs the final data cube
Extracts a 1D spectrum
It can be driven by CLI options or by a YAML configuration file.
pipemegara runfulldrp -c config_runfulldrp.yml
# Or with CLI options:
pipemegara runfulldrp --run_name GTC5-24AMEX --run_number 0001 \
--obrun_path /path/to/raw --redux_path /path/to/redux \
--out_path /path/to/output
Key additional options:
Option |
Default |
Description |
|---|---|---|
|
|
Name of the GTC observation run |
|
|
Observation block number (string format) |
|
|
Path to the raw observation data |
|
|
Working directory for intermediate reduction products |
|
|
Path to YAML config file (overrides CLI options) |
|
|
Force use of ThAr arc lamp for wavelength calibration |
Configuration File
The runfulldrp command accepts a YAML configuration file. A template is
provided at CubeGen/megaratools/configfiles/config_runfulldrp.yml:
---
run_drp:
- pipe_type: FULL
run_name: GTC5-24AMEX
run_number: '0001'
out_path: out_cubes
redux_ver: 1.1.1.dev0
redux_path: ''
obrun_path: ''
sigm_s: 0.35
pix_s: 0.0
alph_s: 2.0
flu16: True
name: None
basename: megCube-NAME.fits
fac_sizey: 1.0
fac_sizex: 1.0
aper_std: 4.0
forcear: False
Differences from LVM
While MEGARA uses the same core kernel interpolation algorithm, several defaults and behaviors differ:
Aspect |
MEGARA |
LVM |
|---|---|---|
Default |
0.35” (sub-arcsecond) |
32.2” (wide fibers) |
|
Same as |
|
Fiber geometry |
623 fibers, hexagonal, 0.62” core |
~1800 science fibers, 35.3” pitch |
VPH selection |
Multiple gratings (LR-B/R/Z, MR, HR) |
N/A (fixed spectral range) |
Spectrophotometric cal |
Built into pipeline (iterative) |
External (pre-calibrated SFrames) |
DRP integration |
Runs |
Reads pre-reduced RSS frames |