masks

Masking module with classes for sky, BAL and DLA.

LIGHT_SPEED = 299792.458

Speed of light in km/s.

Type:

float

sqrt_pi = 1.77245385091

Square root of pi.

Type:

float

sqrt_2 = 1.41421356237

Square root of 2.

Type:

float

class SkyMask(fname, comm=None, mpi_rank=0)[source]

Bases: object

Sky line masking object.

Parameters:
  • fname (str) – Filename to read by astropy.io.ascii. Must have four columns ordered as type, minimum wavelength, maximum wavelength and frame (must be ‘RF’ or ‘OBS’).

  • comm (None or MPI.COMM_WORLD, default: None) –

  • mpi_rank (int, default: 0) –

column_names = ('type', 'wave_min', 'wave_max', 'frame')

Assumed ordering of columns in the text file.

Type:

tuple

apply(spec)[source]

Apply the mask by setting only spec.forestivar and spec.forestflux to zero.

Parameters:

spec (Spectrum) – Spectrum object to mask.

class BALMask[source]

Bases: object

BAL masking object.

Does not need construction. Assumes BAL related columns are present in the catalog.

lines = array([('lCIV', 1549.  ), ('lSiIV2', 1403.  ), ('lSiIV1', 1394.  ),        ('lNV', 1240.81), ('lLya', 1216.1 ), ('lCIII', 1175.  ),        ('lPV2', 1128.  ), ('lPV1', 1117.  ), ('lSIV2', 1074.  ),        ('lSIV1', 1062.  ), ('lOIV', 1031.  ), ('lOVI', 1037.  ),        ('lOI', 1039.  ), ('lLyb', 1025.7 ), ('lLy3',  972.5 ),        ('lCIII',  977.  ), ('lNIII',  989.9 ), ('lLy4',  949.7 )],       dtype=[('name', '<U10'), ('value', '<f8')])

Ion transition wavelengths in A.

Type:

ndarray

expected_columns = ['VMIN_CIV_450', 'VMAX_CIV_450', 'VMIN_CIV_2000', 'VMAX_CIV_2000']

Columns needed in catalog to mask wavelength ranges.

Type:

list(str)

static check_catalog(catalog)[source]

Asserts if the required columns are present in the catalog.

Parameters:

catalog (ndarray) –

static apply(spec)[source]

Apply the mask by setting only spec.forestivar and spec.forestflux to zero.

Parameters:

spec (Spectrum) – Spectrum object to mask.

class DLAMask(fname, local_targetids=None, comm=None, mpi_rank=0, dla_mask_limit=0.8)[source]

Bases: object

DLA masking object.

Maximum numbers for oscillator strengths and Einstein coefficients are picked from NIST.

Parameters:
  • fname (str) – FITS filename to read.

  • local_targetids (ndarray or None, default: None) – Remove DLAs if they are present in these TARGETIDs.

  • comm (None or MPI.COMM_WORLD, default: None) –

  • mpi_rank (int, default: 0) –

  • dla_mask_limit (float, default: 0.8) –

qe = 4.803204e-10

Charge of electron in statC (cm^3/2 g^1/2 s^-1).

Type:

float

me = 9.109384e-28

Mass of electron in g.

Type:

float

c_cms = 29979245800.0

Speed of light in cm/s.

Type:

float

aij_coeff = 0.02654007980146085

Derived quantity for transition strength in cm^2 s^-1.

Type:

float

wave_lya_A = 1215.67

Lya wavelength in A.

Type:

float

f12_lya = 0.41641

Lya oscillator strength.

Type:

float

A12_lya = 626480000.0

Lya Einstein coefficient.

Type:

float

wave_lyb_A = 1025.722

Lyb wavelength in A.

Type:

float

f12_lyb = 0.079142

Lyb oscillator strength.

Type:

float

A12_lyb = 167250000.0

Lyb Einstein coefficient.

Type:

float

accepted_zcolnames = ['Z_DLA', 'Z']

Column names for the DLA redshift.

Type:

list(str)

static H_tepper_garcia(a, u)[source]

Tepper-Garcia H function.

Parameters:
  • a (float) – Gamma / sigma.

  • u (ndarray) – (wave / lambda_12 - 1) / sigma.

Return type:

ndarray

static voigt_tepper_garcia(x, sigma, gamma)[source]

Tepper-Garcia voight function.

Parameters:
Returns:

Voight profile.

Return type:

ndarray

static get_optical_depth(wave_A, lambda12_A, log10N, b, f12, A12)[source]

Optical depth for a transition line.

Parameters:
  • wave_A (ndarray) – Wavelength array in A.

  • lambda12_A (float) – Transition wavelength in A.

  • log10N (float) – Log10 of column density.

  • b (float) – Doppler parameter in km/s.

  • f12 (float) – Oscillator strength.

  • A12 (float) – Einstein coefficient.

Returns:

tau – Optical depth.

Return type:

ndarray

static get_dla_flux(wave, z_dla, nhi, b=10.0)[source]

Normalized flux from Lya and Lyb wings of DLA.

Parameters:
  • wave (ndarray) – Wavelength array in A.

  • z_dla (float) – DLA redshift

  • nhi (float) – Log10 of DLA column density.

  • b (float, default: 10) – Doppler parameter in km/s.

Returns:

F – Normalized flux for DLA.

Return type:

ndarray

static get_all_dlas(wave, spec_dlas)[source]

Normalized flux from all DLAs in a sightline.

Parameters:
  • wave (ndarray) – Wavelength array in A.

  • spec_dlas (ndarray) – Named ndarray with ‘Z_DLA’ and ‘NHI’.

Returns:

F – Normalized flux.

Return type:

ndarray

static _read_catalog(fname)[source]

Read and return DLA catalog.

Should be run on master. If error occurs, returns None.

Parameters:

fname (str) – FITS filename to read.

Returns:

catalog – DLA catalog.

Return type:

ndarray

apply(spec)[source]

Apply the mask by setting spec.forestivar and spec.forestflux to zero.

Parameters:

spec (Spectrum) – Spectrum object to mask.

Arguments

add_mask_parser(parser=None)[source]

Adds masking related arguments to parser. These arguments are grouped under ‘Masking options’.

Parameters:

parser (argparse.ArgumentParser, default: None) –

Returns:

parser

Return type:

argparse.ArgumentParser

usage: foo [-h] [--sky-mask SKY_MASK] [--bal-mask] [--dla-mask DLA_MASK]

Masking options

--sky-mask

Sky mask file.

--bal-mask

Mask BALs (assumes it is in catalog).

Default: False

--dla-mask

DLA catalog to mask.