A Python pipeline for processing maser monitoring observations from the Metsähovi Compact Array (MCA). This system automatically generates summary spectra and time series from baseline calibrated single scans, along with goo-quality plots for scientific analysis.
The MCA Maser Monitoring Programme has evolved from manual observations to daily automated monitoring of 57+ maser sources. This pipeline processes the calibrated data to produce standardized spectral and time series products, along with annotated plots for scientific analysis and monitoring.
- Automated Data Processing: Batch processing of calibrated observation files
- Spectral Regularization: Resampling spectra onto common velocity grids
- Adaptive Time Series: Variable cadence integration based on signal-to-noise ratio
- Multi-Polarization Support: Handles dual circular polarization (L/R) data
- Multi-Antenna Processing: Supports MCA1 and MCA2 antenna combinations
- Standardized Output: Consistent data formats for downstream analysis
- Automated Plotting: Generates publication-quality spectral and time series plots
- Feature Annotation: Automatic labeling of maser features with collision detection
pip install numpy pandas matplotlibnumpy: Numerical computationspandas: Data manipulation and rolling averagesmatplotlib: Plotting and visualization
archive/
├── G9.621+0.196/
│ ├── calibrated_scan_001.dat
│ ├── calibrated_scan_002.dat
│ └── ...
├── G12.681-0.182/
│ └── ...
# MCA_feature_catalogue.csv
G9.621+0.196,3.0
G9.621+0.196,-1.0
G12.681-0.182,53.4
G12.681-0.182,58.2# Set your paths
archive_fn = '/path/to/your/archive/'
out_foldername = '/path/to/output/'
catalogue_fn = '/path/to/MCA_feature_catalogue.csv'
# Run the pipeline
python source_summary.py
# Generate plots
python monitoring_plots.pyfrom mca_time_series import *
# Load maser feature catalogue
feature_catalogue = read_maser_catalogue('MCA_feature_catalogue.csv')
# Generate mean spectra for a source
mean_spectra = make_maser_spectra(
foldername='archive/G9.621+0.196/',
source_name='G9.621+0.196',
do_regridding=True,
dv=0.1 # velocity resolution in km/s
)
# Generate time series with adaptive cadence
time_series = variable_cadence_time_series(
foldername='archive/G9.621+0.196/',
source_name='G9.621+0.196',
feature_catalogue=feature_catalogue,
SNR_limit=3
)# Customize spectral regularization
dspectra = get_dynamic_spectra(
filenames,
do_regularization=True,
reg_strategy='MIN', # or 'MAX'
dv=0.1,
pol_filter='L' # Filter for specific polarization
)
# Apply spectral regularization
regularized_spectra = spectra_regularization(
dynamic_spectra,
dv=0.1,
reg_strategy='MIN'
)# Configure plotting parameters
plot_separately = False # Plot mean spectrum vs individual pol/ant
ann_collision_detection = True # Enable label collision detection
# Run plotting script
python monitoring_plots.py#vel,1Lmean,1Rmean,2Lmean,2Rmean
-10.000000,1.234567e+02,1.345678e+02,1.456789e+02,1.567890e+02
-9.900000,1.234567e+02,1.345678e+02,1.456789e+02,1.567890e+02
...
MJD,ant,poln,feature[*abcde],vel[km/s],pwr[],unc[]
560000.0,1,L,a,-2.4,123,12
560001.0,1,L,a,-2.4,125,11
...
- Spectral Plots (
Gxxx_spectrum.png): Annotated mean spectra with maser feature identification - Time Series Plots (
Gxxx_timeseries.png): Multi-feature time series with rolling averages and error bars
# Data paths
archive_fn = '/path/to/archive/' # Input data directory
out_foldername = '/path/to/output/' # Output directory
catalogue_fn = '/path/to/catalogue.csv' # Feature catalogue
# Processing parameters
do_regridding = True # Enable spectral regularization
dv = 0.1 # Velocity resolution [km/s]
SNR_limit = 3 # SNR threshold for time series
ADU2Jy = 1 # Flux calibration factor
# Regularization strategy
reg_strategy = 'MIN' # 'MIN' or 'MAX'# Plotting configuration
plot_separately = False # Plot individual pol/ant vs mean
ann_collision_detection = True # Enable label collision detection
# Plot appearance
figsize = (6, 4) # Spectrum plot size
figsize_ts = (10, 4) # Time series plot size
dpi = 200 # Output resolution- Automatic Feature Annotation: Labels maser features from catalogue
- Collision Detection: Prevents overlapping labels in crowded spectra
- Multi-Polarization Display: Option to show individual polarizations/antennas
- Rolling Averages: Time series plots include 20-point rolling means
- Error Bars: Uncertainty visualization with transparency control
mca-time-series/
├── mca_time_series.py # Core processing library
├── source_summary.py # Main pipeline wrapper
├── plot_summary.py # Plotting and visualization
├── MCA_feature_catalogue.csv # Example feature catalogue
├── README.md # This file
└── examples/
└── sample_data/
The pipeline expects calibrated .dat files with:
- Header metadata (observation time, antenna, polarization)
- Comma-separated columns: frequency, velocity, flux
- Standardized naming convention
# Observations began = 2025-01-01T12:00:00.000000
# Antennas: MCA1
# Polarisations = L
This pipeline supports the MCA Maser Monitoring Programme, which:
- Monitors 57+ methanol maser sources daily
- Provides automated flare detection capabilities
- Generates standardized data products for variability studies
- Supports interferometric observations with MCA1+MCA2
- Produces publication-ready plots for scientific analysis
- Variable Cadence: Adapts integration time based on source brightness
- Multi-Epoch Processing: Handles observations spanning multiple years
- Quality Control: SNR-based filtering and regularization
- Standardized Outputs: Consistent formats for scientific analysis
- Automated Visualization: Publication-quality plots with feature annotation
Import Errors: Ensure all dependencies are installed
pip install -r requirements.txtFile Not Found: Check that data paths are correct and files exist
Memory Issues: For large datasets, consider processing sources individually
Spectral Artifacts: Try different regularization strategies or velocity resolutions
Plot Generation Issues: Check that both spectrum and time series data files exist
Label Collisions: Enable ann_collision_detection for crowded spectral plots
- Adjust
dvparameter for optimal velocity resolution - Filter polarizations if processing time is excessive
- Enable collision detection for cleaner spectral plots
- Use
plot_separately=Truefor detailed multi-polarization analysis
This pipeline is part of the MCA Maser Monitoring Programme at Metsähovi Radio Observatory. For questions or contributions, please contact the development team.
- v1.0.0 (2025-07-04): Initial production release
- Core processing pipeline
- Spectral regularization
- Variable cadence time series
- Standardized output formats
- Automated plotting with feature annotation
- Publication-quality visualization tools
Developed for the Metsähovi Compact Array project. Please cite appropriate references when using this software for scientific publications.
- Holman et al. (2024): Median-frequency-shifted bandpass calibration method
- MCA Maser Monitoring Programme documentation
For technical questions or collaboration opportunities, please contact the MCA team at Metsähovi Radio Observatory.