Skip to content

Instantly share code, notes, and snippets.

View russelljjarvis's full-sized avatar
:octocat:
Focusing

Russell Jarvis russelljjarvis

:octocat:
Focusing
View GitHub Profile
@russelljjarvis
russelljjarvis / gist:0aa2bf06def6d3639d2774c87a5b0a27
Last active June 3, 2021 11:30
javascript localStorage (check cache)
if (localStorage.getItem("localnet") === null) {
network = drawGraph();
localStorage.setItem('localnet', JSON.stringify(network));
}else{
network = localStorage.getItem('localnet')
from typing import Any, Dict, List, Optional, Tuple, Type, Union, Text
import pickle
import seaborn as sns
import os
import copy
import numpy as np
from collections.abc import Iterable
import pandas as pd
import quantities as pq
from deap import tools
def _get_offspring_time_diminishing_eta(parents, toolbox, cxpb, mutpb,gen, ngen):
'''return the offspring, use toolbox.variate if possible'''
BOUND_LOW = []
BOUND_UP = []
NDIM = len(parents[0])
fit_dim = len(parents[0].fitness.values)
for x in range(0,len(parents[0])):
@russelljjarvis
russelljjarvis / stochastic_gd.jl
Created November 24, 2021 07:12
stochastic gradient descent /ADAM julia
ENV["PYTHON"] = "/opt/conda/bin/python"
using Conda
using ModernGL
using PyCall;
pushfirst!(PyVector(pyimport("sys")["path"]),"")
pushfirst!(PyVector(pyimport("sys")["path"]),"/opt/conda/bin/python")
pushfirst!(PyVector(pyimport("sys")["path"]),"/home/jovyan/neuronunit")
using SpikingNN
using Distributions
using Distributions: sample
"""
This model/code works with the standard Pkg.add("SpikingNN.jl") it does not work with the other git branches such as refactor/kd which
may have more recent code added)
##
# Install from:
# https://geomdata.gitlab.io/hiveplotlib/basic_usage.html
##
from hiveplotlib import hive_plot_n_axes
from hiveplotlib.converters import networkx_to_nodes_edges
from hiveplotlib.viz import hive_plot_viz_mpl
from matplotlib.lines import Line2D
import networkx as nx
@russelljjarvis
russelljjarvis / python
Created August 31, 2022 07:25
Get Fly Connectome.
#!/usr/bin/env python
# coding: utf-8
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from tqdm.notebook import tqdm
import navis
import pickle
import os
import navis
@russelljjarvis
russelljjarvis / Dockerfile
Last active October 12, 2022 03:56
Dockerfile_lava
FROM jupyter/base-notebook
USER root
RUN apt update
RUN apt install -y git
USER jovyan
WORKDIR $HOME
RUN conda install -c conda-forge micromamba
RUN conda install poetry matplotlib pandas jupyterlab
RUN git clone https://github.com/lava-nc/lava.git
WORKDIR lava
import numpy as np
import pandas as pd
import json
import pickle
from pathlib import Path
from sonata.circuit import File
from sonata.reports.spike_trains import SpikeTrains
import pygenn
import matplotlib.pyplot as plt
from GLIF_models import GLIF1
@russelljjarvis
russelljjarvis / Dockerfile
Last active February 14, 2023 03:58
Example of reproducible building
https://github.com/scidash/sciunit/blob/master/docker/Dockerfile
```
FROM jupyter/datascience-notebook
RUN apt-get update && \
apt-get upgrade -y
# Install Python, pip and swig
RUN apt-get install -yq --no-install-recommends python3-dev python3-pip swig gosu nano