Skip to content

Instantly share code, notes, and snippets.

View GenevieveBuckley's full-sized avatar

Genevieve Buckley GenevieveBuckley

  • Monash University
  • Melbourne
View GitHub Profile
@GenevieveBuckley
GenevieveBuckley / pr.md
Created August 10, 2018 01:43 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@GenevieveBuckley
GenevieveBuckley / drift_correct
Last active September 11, 2018 23:56
First attempt at a drift correction function for scikit-image
def drift_correct(image, shifts, shift_axes=[], kwargs*):
"""Align image array to correct for motion over time.
Parameters
----------
image : ndarray
Image to drift correct.
shifts : ndarray
Amount to shift each image at each timepoint.
Returned from skimage.feature.register_translation()
@GenevieveBuckley
GenevieveBuckley / setup.cfg
Created September 24, 2018 05:29 — forked from althonos/setup.cfg
A `setup.cfg` template for my Python projects
# https://gist.github.com/althonos/6914b896789d3f2078d1e6237642c35c
[metadata]
name = {name}
version = {version}
author = Martin Larralde
author-email = martin.larralde@ens-paris-saclay.fr
home-page = https://github.com/althonos/{name}
description = {description}
long-description = file: README.rst, CHANGELOG.rst
@GenevieveBuckley
GenevieveBuckley / requirements.txt
Last active March 14, 2019 23:55
Template requirements.txt file
pytest
pytest-cov
pytest-flake8
coveralls
@GenevieveBuckley
GenevieveBuckley / .travis.yml
Created September 24, 2018 06:00
Template for Travis CI integration
language: python
python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
- "3.7"
before_install:
- pip install -r requirements.txt
install:
@GenevieveBuckley
GenevieveBuckley / environment.yml
Last active March 14, 2019 23:55
Template conda environment.yml file
name: envname
channels:
- defaults
- conda-forge
dependencies:
- python=3
- pytest
- pytest-cov
- pytest-flake8
- coveralls
@GenevieveBuckley
GenevieveBuckley / logging.py
Created October 12, 2018 05:17
Logging in python - setting up output to file and terminal simultaneously
import time
import logging
# See the docs: https://docs.python.org/3/library/logging.html
timestamp = time.strftime('%d-%b-%Y_%H-%M%p', time.localtime())
log_filename = "path/to/log.txt"
logging.basicConfig(
format="%(asctime)s %(message)s",
level=logging.DEBUG,
@GenevieveBuckley
GenevieveBuckley / illumination_correction.py
Last active November 2, 2018 02:25 — forked from DragaDoncila/file_processes.py
microscopium illumination correction script
import os
import re
from microscopium import io
from microscopium.preprocess import correct_multiimage_illumination
from microscopium.preprocess import find_background_illumination
def main():
IMAGE_FILE_PATH = "/data/"
@GenevieveBuckley
GenevieveBuckley / .travis.yml
Last active March 14, 2019 23:55
Template for Travis CI integration using conda (remember to replace myenv)
language: python
python:
- "3.5"
- "3.6"
install:
- sudo apt-get update
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
@GenevieveBuckley
GenevieveBuckley / checkout_pull_request_locally.md
Created November 13, 2018 03:10
Checkout a git pull request locally