This file contains hidden or 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 hidden or 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 |
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 hidden or 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')) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
from PyQt5.QtCore import Qt | |
from PyQt5.QtGui import QImage, QPixmap, QPalette, QPainter | |
from PyQt5.QtPrintSupport import QPrintDialog, QPrinter | |
from PyQt5.QtWidgets import QLabel, QSizePolicy, QScrollArea, QMessageBox, QMainWindow, QMenu, QAction, \ | |
qApp, QFileDialog | |
This file contains hidden or 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
"""Example of a non-blocking PyQt while loop callback using threading | |
Example adapted from this StackOverflow answer: | |
https://stackoverflow.com/questions/22340230/python-pyqt-how-run-while-loop-without-locking-main-dialog-window?answertab=votes#tab-top | |
Ported from PyQt4 to PyQt5 using the tool pyqt4topyqt5: | |
https://github.com/rferrazz/pyqt4topyqt5 | |
""" | |
import os |