synax

class synax.Synax(sim_I=True, sim_P=True)[source]

Bases: object

Synax simulator :param sim_I: whether sim synchrotron intensity. :type sim_I: bool :param sim_P: whether sim polarized synchrotron intensity. :type sim_P: bool

Returns:

A instance of Synax simulator.

static B_los(B_field, nhats)

Calculate LoS B-field.

Parameters:
  • B_field (jax.Array) – 3D magnetic field ($B_t$) perpendicular to the LOS at different places.

  • nhats (jnp.Array) – In unit of rad. unit vector of different LoS.

Returns:

LoS B-field magnitude.

Return type:

(jnp.Array)

static RM(freq, B_field, TE_field, nhats, dls, B_los)

Calculate rotation measure.

Parameters:
  • freq (float) – frequency to be computed. In GHz.

  • B_field (jax.Array) – 3D magnetic field ($B_t$) perpendicular to the LOS at different places.

  • TE_field (jax.Array) – 3D electron density field, defined by $N(gamma)dgamma = Cgamma^{-p}dgamma$. Varied at different locations.

  • nhats (jnp.Array) – In unit of rad. unit vector of different LoS.

  • dls (jnp.float) – In unit of kpc. length of each integration segment for every LoS.

  • B_los (jax.Array) – LoS B-field magnitude.

Returns:

  • fd (jnp.Array): rotation measure for each LoS integration point.

  • fd_q (jnp.Array): cos(2*polarized angle), for Q map calculation.

  • fd_u (jnp.Array): sin(2*polarized angle), for U map calculation.

Return type:

tuple

sim(freq, B_field, C_field, TE_field, nhats, dls, spectral_index)

Calculate sychrotron map.

Parameters:
  • freq (float) – frequency to be computed. In GHz.

  • B_field (jax.Array) – 3D magnetic field ($B_t$) perpendicular to the LOS at different places.

  • C_field (jax.Array) – 3D field, defined by $N(gamma)dgamma = Cgamma^{-p}dgamma$. Varied at different locations.

  • TE_field (jax.Array) – 3D electron density field, defined by $N(gamma)dgamma = Cgamma^{-p}dgamma$. Varied at different locations.

  • nhats (jnp.Array) – In unit of rad. unit vector of different LoS.

  • dls (jnp.float) – In unit of kpc. length of each integration segment for every LoS.

  • spectral_index (float) – spectrum of cosmic ray electron spectrum.

Returns:

  • dict[‘I’](jnp.Array): Sychrotron I map. return 0 if sim_I=False

  • dict[‘Q’](jnp.Array): Sychrotron Q map. return 0 if sim_P=False

  • dict[‘U’](jnp.Array): Sychrotron U map. return 0 if sim_P=False

Return type:

dict

synax.sync_I_const(freq, spectral_index: float = 3.0)

calculating the constant irrelavent to b_perp and C in the synchrotron emissivity.

Parameters:
  • freq (float) – frequency to be computed. In GHz.

  • spectral_index (float or jax.Array) – spectrum of cosmic ray electron spectrum.

Returns:

parallel emissivity constant for the synchrotron emission.

Return type:

(jax.Array)

synax.sync_P_const(freq, spectral_index: float = 3.0)

calculating the constant irrelavent to b_perp and C in the polarized synchrotron emissivity.

Parameters:
  • freq (float) – frequency to be computed. In GHz.

  • spectral_index (float or jax.Array) – spectrum of cosmic ray electron spectrum.

Returns:

perpenndicular emissivity constant for the polarized synchrotron emission.

Return type:

(jax.Array)

synax.sync_emiss_I(freq: float, b_perp: jax.Array, C: jax.Array, spectral_index: float = 3.0)

Calculating the synchrotron emissivity.

Parameters:
  • freq (float) – frequency to be computed. In GHz.

  • b_perp (jax.Array) – 3D magnetic field ($B_t$) perpendicular to the LOS.

  • C (jax.Array) – 3D field, defined by $N(gamma)dgamma = Cgamma^{-p}dgamma$. Varied at different locations.

  • spectral_index (float) – spectrum of cosmic ray electron spectrum.

Returns:

parallel emissivity for the synchrotron emission.

Return type:

(jax.Array)

synax.sync_emiss_P(freq: float, b_perp: jax.Array, C: jax.Array, spectral_index: float = 3.0)

Calculating the polarized synchrotron emissivity.

Parameters:
  • freq (float) – frequency to be computed. In GHz.

  • b_perp (jax.Array) – 3D magnetic field ($B_t$) perpendicular to the LOS.

  • C (jax.Array) – 3D field, defined by $N(gamma)dgamma = Cgamma^{-p}dgamma$. Varied at different locations.

  • spectral_index (float) – spectrum of cosmic ray electron spectrum.

Returns:

perpendicular emissivity for the polarized synchrotron emission.

Return type:

(jax.Array)