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 | |
import cloudpickle | |
import multiprocessing as mp | |
class RunAsCUDASubprocess: | |
def __init__(self, num_gpus=0, memory_fraction=0.8): | |
self._num_gpus = num_gpus | |
self._memory_fraction = memory_fraction | |
@staticmethod |
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 numpy as np | |
from keras.models import Model, Sequential | |
from keras.layers import Input, Dense, Activation | |
from keras.utils.data_utils import Sequence | |
from keras.losses import categorical_crossentropy | |
from keras.optimizers import SGD | |
class CustomSequence(Sequence): | |
def __init__(self, x_set, y_set, batch_size): | |
self.X,self.y = x_set,y_set |
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
BEGIN { FS=OFS="," } | |
{ | |
for (rowNr=1;rowNr<=NF;rowNr++) { | |
cell[rowNr,NR] = $rowNr | |
} | |
maxRows = (NF > maxRows ? NF : maxRows) | |
maxCols = NR | |
} | |
END { | |
for (rowNr=1;rowNr<=maxRows;rowNr++) { |
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
#!/bin/bash | |
# call: "renameOffFilesByLst.sh norm/157" | |
runnum=${1##*/} | |
class=${1%/*} | |
destdir="${class}_off_named/$runnum" | |
listfile="0000${runnum}_c2.lst" | |
echo $listfile | |
liststring=$(cat $listfile |tr "\n" " ") |
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
module.exports = class BaseCtrl | |
@register: (module, name) -> | |
name ?= @name || @toString().match(/function\s*(.*?)\(/)?[1] | |
module.controller name, @ | |
@inject: (annotations...) -> | |
ANNOTATION_REG = /^(\S+)(\s+as\s+(\w+))?$/ | |
@annotations = annotations.map (annotation) -> |
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
#!/bin/bash | |
lines=1 | |
while read -r line; do | |
loniresults="/Users/alex/Projects/AtheyLab/LONI_Results/ShapeTranslator_2.ShapeOutputDirectory-" | |
printf -v idx "%02d" $lines | |
currdir=$loniresults$idx | |
filename="/182_QEM_SubDiv.off" | |
target=$currdir$filename | |
destdir=${1%_c0.lst} |
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
for i in $(ls | egrep '*g000_mask-[[:digit:]]{3}\.nii.gz'); do | |
m=${i%.nii.gz}; | |
echo $m; | |
mm="$m-nucleoli-[[:digit:]]{4,10}\.nii.gz$"; | |
nn=$(ls | egrep $mm | wc -l); | |
echo $nn; | |
done |
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
// Viterbi algorithm for finding hidden relationships | |
function Viterbi(data) { | |
var V = [{}]; | |
var path = {}; | |
// Initialize base cases (t == 0) | |
for(var i=0;i<data.states.length;i++) { | |
var state = data.states[i]; | |
V[0][state] = data.start_probability[state] * data.emission_probability[state][data.observations[0]]; | |
path[state] = [state]; |