cfield¶
- class cfield.C_WMAP(coords: jax.Array | List[jax.Array] | Tuple[jax.Array])[source]¶
Bases:
objectWMAP C field model. (https://iopscience.iop.org/article/10.1086/513699)
- Parameters:
coords (Union[jax.Array,List[jax.Array],Tuple[jax.Array]]) – coordinates of all integration points. Should be of size (3,…), for example
coords[0]is the x-coordinates.- Returns:
A instance of WMAP C field generator.
- static C_calc(WMAP_params, r: float, z: float)[source]¶
Calculate wmap C-field at a given position
(r,phi,z).- Parameters:
r (float) – r in cylindrical coordinates.
z (float) – z in cylindrical coordinates.
- Returns:
cosmic ray electron spectrum constant C in this position.
- C_field(WMAP_params={'C0': 211.13068378473076, 'hd': 1.0, 'hr': 5.0})¶
Calculate WMAP C-field at all positions specified by
coords.- Parameters:
WMAP_params (Dict[str,float]) – A dict contains all parameters of the WMAP model.
- Returns:
jnp.Array of shape (
coords[0].shape).coordsis the parameter of your C_WMAP instance.
- class cfield.C_grid(coords: jax.Array | List[jax.Array] | Tuple[jax.Array], coords_field: jax.Array | List[jax.Array] | Tuple[jax.Array])[source]¶
Bases:
objectgrid C field model. See Synax paper for more details.
- Parameters:
coords (Union[jax.Array,List[jax.Array],Tuple[jax.Array]]) – coordinates of all integration points. Should be of size (3,…), for example
coords[0]is the x-coordinates.coords_field (Union[jax.Array,List[jax.Array],Tuple[jax.Array]]) – coords[i] is the 1D vector of coordinates along i-th axis. Since the grid is a regular 3D grid, 1D vectors are sufficient to represents the coordinates.
- Returns:
A instance of grid C field generator.
- C_field(C_field_grid)¶
Calculate grid C-field at all positions specified by
coords.- Parameters:
C_field_grid (Dict[str,float]) – your field in a regular 3D grid.
- Returns:
jnp.Array of shape (
coords[0].shape).coordsis the parameter of your C_grid instance.
- class cfield.C_uni(coords: jax.Array | List[jax.Array] | Tuple[jax.Array], center=(-8.3, 0.0, 0.006))[source]¶
Bases:
objectUniform C field model cenntered at
center- Parameters:
coords (Union[jax.Array,List[jax.Array],Tuple[jax.Array]]) – coordinates of all integration points. Should be of size (3,…), for example
coords[0]is the x-coordinates.center – center of uniform C field. default to be the earth.
- Returns:
A instance of uniform C field generator.
- static C_calc(Uni_params, x: float, y: float, z: float)[source]¶
Calculate uniform C-field at a given position
(x,y,z).- Parameters:
x (float) – x in cartisian coordinates.
y (float) – y in cartisian coordinates.
z (float) – z in cartisian coordinates.
- Returns:
cosmic ray electron spectrum constant C in this position.
- C_field(Uni_params={'C0': 1.0, 'rho0': 4.0})¶
Calculate uniform C-field at all positions specified by
coords.- Parameters:
Uni_params (Dict[str,float]) – A dict contains all parameters of the uniform model.
- Returns:
jnp.Array of shape (
coords[0].shape).coordsis the parameter of your C_uni instance.