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
%% First a method using quaternions | |
qtn = randrot(1000,1); | |
pts = rotatepoint(qtn, [1 0 0]); | |
figure() | |
scatter3(pts(:,1), pts(:,2), pts(:,3)) | |
axis equal | |
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 dBLossPerM = RG58_loss(f) | |
% Function for estimate RG58 coaxial cable loss as a function of frequency | |
% per meter. Data is drawn from https://www.w4rp.com/ref/coax.html and is | |
% not varified with real lab measurments. Take it with a | |
% grain of salt. | |
% | |
% Output interpolates from the spaced data points. This is for estimating | |
% only. | |
% | |
% Author: Andrew Wade |
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 [x_clipped, rms] = rms2(x, y, varargin) | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% | |
% find the rms value of y(x) | |
% y(f) could be a spectral density | |
% or y(t) could be a time series | |
% | |
% optional var sets the cutoff of x to compute | |
% from. This will shorten the output vector |
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
#!/bin/bash | |
# USE AT YOUR OWN RISK. | |
# This is a bash script for checking brew cask versions and reinstalling if | |
# there is a version mismatch. Obviously this may revert casks that have self | |
# updating to previous version, but then it is as easy as simply updating the | |
# repo with the cask-repair command. This way the community gets the updates | |
# too. |
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
def S_f_SN(Pcar, Finesse, Lcav, lambd=1064.0e-9): | |
''' | |
Compute PDH shot noise | |
''' | |
_h = 6.62607004e-34 # [J.s] Plank's constant | |
_c = 2.99792458e8 # [m/s] Speed of light | |
return np.sqrt(_h * _c**3) / 8 / (Finesse * Lcav * np.sqrt(lambd * Pcar)) |
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
def truncFloat(x,dp): | |
'''Truncates a numpy float to given decimal places (dp)''' | |
return np.trunc(x * 10 ** dp) / 10 ** dp | |
def probRound(x, dp): | |
'''Rounds float to given decimal places (dp), with | |
last digit round done on a probablistic basis.''' | |
xTrunc = truncFloat(x, dp) # Truncate to dp figures | |
xrem = x - xTrunc # find remainder of truncation |
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 numpy as np | |
''' | |
Find the rms value of y(x). Here y(f) could be a spectral density or y(t) could be a time series | |
usage: | |
rms_of_y = rms(X,Y); | |
''' |
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
def HostUp(hostname, waittime=1000): | |
'''Function returns True if host IP returns a ping, else False''' | |
assert isinstance(hostname, str), \ | |
"IP/hostname must be provided as a string." | |
if os.system("ping -c 1 -W " + str(waittime) + " " + | |
hostname + " > /dev/null 2>&1") is 0: | |
HOST_UP = True | |
else: | |
HOST_UP = False | |
return HOST_UP |
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
#!/bin/bash | |
# | |
# Cleans a mac computer directory when called from crontab | |
# | |
#Author: Andrew Wade | |
#Date: 20170125 | |
#Last modified: yyyymmdd | |
TIMESTAMP=$(date +"%Y%m%d-%H%M%S") |
NewerOlder