Skip to content

Instantly share code, notes, and snippets.

View dokato's full-sized avatar

dokato

  • University of Cambridge
  • Cambridge, UK
View GitHub Profile
@dokato
dokato / precomputed.R
Created December 7, 2021 17:18
precomputed
library(nat)
library(jsonlite)
library(float)
#' Based on specification
#' https://github.com/google/neuroglancer/tree/master/src/neuroglancer/datasource/precomputed
# write mesh to single res precomputed format
#meshes = read.neurons("../registration/dns_objs21_reg/")
@dokato
dokato / badges.tex
Created October 15, 2020 17:18
badges sample
\documentclass[a4paper,10pt]{letter}
\usepackage[utf8]{inputenc}
\usepackage[freepin,crossmark]{ticket}
\usepackage{graphicx}
\unitlength=1mm
\ticketSize{52}{78}
\ticketNumbers{2}{3}
\renewcommand{\ticketdefault}{
@dokato
dokato / doughnut_chart.html
Last active June 24, 2020 09:54
Doughnut chart with DoughnutJS
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.min.js"></script>
</head>
<body>
<div width="100px" height="100px">
<canvas id="myChart"></canvas>
</div>
@dokato
dokato / datget.py
Last active June 18, 2020 00:01
siamese.ipynb
import pickle
import itertools
import numpy as np
import tensorflow.keras as keras
with open('HackathonMetadata.pkl','rb') as ff:
metad = pickle.load(ff)
with open('HackathonData_Homology0.pkl','rb') as ff:
homol = pickle.load(ff)
@dokato
dokato / phaseplane.py
Created September 25, 2019 14:15
Simple Phase Plane plot implementation in Matplotlib
import numpy as np
import matplotlib.pyplot as plt
__author__ = 'Dominik Krzeminski (dokato)'
tau = 2
I_ext = 0.5
a = 0.8
b = 0.7
@dokato
dokato / delayed-checkbox.R
Created September 14, 2019 13:43
delayed checkbox
library(shiny)
library(magrittr)
library(ggplot2)
ui <- fluidPage(
checkboxGroupInput("checkbox", "Variables to show:",
c("psavert", "uempmed", "unemploy")),
plotOutput("plot")
)
import os
import mne
from mne.datasets.brainstorm import bst_resting
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as ss
########################## INPUT:
folder = os.path.join(bst_resting.data_path(), 'MEG/bst_resting')
file = 'subj002_spontaneous_20111102_01_AUX_raw.fif'
import os
import mne
from mne.datasets.brainstorm import bst_resting
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as ss
folder = os.path.join(bst_resting.data_path(), 'MEG/bst_resting')
file = 'subj002_spontaneous_20111102_01_AUX_raw.fif'
@dokato
dokato / app_get.R
Created February 16, 2018 12:05
Mini shiny.router example with params
library(shiny)
library(shiny.router)
options(shiny.router.debug = T)
# This generates menu in user interface with links.
menu <- (
tags$ul(
tags$li(a(class = "item", href = "/", "Page")),
tags$li(a(class = "item", href = route_link("other"), "Other page"))
)
@dokato
dokato / orthogonalization.py
Created February 15, 2018 14:13
Find closest orthogonal matrix
import numpy as np
def find_closest_orthogonal_matrix(A):
'''
Find closest orthogonal matrix to *A* using iterative method.
Bases on the code from REMOVE_SOURCE_LEAKAGE function from OSL Matlab package.
Args:
A (numpy.array): array shaped k, n, where k is number of channels, n - data points