Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mouse_rectangle | |
% Make a rectangle that is anchored at one corner at the axis origin but follows | |
% the mouse cursor at the other. | |
% | |
% Instructions | |
% Run "mouse_rectangle" then move mouse cursor over the axes. | |
% | |
% Inputs | |
% none | |
% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sectionInd = bake(obj,varargin) | |
% Runs an automated anatomy acquisition using the currently attached parameter file | |
% | |
% function BT.bake('Param1',val1,'Param2',val2,...) | |
% | |
% | |
% Inputs (optional param/val pairs) | |
% 'leaveLaserOn' - If true, the laser is not switched off when acquisition finishes. | |
% This setting can also be supplied by setting BT.leaveLaserOn. If | |
% not supplied, this built-in value is used. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scanBeamPathDiagram | |
% Generate a figure showing a scanned beam with scan and image field | |
% | |
% The path of a resonant-scanned focused beam over a sample. The beam moves | |
% sinusoidally along the fast axis whilst being scanned up/down with a galvo. | |
% The area over which the beam moves is known as the “scan field”. On the left and | |
% right edges the beam slows and turns around. In these areas the potential for | |
% photodamage is greatest, as the beam is travelling more slowly over the sample. | |
% Thus the beam is “blanked” or disabled during these epochs. In a resonant scanning | |
% microscope the beam is blanked about 30% of the time. The image field (red lines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import napari | |
import numpy as np | |
from skimage import data | |
from skimage.color import rgb2gray | |
# Convert the astronaut image to a grayscale | |
astro_im = rgb2gray(data.astronaut()) | |
# Display the astronaut image and also display its negative in a new layer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function swipeTester | |
% Test if BakingTray swipe moves are causing a failure | |
% How large the swipe size should be. | |
swipeSize = 4; | |
% Pull in BT object | |
evalin('base','clear ans') %Because it sometimes makes a copy of BT in ans when it fails | |
hBT=BakingTray.getObject(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gitInfo=getGitInfo() | |
% Get information about the Git repository in the current directory, including: | |
% - branch name of the current Git Repo | |
% -Git SHA1 HASH of the most recent commit | |
% -url of corresponding remote repository, if one exists | |
% | |
% The function first checks to see if a .git/ directory is present. If so it | |
% reads the .git/HEAD file to identify the branch name and then it looks up | |
% the corresponding commit. | |
% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Multiple assignment | |
a=b=c=0 # all have the same value | |
a,b,c = 1,2,3 #a=1, b=2, c=3 | |
a,*b,c = 1,11,22,33,44,2 #b contains all numbers >10 | |
# Chaining comparison operators |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python3 | |
import numpy as np | |
import scipy.linalg | |
from mpl_toolkits.mplot3d import Axes3D | |
import matplotlib.pyplot as plt | |
# some 3-dim points | |
n=20 | |
xx=np.linspace(-12,5,num=n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python3 | |
# Make a 3d point cloud and fit a surface to it | |
import numpy as np | |
import scipy.linalg | |
from mpl_toolkits.mplot3d import Axes3D | |
import matplotlib.pyplot as plt |
NewerOlder