I hereby claim:
- I am tclarke on github.
- I am retrev (https://keybase.io/retrev) on keybase.
- I have a public key ASATQZGBLX_lq8tVGEiLqRiQYNYsEcBLuyEsuG6MFK5JGwo
To claim this, I am signing this object:
from time import perf_counter | |
from datetime import timedelta | |
class PerfTimer: | |
def __init__(self, name="Timer"): | |
""" Create a performance timer context manager. | |
These output the start and end of a block of code and the time it took to execute. | |
They can be nested for hierarchical timing. | |
@param name The name to output in the status messages |
#!/usr/bin/env python3 | |
import numpy as np | |
## | |
# Define different resistor series. You almost never see e3 and e6 but they are here for completeness. | |
# E96 are widely available and generally inexpensive so that's the default series. | |
# 40% tolerance | |
e3 = np.array([1. , 2.2, 4.7]) |
I hereby claim:
To claim this, I am signing this object:
for k, v in os.environ.iteritems(): | |
if k.startswith("MYAPP_"): | |
try: | |
locals()[k[6:]] = type(locals()[k[6:]])(v) | |
except KeyError: | |
locals()[k[6:]] = v |
import numpy as np | |
import cv2 | |
# cellular automata class based on code from http://www.loria.fr/~rougier/teaching/numpy/scripts/game-of-life-numpy.py | |
class CA(object): | |
def __init__(self, s, b, shape, init_fill=0.1): | |
assert(type(s) == type([]) and type(b) == type([])) | |
self.s,self.b = s,b | |
self.z = (np.random.random(shape) < init_fill).astype("uint8") |
[ 54%] Building CXX object src/CMakeFiles/pdalcpp.dir/UserCallback.cpp.o | |
[ 54%] Building CXX object src/CMakeFiles/pdalcpp.dir/Utils.cpp.o | |
[ 55%] Building CXX object src/CMakeFiles/pdalcpp.dir/Vector.cpp.o | |
[ 55%] Building CXX object src/CMakeFiles/pdalcpp.dir/Writer.cpp.o | |
[ 55%] Building C object src/CMakeFiles/pdalcpp.dir/third/md5-pdal.c.o | |
[ 56%] Building CXX object src/CMakeFiles/pdalcpp.dir/XMLSchema.cpp.o | |
[ 56%] Building CXX object src/CMakeFiles/pdalcpp.dir/drivers/buffer/Reader.cpp.o | |
[ 57%] Building CXX object src/CMakeFiles/pdalcpp.dir/drivers/faux/Reader.cpp.o | |
[ 57%] Building CXX object src/CMakeFiles/pdalcpp.dir/drivers/faux/Writer.cpp.o | |
[ 57%] Building CXX object src/CMakeFiles/pdalcpp.dir/drivers/las/GeotiffSupport.cpp.o |
import numpy | |
def fib(a,b): | |
"Generator for the fibonacci sequence starting at position a,b" | |
while True: | |
yield b | |
a,b=b,a+b | |
def ld(v): | |
"Determine the left-most digit in v" |
import zmq | |
def publisher(): | |
c=zmq.Context() | |
s=c.socket(zmq.PUB) | |
s.bind('tcp://127.0.0.1:1234') | |
s.send("foobie") | |
def subscriber(): | |
c=zmq.Context() |
DataAccessor acc = pRaster->getDataAccessor(); | |
DataAccessor outacc = pOutRaster->getDataAccessor(writableDataRequest.release()); | |
/** code to flip horizontally **/ | |
for (int row = 0; row < numrows; ++row) { | |
VERIFY(acc.valid() && outacc.valid()); | |
memcpy(outacc->getRow(), acc->getRow(), rowSizeInBytes); | |
// note: pixeldatatype is the C++ type for BSQ..for BIP, you'll need to use a struct..somthing like this for 10 bands 2-byte data | |
// struct {uint16_t data[10];} | |
// or just use a second loop with appropriate memcpy's | |
std::reverse((pixeldatatype*)outacc->getRow(), ((pixeldatatype*)outacc->getRow()) + pixelsPerRow); |