The pyRich tools¶
The Field tools¶
-
class
pyRich.field.
field_line
(foot_N, foot_S, i_0, n, vr, vB, s)¶ Object that contains a field line
- Variables
foot_N – Does the loop has a northern footpoint on the star? (0:no, 1:yes)
foot_S – Does the loop has a southern footpoint on the star? (0:no, 1:yes)
i_0 – The index of the initial point used to generate the field line??
n – The number of datapoints in the field line
vr – The xyz coordinates of the field line ([n,3] array)
vB – The BxByBz of the field line ([n,3] array)
s – The lenght along the field line ([n] array). For i_0? need to check in fortran code.
- Parameters
dset – a h5 dset object with a field line
Warning
need to check the zero point of s.
-
get_B
()¶ Return the field modulus along the field line
-
get_r
()¶ Return the radial coordinate along the field line
-
get_x
()¶ Return the x coordinate along the field line
-
get_y
()¶ Return the y coordinate along the field line
-
get_z
()¶ Return the z coordinate along the field line
-
rotate
(i, phi)¶ Transform the field line to a new orientation of the coordinate system
-
class
pyRich.field.
field_lines
(n_lines, pot_field, star, field_line)¶ Object that contains an ensemble of field lines
- Variables
n_lines – The number of field lines
pot_field – The associated potential field object
star – The associated star object
field_line – A list containing n_lines field_line objects.
- Parameters
file – the name of the hf file created by the fortran code.
-
plot
(star=False)¶ Creates a 3D plot of the field lines
- Parameters
star – (False) switch on to render the star. Will run slower.
-
plot_2D
(i_deg, phi_one=0.0, animated=False)¶ Creates a 2D plot of the field lines, with an inclination i and a rotational phase beta
The inclination is with respect to the z-axis from the reference frame defined in the fortran codes. Inclination of 90 degrees correspond to the rotational axis pointing towards the top of the screen. Phase zero is with the x-axis facing the observer (out of the screen) and the y-axis to the right. Phase increases with a x-axis right-handed rotation around the z-axis.
- Parameters
i – inclination of the rotational axis
phi – rotational phase
-
pyRich.field.
load_field_line_dset
(dset)¶ create a field_line object from an h5 dset
- Parameters
dset – a h5 dset object with a field line
-
pyRich.field.
load_field_lines
(file)¶ The construction method, from a h5 file built by the Field_lines fortran program
-
pyRich.field.
load_pot_field_dset
(dset)¶ Create a pot_field object from a h5 dset
-
pyRich.field.
load_star_dset
(dset)¶ Create a star object from a h5 dset
-
class
pyRich.field.
pot_field
(R_source, l_max, va, G_lm)¶ Object that contains a potential object
- Variables
G_lm – Spherical harmonics coefficients for the surface field ([l,m] array).
R_source – The source radius.
Note
The \(a_{l,m}\) and \(b_{l,m}\) coefficients for the potential fields are calculated on the fly by most of the fortran codes, and are not stored in the h5 files.
-
class
pyRich.field.
star
(omega)¶ An object containing the star paramters. In the fortran codes, this class mostly only contains functions. The only parameter is the rotation rate (in terms of fraction of critical)
- Parameters
omega – The rotation rate in terms of fraction of critical
The magnetosphere volume tools¶
-
class
pyRich.magnetospheres.
adm_volume
(vr0, vdr, vn, node_type, rho_w, rho_h, rho_c, v_w, v_h, v_c, T_h)¶ Object containing a adm volume
Because the ADM volume in the fortran code is an extended type, we are doing the same here.
Todo
There are other parameters stored in the h5 files – will add later.
-
get_column_density
(plane=0, type='cold')¶ Returns the column density
Todo
Need to check the units (g/cm3, or in rho_star)
Todo
Multiply by the dr, once I’ve checked the units of rho
- param plane
0 for yz, 1 for xz, 2 for xy
- param type
‘cold’=downflow+upflow, ‘hot’=shock region, ‘upflow’, ‘downflow’, ‘all’
-
plot_column_density
(type='all', **kwargs)¶ Create a graph of column density in 3 planes.
- Parameters
type – ‘cold’=downflow+upflow, ‘hot’=shock region, ‘upflow’, ‘downflow’, ‘all’
-
-
class
pyRich.magnetospheres.
arrm_volume
(vr0, vdr, vn, node_type, rho)¶ -
get_column_density
(plane=0)¶ Returns the column density
Todo
Need to check the units (g/cm3, or in rho_star)
Todo
Multiply by the dr, once I’ve checked the units of rho
- param plane
0 for yz, 1 for xz, 2 for xy
- param type
‘cold’=downflow+upflow, ‘hot’=shock region, ‘upflow’, ‘downflow’, ‘all’
-
-
pyRich.magnetospheres.
load_adm_vol
(file)¶ The construction method, from a h5 file built by the adm_volume fortran program
Warning
Fortran enocdes h5 files in the reverse order when compared to python. All of the 3D arrays are transposed so that once loaded in python the dimention order is x,y,z.
- Parameters
file – Name of the h5 file to load.
-
pyRich.magnetospheres.
load_arrm_vol
(file)¶ The construction method, from a h5 file built by the arrm_volume fortran program
Warning
Fortran enocdes h5 files in the reverse order when compared to python. All of the 3D arrays are transposed so that once loaded in python the dimention order is x,y,z.
- Parameters
file – Name of the h5 file to load.
-
class
pyRich.magnetospheres.
volume
(vr0, vdr, vn, node_type)¶ Object that contains a generic volume structure
-
get_axis
(n=0)¶ Construct an array for the simulation nth-axis
- Parameters
n – Which axis to return (0:x, 1:y, 2:z)
Todo
Need to fix the axis construction for the vertice node-type.
-
get_xaxis
()¶ Wrapper function to return the xaxis
-
get_yaxis
()¶ Wrapper function to return the yaxis
-
get_zaxis
()¶ Wrapper function to return the z axis
-