Skip to content

burstfit.utils.plotter

[view_source]

plot_1d_fit

def plot_1d_fit(xdata, ydata, function, popt, xlabel=None, ylabel=None, title=None, param_names=[], show=True, save=False, outname="1d_fit_res")

[view_source]

Plot the results of 1D fits

Arguments:

  • xdata - x value array
  • ydata - original data values
  • function - function used for fitting
  • popt - fit parameters of the function
  • xlabel - label of x axis
  • ylabel - label of y axis
  • title - title of the plot
  • param_names - names of the parameters

Returns:

plot_2d_fit

def plot_2d_fit(sgram, function, popt, tsamp, title=None, show=True, save=False, outname="2d_fit_res", outdir=None)

[view_source]

Plot the result of spectrogram fit

Arguments:

  • sgram - input 2D array of spectrogram
  • function - spectrogram function used for fitting
  • popt - fit parameters
  • tsamp - sampling time (s)
  • title - title of the plot

Returns:

plot_fit_results

def plot_fit_results(sgram, function, popt, tsamp, fstart, foff, mask=None, outsize=None, title=None, show=True, save=False, outname="2d_fit_res", outdir=None, vmin=None, vmax=None)

[view_source]

Arguments:

  • sgram - Original spectrogram data
  • function - spectrogram function used for modeling
  • popt - parameters for function
  • tsamp - sampling time (s)
  • fstart - start frequency (MHz)
  • foff - channel bandwidth (MHz)
  • mask - channel mask array
  • outsize - resize the 2D plots
  • title - title of the plot
  • show - to show the plot
  • save - to save the plot
  • outname - output name of png file
  • outdir - output directory for the plot
  • vmin - minimum range of colormap
  • vmax - maximum range of colormap

Returns:

plot_me

def plot_me(datar, xlabel=None, ylabel=None, title=None)

[view_source]

Generic function to plot 1D or 2D array. Requires SciencePlots.

Arguments:

  • datar - data to plot
  • xlabel - label of x axis
  • ylabel - label of y axis
  • title - title of the plot

Returns:

plot_mcmc_results

def plot_mcmc_results(samples, name, param_starts, labels, save=False)

[view_source]

Save corner plot of MCMC results

Arguments:

  • samples - MCMC samples to plot
  • name - output name
  • param_starts - mark the initial parameter guess
  • labels - labels for axes
  • save - to save the corner plot

Returns:

autocorr_plot

def autocorr_plot(n, y, name, save)

[view_source]

Make the autocorrelation plot to visualize convergence of MCMC.

Arguments:

  • n - iterations
  • y - autocorrelations
  • name - outname of plot
  • save - to save the plot

Returns: