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#

  1. 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 --fc to True (default).

    • Target Frame: Use --frame to select the target frame. LSRK and HELIOCEN (Heliocentric) are lso supported.

    • Velocity Type: Choose --vtype for the velocity definition (optical or radio).

      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 because hifast.cube calculates velocity directly from frequency and ignores the velocity column generated here.

  2. RFI Masking If your input file contains an is_rfi dataset (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.

  3. Extrapolation Masking If the coordinates were generated using hifast.radec with extrapolation, the file may contain an is_extrapo flag. Use --mask_extrapo (default: False) to mask these extrapolated points.

  4. 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.

  5. 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