fiberlab.fullcone module
Module with methods used to analyze and plot full-cone test images.
- fiberlab.fullcone.default_threshold()[source]
The default threshold to use for defining the contour used to determine the center of the output beam.
- fiberlab.fullcone.ee_curve(img, threshold=None, clip_iter=10, sigma_lower=100.0, sigma_upper=3.0, local_bg_fac=None, local_iter=1)[source]
- fiberlab.fullcone.fullcone_farfield_output(img_file, bkg_file=None, threshold=None, clip_iter=10, sigma_lower=100.0, sigma_upper=3.0, local_bg_fac=None, local_iter=1, pixelsize=None, distance=None, plot_file=None, snr_img=False, ring_box=None)[source]
Analyze an output far-field image for a full-cone input beam.
- Parameters
img_file (
str, Path) – Image filebkg_file (
str, Path, optional) – Background image to subtractthreshold (
float, optional) – S/N threshold of the contour used to define the center of the ring. If None, seedefault_threshold().local_bg_fac (
float, optional) – Number of HWHM at which to determine the local background level. If None, no local background is estimated.local_iter (
int, optional) – Number of iterations used for determining the local background. Ignored iflocal_bg_facis None.pixelsize (
float, optional) – Size of the image pixels in mm.distance (
float, optional) – Distance from the fiber output to the detector in mm.plot_file (
str, Path, optional) – Name of the QA file to produce. If'show', no file is produced, but the QA plot is displayed in a matplotlib window.snr_img (
bool, optional) – If creating the QA plot, plot the estimated S/N (used to set the contour level) instead of the measured counts.ring_box (
float, optional) – Limit the plotted image regions to this times the best-fitting peak of the ring flux distribution. If None, the full image is shown.
- Returns
Three floating-point objects providing the radius at which the peak flux is found, the flux at the peak, and the width of the ring.
- Return type
tuple
- fiberlab.fullcone.fullcone_farfield_output_plot(img_file, img, model, threshold, level, trace, circ_p, radius, flux, model_radius, model_flux, model_img, snr_img=False, r_units='pix', ring_box=None, pixelsize=None, distance=None, ofile=None)[source]
UPDATE Diagnostic plot for the measurements of a collimated far-field output beam.
- Parameters
img_file (
str, Path) – Image fileimg (numpy.ndarray) – The background subtracted far-field image data.
model (numpy.ndarray) – The model of the far-field image.
threshold (
float) – S/N threshold of the contour used to define the center of the ring.level (
float) – The level in the image that corresponds to the S/N threshold.trace (numpy.ndarray) – The contour tracing the outside of the ring used to define the ring center.
circ_p (
tuple) – Tuple with the best-fitting parameters for the ring contour: x center (along 2nd axis), y center (along 1st axis), and radius.radius (numpy.ndarray) – A (sorted) 1D array with the radii of all pixels in
imgrelative to the ring center.flux (numpy.ndarray) – A 1D array with the flux of all pixels in
imgsorted by radius relative to the ring center.smooth_flux (numpy.ndarray) – The smoothed version of the
fluxvector, used to measure the radius of the ring, its peak flux, and its full-width at half maximum.peak_indx (
int) – The index of the element insmooth_fluxat which the peak (ring center) was found.left (
float) – The inner radius of the ring at half its maximum.right (
float) – The outer radius of the ring at half its maximum.snr_img (
bool, optional) – Plot the estimated S/N (used to set the contour level) instead of the measured counts.r_umits (
str, optional) – The units of the radius vector.ring_box (
float, optional) – Limit the plotted image regions to this times the best-fitting contour radius. If None, the full image is shown.ofile (
str, Path, optional) – Name of the QA file to produce. If'show', no file is produced, but the QA plot is displayed in a matplotlib window.
- fiberlab.fullcone.fullcone_throughput(inp_img, out_img, bkg_file=None, threshold=None, clip_iter=10, sigma_lower=100.0, sigma_upper=3.0, local_bg_fac=None, local_iter=1)[source]
Analyze an output far-field image for a full-cone input beam.
- Parameters
inp_img (
str, Path) – Image of the input beamout_img (
str, Path) – Image of the output beambkg_file (
str, Path, optional) – Background image to subtractthreshold (
float, optional) – S/N threshold of the contour used to define the center of the ring. If None, seedefault_threshold().clip_iter (
int, optional) – Number of clipping iterations used to measure backgroundsigma_lower (
float, optional) – Lower sigma rejection used to measure backgroundsigma_upper (
float, optional) – Upper sigma rejection used to measure backgroundlocal_bg_fac (
float, optional) – Number of HWHM at which to determine the local background level. If None, no local background is estimated.local_iter (
int, optional) – Number of iterations used for determining the local background. Ignored iflocal_bg_facis None.