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 / fashionmnist.R
Last active June 27, 2023 12:27
Fashion-MNIST in R starter
library(readr)
library(keras)
# By Dominik Krzeminski (dokato)
#' Data downloaded from https://www.kaggle.com/zalando-research/fashionmnist
#' More information is at the ZalandoResearch GitHub:
#' https://github.com/zalandoresearch/fashion-mnist
train.data <- read_csv("fashion-mnist_train.csv",
col_types = cols(.default = "i"))
@dokato
dokato / parcellation_visualization.py
Last active January 11, 2018 16:43
Visualization of brain regions after FreeSurfer parcellation
from __future__ import print_function
import os
import numpy as np
from surfer import Brain
from mayavi import mlab
import nibabel as nib
subjects_folder = os.environ["SUBJECTS_DIR"]
@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
@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"))
)
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'
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'
@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")
)
@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 / 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 / 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>