Pulse programs are text files that specify the pulse sequence for a single shot of an experiment. They conventionally use the file suffix .pp
. These text files are run sequentially, line by line, starting from the top.
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 | |
timestamp() { | |
date +"%Y-%m-%d_%H:%M:%S" | |
} | |
pushd "$PWD" > /dev/null | |
SHA="$(git rev-parse --short HEAD)" | |
FILENAME="$HOME/Dropbox/diff/${PWD##*/}_$(timestamp)_$SHA.diff" | |
git diff > $FILENAME |
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 general_query(question, validator, default=None): | |
""" | |
Asks the given question, returning the (possibly modified) result if validator | |
allows it, and keeps asking until a valid answer is given. | |
:param str question: The question to ask. | |
:param validator: A function that acts on user response strings, and returns | |
`(success, modified_response, message)`. The loop ends if `success` is `True`, | |
in which case `modified_response` is returned. `message` is printed in | |
any case. |
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 random_choice(mat, n_samples=None, axis=0): | |
""" | |
Replaces the given axis with n_samples random choices (with replacement) | |
of values already along that axis. | |
A=np.arange(15).reshape(3,5) | |
print(A) | |
print(random_choice(A, n_samples=6, axis=1)) | |
print(random_choice(A, axis=0)) | |
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
# mimics the ctrl+shift+m behaviour in texmaker | |
atom.commands.add 'atom-text-editor', | |
'custom:insert-inline-latex-eqn': -> | |
return unless editor = atom.workspace.getActiveTextEditor() | |
selection = editor.getLastSelection() | |
selection.insertText("$#{selection.getText()}$") | |
if not editor.getSelectedText() | |
editor.moveLeft() | |
# puts selected text in a new align environment |
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
#!/bin/awesomethon | |
import adh as brother | |
from mad import skillz | |
import hopefully_not as too_hard | |
from dickens import major_work | |
message_ascii = skillz.ascii_array(message) | |
dickens_ascii = skillz.ascii_array(major_work.get_chapter(brother.get_age())) |
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
from __future__ import division | |
import numpy as np | |
from scipy.special import expit, logit | |
def complex_contract(x, y): | |
""" | |
Shrinks z=x+iy to the unit disk using half-expit. | |
""" | |
r = np.sqrt(x**2 + y**2) | |
phi = np.arctan2(y, x) |
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 lighten_color(color, amount=0.5): | |
""" | |
Lightens the given color by multiplying (1-luminosity) by the given amount. | |
Input can be matplotlib color string, hex string, or RGB tuple. | |
Examples: | |
>> lighten_color('g', 0.3) | |
>> lighten_color('#F034A3', 0.6) | |
>> lighten_color((.3,.55,.1), 0.5) | |
""" |
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
# This is working pretty nice for me, and has basically paid itself off. | |
# In retrospect, there are some better design layouts that would be more elegant, | |
# if this ever becomes more than a gist: headers and footers should be their own | |
# class, and there should be a generic class which sandwiches the matrix with | |
# such. LatexTabularX should be two of such sandwiches. Functionality for saving | |
# to disk and compiling the master tex file would be nice. | |
import warnings | |
class TexMatrix(object): |
NewerOlder