Skip to content

Instantly share code, notes, and snippets.

Genevieve Buckley GenevieveBuckley

  • Monash University
  • Melbourne
Block or report user

Report or block GenevieveBuckley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
GenevieveBuckley /
Created Sep 17, 2019 — forked from yunwilliamyu/
Redirect Python stderr/stdout for a block
import sys
import contextlib
def output_wrapper():
save_stdout = sys.stdout
save_stderr = sys.stderr
sys.stdout = open('stdout.log', 'a')
sys.stderr = open('stderr.log', 'a')
sys.stdout = save_stdout
GenevieveBuckley /
Last active Sep 17, 2019
Making gooey and tqdm play nice together
from contextlib import redirect_stderr
import io
import time
import sys
from tqdm import tqdm
from gooey import Gooey, GooeyParser
GenevieveBuckley /
Last active Sep 12, 2019
Combining mock patch with pytest's tmpdir fixture
import argparse
def bar():
parser = argparse.ArgumentParser()
args = parser.parse_args()
return args
GenevieveBuckley / .pre-commit-config.yaml
Last active Aug 23, 2019
Git pre-commit hooks with black and flake8
View .pre-commit-config.yaml
- repo:
rev: stable
- id: black
language_version: python3.7
- repo:
rev: v1.2.3
- id: flake8
GenevieveBuckley / save_as_zarr.ipynb
Created Aug 6, 2019
Save OpenSlide tiff image to zarr array
View save_as_zarr.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
GenevieveBuckley /
Last active Aug 13, 2019
Monkeypatching user input with pytest
from io import StringIO
def double():
x = input("Enter an integer: ")
return int(x) * 2
def adding():
x = float(input('Enter the first number'))
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import RectangleSelector
def _select_rectangle_callback(eclick, erelease):
"""eclick and erelease are the press and release events"""
x1, y1 = eclick.xdata, eclick.ydata
x2, y2 = erelease.xdata, erelease.ydata
View beam_shift_limits.txt
In [60]: microscope.beams.electron_beam.beam_shift.limits
Out[60]: Limits2d(limits_x=Limits(min=-2.0009707e-05,max=2.0009707e-05),limits_y
In [61]: microscope.beams.ion_beam.beam_shift.limits
Out[61]: Limits2d(limits_x=Limits(min=-5e-05,max=5e-05),limits_y=Limits(min=-5e-
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
from autoscript_sdb_microscope_client import SdbMicroscopeClient
from autoscript_sdb_microscope_client.enumerations import *
from autoscript_sdb_microscope_client.structures import *
def select_point(image):
You can’t perform that action at this time.