arrakis.rmsynth_oncuts

Run RM-CLEAN on cutouts in parallel

Module Contents

Classes

Spectrum

Single spectrum

StokesIFitResult

Stokes I fit results

StokesSpectra

Multi Stokes spectra

Functions

cli()

Command-line interface

cubelet_bane(→ Tuple[numpy.ndarray])

Background and noise estimation on a cubelet

extract_all_spectra(→ StokesSpectra)

Extract spectra from cubelets

extract_single_spectrum(→ Spectrum)

Extract a single spectrum from a cubelet

fit_stokes_I(→ StokesIFitResult)

main(→ None)

rmsynthoncut1d(→ pymongo.UpdateOne)

1D RM synthesis

rmsynthoncut3d(→ pymongo.UpdateOne)

3D RM-synthesis

rmsynthoncut_i(comp_id, outdir, freq, host, field, epoch)

RMsynth on Stokes I

sigma_clip_spectra(→ StokesSpectra)

Sigma clip spectra

update_rmtools_dict(→ dict)

Update the RM-Tools dictionary with the fit results from the Stokes I fit

class arrakis.rmsynth_oncuts.Spectrum[source]

Bases: NamedTuple

Single spectrum

bkg: numpy.ndarray[source]

The background of the spectrum

data: numpy.ndarray[source]

The spectrum data

filename: str[source]

The filename associated with the spectrum

header: astropy.io.fits.Header[source]

The header associated with the spectrum

rms: numpy.ndarray[source]

The RMS of the spectrum

class arrakis.rmsynth_oncuts.StokesIFitResult[source]

Bases: NamedTuple

Stokes I fit results

alpha: float | None[source]

The alpha parameter of the fit

amplitude: float | None[source]

The amplitude parameter of the fit

fit_dict: dict | None[source]

The dictionary of the fit results

modStokesI: numpy.ndarray | None[source]

The model Stokes I spectrum

model_repr: str | None[source]

The model representation of the fit

x_0: float | None[source]

The x_0 parameter of the fit

class arrakis.rmsynth_oncuts.StokesSpectra[source]

Bases: NamedTuple

Multi Stokes spectra

i: Spectrum[source]

The Stokes I spectrum

q: Spectrum[source]

The Stokes Q spectrum

u: Spectrum[source]

The Stokes U spectrum

arrakis.rmsynth_oncuts.cli()[source]

Command-line interface

arrakis.rmsynth_oncuts.cubelet_bane(cubelet: numpy.ndarray, header: astropy.io.fits.Header) Tuple[numpy.ndarray][source]

Background and noise estimation on a cubelet

Parameters:
  • cubelet (np.ndarray) – 3D array of data

  • header (fits.Header) – Header of cubelet

Returns:

Background and noise per channel

Return type:

Tuple[np.ndarray]

arrakis.rmsynth_oncuts.extract_all_spectra(coord: astropy.coordinates.SkyCoord, ion: bool, field_dict: dict, outdir: str) StokesSpectra[source]

Extract spectra from cubelets

arrakis.rmsynth_oncuts.extract_single_spectrum(coord: astropy.coordinates.SkyCoord, stokes: str, ion: bool, field_dict: dict, outdir: str) Spectrum[source]

Extract a single spectrum from a cubelet

arrakis.rmsynth_oncuts.fit_stokes_I(freq: numpy.ndarray, coord: astropy.coordinates.SkyCoord, tt0: str | None = None, tt1: str | None = None, do_own_fit: bool = False, iarr: numpy.ndarray | None = None, rmsi: numpy.ndarray | None = None, polyOrd: int | None = None) StokesIFitResult[source]
arrakis.rmsynth_oncuts.main(field: str, outdir: pathlib.Path, host: str, epoch: int, username: str | None = None, password: str | None = None, dimension: str = '1d', verbose: bool = True, database: bool = False, do_validate: bool = False, limit: int | None = None, savePlots: bool = False, weightType: str = 'variance', fitRMSF: bool = True, phiMax_radm2: float | None = None, dPhi_radm2: float | None = None, nSamples: int = 5, polyOrd: int = 3, noStokesI: bool = False, showPlots: bool = False, not_RMSF: bool = False, rm_verbose: bool = False, debug: bool = False, fit_function: str = 'log', tt0: str | None = None, tt1: str | None = None, ion: bool = False, do_own_fit: bool = False) None[source]
arrakis.rmsynth_oncuts.rmsynthoncut1d(comp_tuple: Tuple[str, pandas.Series], beam_tuple: Tuple[str, pandas.Series], outdir: str, freq: numpy.ndarray, field: str, polyOrd: int = 3, phiMax_radm2: float | None = None, dPhi_radm2: float | None = None, nSamples: int = 5, weightType: str = 'variance', fitRMSF: bool = True, noStokesI: bool = False, showPlots: bool = False, savePlots: bool = False, debug: bool = False, rm_verbose: bool = False, fit_function: str = 'log', tt0: str | None = None, tt1: str | None = None, ion: bool = False, do_own_fit: bool = False) pymongo.UpdateOne[source]

1D RM synthesis

Parameters:
  • comp_id (str) – RACS component ID

  • outdir (str) – Output directory

  • freq (list) – Frequencies in Hz

  • host (str) – MongoDB host

  • field (str) – RACS field

  • database (bool, optional) – Update MongoDB. Defaults to False.

  • polyOrd (int, optional) – Order of fit to I. Defaults to 3.

  • phiMax_radm2 (float, optional) – Max FD. Defaults to None.

  • dPhi_radm2 (float, optional) – Delta FD. Defaults to None.

  • nSamples (int, optional) – Samples across RMSF. Defaults to 5.

  • weightType (str, optional) – Weight type. Defaults to ‘variance’.

  • fitRMSF (bool, optional) – Fit RMSF. Defaults to False.

  • noStokesI (bool, optional) – Ignore Stokes I. Defaults to False.

  • showPlots (bool, optional) – Show plots. Defaults to False.

  • savePlots (bool, optional) – Save plots. Defaults to False.

  • debug (bool, optional) – Turn on debug plots. Defaults to False.

  • rm_verbose (bool, optional) – Verbose RMsynth. Defaults to False.

arrakis.rmsynth_oncuts.rmsynthoncut3d(island_id: str, beam_tuple: Tuple[str, pandas.Series], outdir: str, freq: numpy.ndarray, field: str, phiMax_radm2: float | None = None, dPhi_radm2: float | None = None, nSamples: int = 5, weightType: str = 'variance', fitRMSF: bool = True, not_RMSF: bool = False, rm_verbose: bool = False, ion: bool = False) pymongo.UpdateOne[source]

3D RM-synthesis

Parameters:
  • island_id (str) – RACS Island ID

  • freq (list) – Frequencies in Hz

  • host (str) – Host of MongoDB

  • field (str) – RACS field ID

  • database (bool, optional) – Update MongoDB. Defaults to False.

  • phiMax_radm2 (float, optional) – Max Faraday depth. Defaults to None.

  • dPhi_radm2 (float, optional) – Faraday dpeth channel width. Defaults to None.

  • nSamples (int, optional) – Samples acorss RMSF. Defaults to 5.

  • weightType (str, optional) – Weighting type. Defaults to ‘variance’.

  • fitRMSF (bool, optional) – Fit RMSF. Defaults to False.

  • not_RMSF (bool, optional) – Skip calculation of RMSF. Defaults to False.

  • rm_verbose (bool, optional) – Verbose RMsynth. Defaults to False.

arrakis.rmsynth_oncuts.rmsynthoncut_i(comp_id: str, outdir: str, freq: numpy.ndarray, host: str, field: str, epoch: int, username: str | None = None, password: str | None = None, nSamples: int = 5, phiMax_radm2: float | None = None, verbose: bool = False, rm_verbose: bool = False)[source]

RMsynth on Stokes I

Parameters:
  • comp_id (str) – RACS component ID

  • freq (list) – Frequencies in Hz

  • host (str) – MongoDB host

  • field (str) – RACS field

  • nSamples ([type]) – Samples across the RMSF

  • phiMax_radm2 (float) – Max FD

  • verbose (bool, optional) – Verbose output Defaults to False.

  • rm_verbose (bool, optional) – Verbose RMsynth. Defaults to False.

arrakis.rmsynth_oncuts.sigma_clip_spectra(stokes_spectra: StokesSpectra) StokesSpectra[source]

Sigma clip spectra

Find outliers in the RMS spectra and set them to NaN

Parameters:

stokes_spectra (StokesSpectra) – The Stokes spectra

Returns:

The filtered Stokes spectra

Return type:

StokesSpectra

arrakis.rmsynth_oncuts.update_rmtools_dict(mDict: dict, fit_dict: dict) dict[source]

Update the RM-Tools dictionary with the fit results from the Stokes I fit

Parameters:
  • mDict (dict) – The RM-Tools dictionary

  • fit_dict (dict) – The fit results dictionary

Returns:

The updated RM-Tools dictionary

Return type:

dict