2. Functions

OneShot has several functions that perform all of the fitting and error analysis for a given image.

class oneshot.BeamlineScanFit(fitresults, spotexpected)

Bases: object

Simple class that stores fit results and expected spot size.

fitresults

Fit results.

spotexpected

Expected RMS spot size.

class oneshot.ScanFit(eaxis, *args, **kwargs)

Bases: scisalt.scipy.LinLsqFit.LinLsqFit

Stores the results of the fit of a beamline scan.

(Note: Any beamline scan! Does not have to be an energy scan!)

Beam

The beam resulting from a fit.

e_gamma

Relativistic \gamma.

emit

The emittance found by the scan fit.

emitn

The normalized emittance found by the scan fit.

class oneshot.findpinch(img, xbounds=None, ybounds=None, step=1)

Bases: object

New in version 0.2.

Finds the location of a bunch in an image img given bounds xbounds and ybounds by slicing image in strips of pixels step high.

GaussResults

An array of fit results.

fitmin

The minimum of the fit.

ind

Indices to use for fits.

plot(ax=None)

Plots the fit.

polyfit

The results of a polynomial fit of 2nd order.

pvar

The y pixel coordinate of the fits.

pxmin

The x pixel minimum of the fit.

step

The number of pixels to sum together per row.

variance

An array of the variances of fits.

xstart

The starting x coordinate for the fit window.

xstop

The ending x coordinate for the fit window.

ystart

The starting y coordinate for the fit window.

ystop

The ending y coordinate for the fit window.

yvar

The y coordinates.

oneshot.fitBeamlineScan(beamline, y, error=None, plot=False, eaxis=None)

Given a beamline and a set of RMS measurements y with measurement error, returns a beam’s parameters via oneshot.BeamlineScanFit.

  • plot: If true, shows a plot of the fit and the measurements.
  • eaxis: Gives an energy axis for y measurements.
oneshot.fitbowtie(beamline, x, y, T, twiss, emitx, error=None, verbose=False)

Deprecated since version 0.0.0.

I’m not really sure what this function does, but it’s not referenced anywhere else.

oneshot.getstd(res, h, xval)

Deprecated since version 0.0.0.

I’m not really sure what this function does, but it’s not referenced anywhere else.

oneshot.histcher(x, y, res)

Deprecated since version 0.0.0.

I’m not really sure what this function does, but it’s not referenced anywhere else.

oneshot.histenergy(x, d, res)

Deprecated since version 0.0.0.

I’m not really sure what this function does, but it’s not referenced anywhere else.

oneshot.plotfit(x, y, beta, X, top=None, bottom='Arbitrary', figpath=None, error=None, figlabel=None, axes=None, fontsize=None, **kwargs)

Deprecated since version 0.0.0.

I’m not really sure what this function does, but it’s not referenced anywhere else.

oneshot.tradquadscan(beamline, y, twiss, emitx, error=None, verbose=False)

Deprecated since version 0.0.0.

I’m not really sure what this function does, but it’s not referenced anywhere else.