bashes.utility module

bashes.utility.getBinEdges(*binCenters, **options)

Returns a numpy array of bin edges corresponding to the input array of bin centers, which will have a length one greater than the input length. The outer edges will be the same as the outer bin centers unless expand=True is passed as a keyword option. This function is normally used with the matplotlib pcolormesh function, e.g.

ex,ey = getBinEdges(x,y) plt.pcolormesh(ex,ey,z,cmap=’rainbow’) levels = np.min(z) + getDeltaChiSq(dof=2) plt.contour(x,y,z,levels=levels,colors=’w’,linestyles=(‘-‘,’–’,’:’))

bashes.utility.getDeltaChiSq(CL=(0.6827, 0.9543, 0.9973), dof=2)

Returns a numpy array of delta(chisq) values corresponding to the specified list of confidence levels. The default CL values correspond to the enclosed probabilities of 1,2,3-sigmas for a 1D Gaussian pdf.

bashes.utility.padPeriodic(x, n, offset=0.0)

Extend the array x[i] with 0 <= i < N to cover -n <= i < N+n+1 assuming periodicity x[n+N] = x[n]+offset to duplicate existing entries. Returns a new array that contains a copy of the original array. Note that an additional copy is needed on the high side to cover the interval x[N-1] - x[N].

bashes.utility.render(model, scale, size=None, stamp=None)

Returns a rendering of the specified GalSim model into a square postage stamp with the specified pixel scale (arcsecs). Either a stamp pixel size or an existing stamp (with its scale attribute set) must be provided. Note that the model will be convolved with the pixel response, so should not already be convolved with the pixel response.