grblc.convert package

Submodules

grblc.convert.clean module

grblc.convert.clean.clean_grbs(main_dir)[source]

grblc.convert.convert module

grblc.convert.convert.convertGRB(GRB: str, battime: str = '', index: float = 0, index_type: str = '', use_nick: bool = False, debug: bool = False)[source]
grblc.convert.convert.convert_all(debug=False)[source]
grblc.convert.convert.ebv2A_b(grb: str, bandpass: str, ra='', dec='')[source]
A function that returns the galactic extinction correction

at a given position for a given band.

This takes data from Schlegel, Finkbeiner & Davis (1998) in the form of the SFD dust map, and is queried using the dustmaps python package. Updated coefficient conversion values for the SFD is taken from Schlafly & Finkbeiner (2011) and is found in SF11_conversions.txt.

Parameters
  • grb (str) – Gamma ray burst name

  • bandpass (str) – One of the 94 bandpasses supported. See SF11_conversion.txt for these bandpasses.

  • ra (str, optional) – Right ascension, by default None

  • dec (str, optional) – Declination, by default None

Returns

Galactic extinction correction in magnitude (\(A_\nu\)).

Return type

float

Raises

astroquery.exceptions.RemoteServiceError – If the GRB position cannot be found with astroquery, then the user is prompted to enter the RA and DEC manually.

grblc.convert.convert.get_dir()[source]
grblc.convert.convert.set_dir(dir)[source]
grblc.convert.convert.toFlux(band: str, mag: float, magerr: float = 0, photon_index: float = 1, photon_index_err: float = 0, A_b: float = 0, grb: Optional[str] = None, ra: Optional[str] = None, dec: Optional[str] = None, source: str = 'manual')[source]

A function that converts a given magnitude to flux (erg cm\(^{-2}\) s\(^{-1}\)), normalized to the R photometric band. This is done by converting the zero-point flux densities of a given band to the R band via assuming that the spectral energy distribution follows a simple power law.

The conversion is as follows:

\[{\rm Flux~}= \lambda_R f_X \left(\frac{\lambda_X}{\lambda_R}\right)^{-\beta} \left(10\right)^{-m/2.5},\]

where \(\lambda_R\) is the R band wavelength, \(\lambda_X\) is the bandpass wavelength, \(\beta\) is the photon index (\(\beta = \Gamma - 1\)), and \(m\) is the dust-corrected magnitude.

Dust extinction corrections are taken from Schlafly & Finkbeiner (2011). Error propagation for the flux, assuming there is error on the magnitude and photon index and no covariance between the two values, is as follows:

\[\sigma = \left|{\rm Flux}\right| \sqrt{(\frac{\sigma_m}{2.5} \log10)^2 + \left(\sigma_\beta\log{\left(\frac{\lambda_X}{\lambda_R}\right)}\right)^2},\]

where \(\sigma_i\) denotes the standard error on \(i\).

Supported bands:

U, B, V, R, I, J, H, K, u, g, r, i, z, u_swift, b_swift, v_swift, uvw1_swift, uvw2_swift, uvm2_swift, Rc, Ic, Ks, Z, Y
Parameters
  • mag (float) – Magnitude to convert to flux.

  • band (str) – Photometric bandpass of the given magnitude. Must be one of the bandpasses from grblc.constants.photometry.

  • grb (str) – GRB name.

  • magerr (float, optional) – Error on the magnitude, by default 0

  • photon_index (float, optional) – Photon index \(\Gamma\) (\(\Gamma = \beta + 1\)), by default 1

  • photon_index_err (float, optional) – Error on the photon index, by default 0

  • A_b (float, optional) – Galactic extinction to add onto the magnitude. If not provided, extinction values will be looked up and added automatically to the final flux.

  • source (str, optional) – Source of the datapoint (e.g., “manual”, “UVOT”, …), by default “manual”

  • ra (str, optional) – Right ascension, for use in grabbing dust extinction values, by default None

  • dec (str, optional) – Declination, for use in grabbing dust extinction values, by default None

Returns

flux and flux error in erg cm\(^{-2}\) s\(^{-1}\) normalized to the R band.

Return type

float, float

Raises

KeyError – If a bandpass is not found in grblc.constants.photometry.

grblc.convert.formatting module

grblc.convert.formatting.fix_format()[source]

grblc.convert.time module

grblc.convert.time.UT_to_dec(yr_time: str) str[source]
grblc.convert.time.dec_to_UT(decimal: float) str[source]
grblc.convert.time.grb_to_date(GRB: str)[source]