This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' bighead - show subset in each dimension | |
#' @description like head but in all dimensions | |
#' @param obj - indexable object: vector, data.frame, matrix, or array | |
#' @param ntotal - total maximum elements to show | |
bighead <- function(obj, ntotal=100){ | |
# dimension of object (dataframe = 2D) | |
dims <- dim(obj) | |
# vectors has NULL dim. Special case: set dim to length | |
if(is.null(dims)) dims <- c(length(obj)) | |
ndim <- length(dims) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global $conf; | |
$my_pages = file($conf['indexdir'] . '/page.idx'); | |
# don't care about titles -- but might in the future | |
#$my_titles = file($conf['indexdir'] . '/title.idx'); | |
# $title = trim($my_titles[$id]); | |
# $title = empty($title)?($key."**"):$title; | |
$my_dates_html = array(); | |
foreach($my_pages as $id => $page) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get needed libraries | |
install.packages(c('remotes','readxl', 'ggplot2')) | |
remotes::install_github('LabNeuroCogDevel/LNCDR') | |
library(LNCDR) | |
# read in data | |
# expects a row per visit with a column for id shared across visit and age at visit | |
# TODO: replace my_data.xlsx with actual excel document path/name | |
mydata <- readxl::read_xlsx("my_data.xlsx") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot) | |
library(gamm4) | |
library(dplyr) | |
library(checkmate) # for expect_subset dataframe names test | |
met_res_for_roi <- function(MRSI_input, this_roi, met_name, minage=18, maxage=25) { | |
# have columns we need | |
expect_subset(c("roi", "age", "dateNumeric", met_name), names(MRSI_input)) | |
roi_met <- MRSI_input %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
teapot: teapot.cc | |
g++ -o teapot teapot.cc -lGL -lGLU -lglut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(dplyr) | |
library(cowplot) | |
theme_set(theme_cowplot()) | |
load("ds2_long.rdata") | |
# Smith is different than the other two | |
combine_ds2_long %>% split(.$study) %>% lapply(function(x) summary(x$value)) %>% bind_rows | |
# Min. `1st Qu.` Median Mean `3rd Qu.` Max. `NA's` | |
# <table> <table> <table> <table> <table> <table> <table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
colors={'255, 255, 0': 'Yellow', '0, 255, 0': 'Green', '255, 0, 255': 'Magenta', '255, 0, 0': 'Red', '0, 255, 255': 'Cyan', '0, 0, 255': 'Blue' }; | |
cnt={}; | |
a=[... document.querySelectorAll('div[style~="background-color:"]')].map(x=>colors[x.getAttribute('style').replace(/.*background-color: rgb\((.*?)\); color.*/,'$1')]).forEach(function(x) {cnt[x] = cnt[x]===undefined?1:cnt[x]+1}); | |
Object.keys(cnt).forEach(k=>$('font[title="'+k+'"]').children[2].innerHTML+= ", " + cnt[k] + "terr.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(dplyr) | |
library(tidyr) | |
theme_set(cowplot::theme_cowplot()) | |
eog <- read.csv('eog_cal/eeg_data_20200921.csv') | |
subjData <- | |
eog %>% | |
unite(ld8, LunaID, ScanDate) %>% # remove LunaID and scanDate columns. replace with ld8 | |
mutate_at(vars(matches('Error')), abs) %>% # abs delta columns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def create_key(template, outtype=('nii.gz',), annotation_classes=None): | |
if template is None or not template: | |
raise ValueError('Template must be a valid format string') | |
return template, outtype, annotation_classes | |
def infotodict(seqinfo): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# 20200414WF - init | |
# get all neuro study subjects by cursor | |
# | |
CURSORS=( | |
"eyJvZmZzZXQiOjI1fQ==" \ | |
"eyJvZmZzZXQiOjEwMH0=" \ |
NewerOlder