hifast.multi Multi-step Processing (Doppler Correction, etc)#
Overview#
The hifast.multi module is a versatile tool for post-processing spectral data. It handles several critical steps in the reduction pipeline, including RFI masking, reference frame correction (Doppler correction), and polarization merging.
Processing Workflow#
Reference Frame Correction Raw telescope data is recorded in the Topocentric frame. To make the data scientifically useful, it usually needs to be corrected to a standard rest frame.
Enable Correction: Set
--fcto True (default).Target Frame: Use
--frameto select the target frame.LSRKandHELIOCEN(Heliocentric) are lso supported.Velocity Type: Choose
--vtypefor the velocity definition (opticalorradio).Note
This parameter is primarily for tracking observations or single-spectrum analysis. If you are proceeding to make a data cube with
hifast.cube, this step is optional becausehifast.cubecalculates velocity directly from frequency and ignores the velocity column generated here.
RFI Masking If your input file contains an
is_rfidataset (generated by an RFI flagging module), you can use--replace_rfi(default: True) to replace the flagged data points with NaN. This ensures that contaminated data does not affect downstream analysis.Extrapolation Masking If the coordinates were generated using hifast.radec with extrapolation, the file may contain an
is_extrapoflag. Use--mask_extrapo(default: False) to mask these extrapolated points.Polarization Merging For unpolarized studies, the two linear polarizations (XX and YY) can be averaged to improve the signal-to-noise ratio. Use
--merge_polar(default: True) to perform this merge.Output The module saves the processed data to a new HDF5 file. The filename is automatically suffixed based on the operations performed (e.g.,
-fc).
Examples#
# Standard usage: RFI masking, LSRK correction, and polarization merge
python -m hifast.multi data/spec.hdf5
# Change target frame to Heliocentric
python -m hifast.multi data/spec.hdf5 --frame HELIOCEN
# Disable polarization merging (keep XX and YY separate)
python -m hifast.multi data/spec.hdf5 --merge_polar False
Full Parameter Reference#
Tip
You can also view the full list of parameters and their descriptions directly in your terminal by running:
python -m hifast.multi --help
Perform multi-step operations: RFI masking, reference frame correction, and polarization merging.
usage: python -m hifast.multi [-h] [--outdir OUTDIR] [-f] [-g G]
[-c MY_CONFIG] [--frange MIN MAX]
[--fc {True,False}]
[--frame {BARYCENT,HELIOCEN,LSRK,LSRD}]
[--vtype {radio,optical}]
[--replace_rfi {True,False}]
[--mask_extrapo {True,False}]
[--merge_polar {True,False}]
FILE
Named Arguments#
- --outdir
The directory used to save output file, default is same with the input file
Default: “default”
- -f
if set, overwriting file if output file exists
Default: False
- -g
save config to file path
- -c, --my-config
config file path
Input/Output#
- FILE
Input spectra file path (HDF5 format).
- --frange
Limit the frequency range to process [MHz]. Followed by two values (min, max).
Default: [0, inf]
Frame Correction#
- --fc
Possible choices: True, False
Enable reference frame correction (Topocentric -> LSRK/Heliocentric).
Default: True
- --frame
Possible choices: BARYCENT, HELIOCEN, LSRK, LSRD
Target reference frame. “LSRK” (Local Standard of Rest, Kinematic) is commonly used.
Default: “LSRK”
- --vtype
Possible choices: radio, optical
Velocity definition type. “optical” (cz) or “radio”. Note: This is primarily for tracking/single-spectrum analysis. hifast.cube calculates velocity from frequency and ignores this column.
Default: “optical”
Data Processing#
- --replace_rfi, --replace-rfi
Possible choices: True, False
Replace RFI-contaminated spectra with NaN (requires “is_rfi” dataset in input).
Default: True
- --mask_extrapo, --mask-extrapo
Possible choices: True, False
Mask data points where RA/DEC coordinates were extrapolated (requires “is_extrapo” dataset).
Default: False
- --merge_polar, --merge-polar
Possible choices: True, False
Merge (average) the two polarizations (XX and YY) into a single Stokes I intensity.
Default: True