Package: bccd
Draw and process B-NMR CCD image filesInstallation and Running the GUIInstall withpip3 install --user bccdfrompypi.Run withbccd.Note thatbccdusesrsyncto copy all files from the machines which operate the cameras. These machines are password protected and the passwords must be entered on every use, unless you give your public key to these devices. To do that, do:Create a public key if you don't have one already:ssh-keygen -t rsa. On prompt enter no password.Copy the key to the server using the proper username and password:ssh-copy-id user@machine.domainOn first usage,bccdwill need to transfer all the files from these machines. This may take some time, please be patient. On subsequent usages,bccdwill only update its list of files so the process will be much faster. These files are stored in$HOME/.bccd.bccd.fitsReferenceConstructor:fits(filename,rescale_pixels=True)Functions:# look for shapes in imagedetect_lines(sigma=1,min_length=50,min_gap=3,theta=None,nlines=np.inf,draw=True)detect_hlines(sigma=1,min_length=50,min_gap=3,nlines=np.inf,draw=True,**kwargs)detect_circles(rad_range,nlines=1,sigma=1,draw=True)# drawing and visualizationdraw(black=0,alpha=1,cmap='Greys',imap=True)draw_2Dfit(fn,*pars,levels=10,cmap='jet')draw_contour(nlevels=5,alpha=1,cmap='Greys',imap=True)draw_edges(sigma=1,alpha=1,cmap='Greys',imap=True)draw_sobel(alpha=1,cmap='Greys',imap=False)# fittingfit2D(function,**fitargs)fit_gaussian2D(draw=True,get_p0_from_center=False,**fitargs)# processingget_center(draw=True)get_cm(draw=True)get_gaussian2D_overlap(ylo,yhi,xlo,xhi)# worker functionsread(filename,rescale_pixels=True)set_black(black)set_mask(mask)Data fields:black:          float, pixel value corresponding to black (zero)
data:           2D numpy array, pixel values
data_original:  numpy array, pixel values
header:         dict, header information

mask:           (x,y,r) specifying circle to mask on

result_center:      (par,names) fitting results
result_cm:          (par,names) center of mass results
result_fit2D:       (par,cov) fitting results
result_gaussian2D:  (par,cov,names) fitting results
result_gaussian2D_overlap: float, overlapSome useful colourmap names:Greys
    Purples
    Yellows
    Blues
    Oranges
    Reds
    GreensParameter descriptionsalpha:          float, image transparency. Range: [0,1].
black:          float, value to set to black, all pixels of lower value raised to this level. Use to
                clean up noise. 

cmap:           str, color map to color the image. Ex: "Reds", "Greens", etc.
draw:           bool, if true, draw output
filename:       str, path to .fits file
fitargs:        **dict, arguments passed to curve_fit
fn:             function handle, function to draw
imap:           bool, if True, invert color map colours
levels:         int, number of contour levels to draw
kwargs:         **dict, unused
mask:           tuple, exclude all pixels outside of circle from draw or calculation. (x0,y0,r)
min_length:     float, minimum length of lines to find, in pixels
min_gap:        float, maximum acceptable distance between line pixels which do not signify breaking
                the line
nlines:         int, number of shapes to find
pars:           *tuple, parameters passed to fn. 
rad_range:      tuple, radius range to seach in (r_lo, r_hi)
rescale_pixels: bool, pixels are intrinsically asymmetric. Rescale image such that the pixels are 
                square, interpolating pixel values with 3rd order spline. 
shape:          tuple, shape of the image (number of pixels x,y)
sigma:          float, standard deviation of rolling Gaussian filter, smoothing image features.
theta:          float, list of acceptable angles for the lines to point

xlo:              function handle, lower integration bound [inner]
xlhi:             function handle, upper integration bound [inner]
ylo:              float, lower integration bound [outer]
yhi:              float, upper integration bound [outer]bccd.functionsgaussian2D(x,y,x0,y0,sigmax,sigmay,amp,theta=0)Parameter descriptionsamp:              float, unused in favour of normalized amplitude (present for ease of use)
sx,sy:            float, standard deviation
theta:            float, angle of rotation                  
x0,y0:            float, gaussian mean location