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 | |
import autoscript_toolkit.vision as vision_toolkit | |
def cut_crosshair_patch(center_coordinate_pixels, image): | |
"""Returns cropped image region with crosshair drift correction reference. | |
Parameters | |
---------- |
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
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 | |
=Limits(min=-2.0009707e-05,max=2.0009707e-05)) | |
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- | |
05,max=5e-05)) |
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 | |
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 |
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 io import StringIO | |
def double(): | |
x = input("Enter an integer: ") | |
return int(x) * 2 | |
def adding(): | |
x = float(input('Enter the first number')) |
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
repos: | |
- repo: https://github.com/ambv/black | |
rev: stable | |
hooks: | |
- id: black | |
language_version: python3.7 | |
- repo: https://github.com/pre-commit/pre-commit-hooks | |
rev: v1.2.3 | |
hooks: | |
- id: flake8 |
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 argparse | |
def bar(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('a') | |
parser.add_argument('b') | |
parser.add_argument('c') | |
args = parser.parse_args() | |
return args |
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 contextlib import redirect_stderr | |
import io | |
import time | |
import sys | |
from tqdm import tqdm | |
from gooey import Gooey, GooeyParser | |
@Gooey(progress_regex=r"(\d+)%") |
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 sys | |
import contextlib | |
@contextlib.contextmanager | |
def output_wrapper(): | |
save_stdout = sys.stdout | |
save_stderr = sys.stderr | |
sys.stdout = open('stdout.log', 'a') | |
sys.stderr = open('stderr.log', 'a') | |
yield | |
sys.stdout = save_stdout |