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 / 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 / .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 / 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 / checkout_pull_request_locally.md
Created November 13, 2018 03:10
Checkout a git pull request locally
@GenevieveBuckley
GenevieveBuckley / python_testing.md
Last active November 13, 2018 04:34
Python testing and coverage reports with pytest and pytest-cov

Python testing

pytest

https://docs.pytest.org/en/latest/usage.html

pytest
pytest path/to/tests/
pytest path/to/tests/test_file.py
pytest path/to/tests/test_file.py::test_func
pytest path/to/tests/test_file.py::TestClass
@GenevieveBuckley
GenevieveBuckley / bokeh_jupyter_notebook.py
Created November 15, 2018 00:34
bokeh in a jupyter notebook
from bokeh.io import push_notebook, output_notebook, show, save
from bokeh.layouts import row, column, layout
from bokeh.plotting import figure
output_notebook()
@GenevieveBuckley
GenevieveBuckley / ..git-pr.md
Created November 19, 2018 03:53 — forked from gnarf/..git-pr.md
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@GenevieveBuckley
GenevieveBuckley / quick_pickle.py
Created January 16, 2019 02:34
Pickle AdornedImage objects
import pickle
from autoscript_sdb_microscope_client import SdbMicroscopeClient
from autoscript_sdb_microscope_client.enumerations import *
from autoscript_sdb_microscope_client.structures import *
microscope = SdbMicroscopeClient()
microscope.connect()
object_to_pickle = microscope.imaging.get_image()