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 / 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
@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
##
# 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
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)
@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")
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])):
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
@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')
@russelljjarvis
russelljjarvis / 3dwiring.py
Last active April 29, 2021 12:01
parallel 3d spatial euclidian wiring of neuron morphologies with NEURON simulator.
'''
Author information. This is an extension to the Utils class from Allen Brain API.
The parallel wiring related functions are written by Russell Jarvis [email protected]
'''
from allensdk.model.biophys_sim.neuron.hoc_utils import HocUtils
import logging
import glob
from mpi4py import MPI
@russelljjarvis
russelljjarvis / zscore.py
Created July 21, 2020 04:48 — forked from mnguyenngo/zscore.py
Code to calculate and plot the z-score
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as scs
def z_val(sig_level=0.05, two_tailed=True):
"""Returns the z value for a given significance level"""
z_dist = scs.norm()
if two_tailed:
sig_level = sig_level/2
area = 1 - sig_level