Skip to content

Instantly share code, notes, and snippets.

View synapticarbors's full-sized avatar

Joshua Adelman synapticarbors

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@synapticarbors
synapticarbors / replicasperbin_plugin.py
Last active June 12, 2020 17:13
WESTPA plugin example
from __future__ import division
import logging
import numpy as np
log = logging.getLogger(__name__)
class ReplicasPerBinDriver(object):
def __init__(self, sim_manager, plugin_config):
super(ReplicasPerBinDriver, self).__init__()
@synapticarbors
synapticarbors / init.sh
Created May 20, 2020 22:26
odld with restructured westpa
rm -f west.h5
BSTATES="--bstate initial,1.0"
#TSTATES="--tstate drift,10.01 --tstate bound,1.3"
#TSTATES="--tstate bound,1.2"
w_init $BSTATES $TSTATES "$@"
@synapticarbors
synapticarbors / setup.py
Last active May 31, 2019 18:40
Simple illustration of Cython error
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy as np
include_dir = np.get_include()
extensions = [
Extension('testlib', ['testlib.pyx', ], include_dirs=[include_dir, ])
@synapticarbors
synapticarbors / numba_test.py
Created July 11, 2018 15:53
Numba implementation of
from __future__ import print_function
import numba as nb
import random
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
@synapticarbors
synapticarbors / test.py
Created July 8, 2018 01:03
Bokeh issue
import numpy as np
from bokeh.layouts import column, row
from bokeh.models import CustomJS, ColumnDataSource, Slider
from bokeh.plotting import figure, output_file, show
from bokeh.core.property.containers import PropertyValueDict
output_file('test.html')
@synapticarbors
synapticarbors / tsp-portrait2.py
Last active April 30, 2018 15:00
Traveling Salesman Portrait
'''
This script is based on the original work of Randal S. Olson (randalolson.com) for the Traveling Salesman Portrait project.
http://www.randalolson.com/2018/04/11/traveling-salesman-portrait-in-python/
Please check out the original project repository for information:
https://github.com/rhiever/Data-Analysis-and-Machine-Learning-Projects
The script was updated by Joshua L. Adelman, adapting the work of Antonio S. Chinchón described in the following blog post:
https://fronkonstin.com/2018/04/17/pencil-scribbles/
@synapticarbors
synapticarbors / allocations-example.ipynb
Created March 6, 2017 16:43
Example of allocating contribution to 3 funds based on desired target percents
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@synapticarbors
synapticarbors / test.pyx
Created September 19, 2016 13:45
Minimal Example that demonstrates Cython compilation bug introduced after 0.23
from tlib import *
from tlib cimport *
import numpy as np
cimport numpy as np
class A(object):
def main(self, np.int32_t ix):
@synapticarbors
synapticarbors / test_nb_roll.py
Created September 2, 2016 18:46
Numba implementation of np.roll
import numpy as np
import numba as nb
from numba import types
from numba.extending import overload_method
@overload_method(types.Array, 'take')
def array_take(arr, indices):
if isinstance(indices, types.Array):