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
""" | |
A week-by-week comparison of deaths caused by influenza and COVID-19 un the United States. | |
CDC influenza / pneumonia data: | |
https://www.cdc.gov/flu/weekly/#S2 | |
COVID19 data: | |
http://www.healthdata.org/covid/data-downloads | |
""" |
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
# extended from https://gist.github.com/HazenBabcock/8d1042f564dcaee60c3a3972f2d56999 | |
class ImageData(object): | |
"""Contains information about one or more acquired frames. | |
""" | |
def __init__(self, data, meta): | |
self._data = data | |
self._meta = meta |
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
""" | |
Goals: | |
- Extensible data modeling in python | |
- Does _not_ use inheritance as a mechanism for model extension | |
- Lightweight / simple infrastructure | |
- Data objects have reasonably nice user API | |
""" | |
class Model: | |
"""Base class providing infrastructure for composable data modeling |
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 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
""" | |
Demonstrates basic interaction with HDF5 library using python / ctypes | |
""" | |
import ctypes | |
# load library (this would be platform-dependent) | |
hdf5 = ctypes.cdll.LoadLibrary('libhdf5.so') | |
# Define constants |
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 zlib | |
import struct | |
def make_png(data): | |
""" | |
Convert numpy array to PNG byte array. | |
*data* must be (H, W, 4) with dtype=ubyte | |
""" |
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
# -*- coding: utf8 -*- | |
""" | |
Constrained delaunay implementation based on | |
Domiter, V. and Žalik, B. | |
Sweep‐line algorithm for constrained Delaunay triangulation | |
(this implementation is not complete) | |
""" |
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
""" | |
pep8 violations: | |
E121,E123,E126,E201,E202,E203,E221,E222,E226,E227,E228,E231,E241,E251, | |
E302,E303,E401,E701,W291,W293,W391 | |
Proposed style guidelines: | |
1. Is this code sufficiently readable? | |
2. Does the formatting cause extra effort for other people? |
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 pyqtgraph as pg | |
from pyqtgraph.Qt import QtGui, QtCore | |
pg.mkQApp() | |
## Create window with two ImageView widgets | |
win = QtGui.QMainWindow() | |
win.resize(800,800) | |
win.setWindowTitle('pyqtgraph example: DataSlicing') | |
cw = QtGui.QWidget() | |
win.setCentralWidget(cw) |