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/bin/env python | |
#-*- coding: utf-8 -*- | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
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 affineRotExample3D(thetaX, thetaY, thetaZ) | |
% Example of how to rotate an array of points in 3 using affine transformation | |
% | |
% function affineRotExample3D(thetaX, thetaY, thetaZ) | |
% | |
% Purpose | |
% Rotate a grid of points in three dimensions about its centre using affine transformation | |
% | |
% | |
% By default: |
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 |
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
## 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
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
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
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 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
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. |
OlderNewer