ilex.plot
- create_poincare_sphere(cbar_lims, cbar_label)[source]
Create poincare sphere plot
- Parameters:
cbar_lims (list(float)) – colorbar limits
cbar_label (str) – colorbar label
- Returns:
fig – figure instance
- Return type:
figure
- plot_PA(x, PA, PA_err, ax=None, flipPA=False, plot_type='scatter', **kwargs)[source]
Plot PA profile
- Parameters:
x (np.ndarray) – X data
PA (np.ndarray) – Position angle
PA_err (np.ndarray) – PA error
ax (Axes, optional) – Axes handle, by default None
flipPA (bool, optional) – plot PA over [0, 180] degrees instead of [-90, 90], by default False
plot_type (str, optional) – type of error to plot, by default “scatter”
- Returns:
fig – Return figure instance
- Return type:
figure
- plot_RM(f, Q, U, Qerr=None, Uerr=None, rm=0.0, pa0=0.0, f0=0.0, ax=None, filename: str | None = None, plot_type='scatter')[source]
Plot RM fit
- Parameters:
f (np.ndarray) – Frequency array
Q (np.ndarray) – Stokes Q spectrum
U (np.ndarray) – Stokes U spectrum
Qerr (np.ndarray, optional) – Stokes Q error spectrum, by default None
Uerr (np.ndarray, optional) – Stokes U error spectrum, by default None
rm (float, optional) – Rotation Measure [rad/m^2], by default 0.0
pa0 (float, optional) – position angle at f0, by default 0.0
f0 (float, optional) – reference frequency [MHz], by default 0.0
ax (Axes, optional) – Axes handle, by default None
filename (str, optional) – filename to save figure to, by default None
plot_type (str, optional) – type of error to plot, by default “scatter”
- Returns:
fig – Return figure instance
- Return type:
figure
- plot_data(dat, typ='dsI', ax=None, plot_type='scatter')[source]
Plot data
- Parameters:
dat (Dict(np.ndarray)) – Dictionary of stokes data, can include any data products
typ (str, optional) –
Type of data to plot, by default “dsI”
[ds] - dynamic spectra
[t] - time series
[f] - frequency spectra
ax (Axes, optional) – axes handle, by default None
plot_type (str, optional) – type of plotting, by default “scatter”
- Returns:
fig – Return Figure instance
- Return type:
figure
- plot_dynspec(ds, ax=None, **kwargs)[source]
Plot dynamic spectrum
- Parameters:
ds (np.ndarray) – dynamic spectrum
ax (axes, optional) – axes to plot dynspec, by default None
- plot_poincare_track(dat, ax, sigma=2.0, plot_data=True, plot_model=False, normalise=True, n=5)[source]
Plot Stokes data on a Poincare Sphere.
- Parameters:
dat (Dict(np.ndarray)) –
Dictionary of stokes data, can include any data products but must include the following:
[I] - Stokes I data
[Q] - Stokes Q data
[U] - Stokes U data
[V] - Stokes V data
[Ierr] - Stokes I error data
stk_type (str, optional) –
types of stokes data to plot, by default “f”
[f] - Plot as a function of frequency
[t] - Plot as a function of time
sigma (float, optional) –
Error threshold used for masking stokes data in the case that stokes/I is being calculated
this avoids deviding by potentially small numbers and getting weird results,by default 2.0
plot_data (bool, optional) – Plot Data on Poincare sphere, by default True
plot_model (bool, optional) – Plot Polynomial fitted data on Poincare sphere, by default False
normalise (bool, optional) – Plot data on surface of Poincare sphere (this will require normalising stokes data), by default True
n (int, optional) – Maximum order of Polynomial fit, by default 5
- Returns:
stk_i (Stokes 1D arrays)
stk_m (Stokes model 1D arrays)
- plot_stokes(dat, Ldebias=False, sigma=2.0, stk_type='f', stk2plot='IQUV', stk_ratio=False, ax=None, plot_type='scatter')[source]
Plot Stokes data, by default stokes I, Q, U and V data is plotted
- Parameters:
dat (Dict(np.ndarray)) –
Dictionary of stokes data, can include any data products but must include the following:
[<x>I] - Stokes I data
[<x>Q] - Stokes Q data
[<x>U] - Stokes U data
[<x>V] - Stokes V data
[<x>Ierr] - Stokes I error data, only if Ldebias = True or stk_ratio = True
where <x> is either ‘t’ for time and ‘f’ for freq
Ldebias (bool, optional) – Plot stokes L debias, by default False
sigma (float, optional) – sigma threshold for error masking, I < sigma * Ierr, mask it out or else weird overflow behavior might be present when calculating stokes ratios, by default 2.0
stk_type (str, optional) – Type of stokes data to plot, “f” for Stokes Frequency data or “t” for time data, by default “f”
stk2plot (str, optional) – string of stokes to plot, for example if “QV”, only stokes Q and V are plotted, by default “IQUV”, choice between “IQUVLP”
stk_ratio (bool, optional) – if true, plot stokes ratios S/I
plot_type (str, optional) –
Choose between two methods of plotting the error in the data, by default “scatter”
[lines] - plot lines with error patches [scatter] - Show error in data as tics in markers
- Returns:
fig – Return figure instance
- Return type:
figure