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
# Steve's adaptation of VEEGAN example: | |
# https://github.com/akashgit/VEEGAN/blob/master/VEEGAN_2D_RING.ipynb | |
# to TensorFlow 2 + Keras, with the TensorFlow Probabilities library: | |
# https://blog.tensorflow.org/2019/03/variational-autoencoders-with.html | |
# | |
# Stephen Sinclair <radarsat1@gmail.com> | |
# Google Colab version here: | |
# https://colab.research.google.com/drive/1dSW7Yn8okef-ng-Inkev205L2Gy6_MIx |
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
/* Test for collision points locations generated by purterbation rotations in Bullet Physics */ | |
#define BT_USE_DOUBLE_PRECISION | |
#include <BulletCollision/CollisionDispatch/btCollisionObject.h> | |
#include <BulletCollision/CollisionDispatch/btCollisionWorld.h> | |
#include <BulletCollision/CollisionDispatch/btCollisionDispatcher.h> | |
#include <BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h> | |
#include <BulletCollision/CollisionShapes/btBoxShape.h> | |
#include <BulletCollision/CollisionShapes/btConvexHullShape.h> |
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 Python translation of the Brownian Surface function from | |
# http://www.mathworks.com/matlabcentral/fileexchange/38945-fractional-brownian-field-or-surface-generator | |
# | |
# More info, check https://en.wikipedia.org/wiki/Brownian_surface | |
# | |
# Example output: http://i.imgur.com/MKHxA6N.png | |
import numpy as np | |
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
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
#!/bin/bash | |
# tile four videos using ffmpeg | |
VID1="$1" | |
VID2="$2" | |
VID3="$3" | |
VID4="$4" | |
OUT="$5" | |
# ffmpeg's complex filter graph is powerful! |
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
#!/usr/bin/env python | |
"""Provide a parallelized version of scipy.optimize.brute for 1-, 2-, or 3-dimensional arguments. | |
Needed to parallelize the steps of a grid-based global optimization, so I copied the "brute" code, replaced "vectorize" with nested maps for specific numbers of arguments, and replaced the outer-most map() with a ThreadPool.map(). Likely this could be generalized to any number of arguments (e.g. by zipping the grid and iterating in parallel over the tuples) but I didn't feel like figuring that out just now. | |
This should perform help for routines that spend a lot of time in numpy code, but I imagine that a pure Python routine might get caught-up by the GIL. Possibly using a process pool instead of a thread pool would fix it. Currently I'm using it for a routine that spends all its time in fftconvolve() so it wasn't a problem for me. | |
parbrute() takes the same arguments as scipy.optimize.brute(), with the addition of thread=N for the number of threads you want in the pool. Defaults to 4 |