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
Ntrl_class = 720; | |
% can change effect strength here | |
effect_mean = 0.2; | |
% effect_mean = 0.1; | |
r = rng(999); | |
% stimulus values (ie 0: standard, 1: deviant) | |
y = [zeros(Ntrl_class,1); ones(Ntrl_class,1)]; | |
% class 0 data: standard norml | |
x0 = randn(Ntrl_class,1); | |
% class 1 data: a small difference in mena |
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 python | |
import os | |
import sys | |
import time | |
from datetime import datetime | |
def set_folder_dates(root): | |
for x in os.walk(root, topdown=False): |
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 | |
# | |
# This script is useful if: | |
# - you have a manuscript that you want to upload to the arXiv, | |
# - you are using biblatex, and | |
# - you are using texlive2015 while arXiv is still on texlive2011 | |
# | |
# Put this file in a directory containing the manuscript you want to | |
# upload to arXiv.org, and adapt the paths below. |
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 class_ExtendArray | |
implicit none | |
private | |
type, public :: ExtendArray | |
integer(8) :: capacity | |
integer(8) :: length | |
real(8), pointer :: data(:) | |
real(8), pointer :: buffer(:) |
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 | |
# check given path is an NFS mount | |
FSTYPE="$(df -P -T $1 | tail -n +2 | awk '{print $2}')" | |
# first three characters | |
FSTYPE=${FSTYPE:0:3} | |
if [ "$FSTYPE" = "nfs" ] | |
then | |
RC=0 |
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
function x = rebin(x_in,m) | |
% rebin(x, m) - rebin an integer sequence | |
% | |
% Rebin an already discretised sequence (eg of intger values) into m levels | |
% | |
x_flat = x_in(:); | |
% test for positive integer input | |
if any(mod(x_flat,1)) || (min(x_flat) < 0) |
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 fbin | |
use iso_c_binding | |
implicit none | |
contains | |
subroutine eqpop_bin(X, Nb, Ntrl, Xout) | |
! ARG | |
integer, intent(in) :: Nb, Ntrl | |
real(c_double), intent(in) :: X(Ntrl) | |
integer(c_int8_t), intent(out) :: Xout(Ntrl) | |
! LOC |
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
function d = numbase2dec(x,b) | |
%NUMBASE2DEC Convert base B numerical multivariate array to decimal integer. | |
% NUMBASE2DEC(x,B) converts the multivarate array of base B into its | |
% univariate decimal (base 10) equivalent. | |
% | |
% X should be M x Nt representing Nt different length-M base B words. | |
% | |
% Example | |
% numbase2dec([2; 1; 2],3) returns 23 | |
% |
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
function x = numdec2base(d,b,m) | |
%NUMDEC2BASE Convert decimal univariate integer to base B multivariate vector. | |
% NUMDEC2BASE(D,B,M) returns the representation of D as a length-M base-B | |
% word. | |
% | |
% Examples | |
% numdec2base(23,3) returns [2;1;2] | |
% numdec2base(23,3,5) returns [0;0;2;1;2] | |
% | |
% See also NUMBASE2DEC |
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
function savefaststruct(filename, savestruct) | |
% savefaststruct: fast saves of large arrays to .mat files | |
% | |
% Matlab's 'save' command can be very slow when saving large arrays, | |
% because by default Matlab attempts to use compression. This function | |
% provides a much faster alternative, at the cost of larger files. | |
% | |
% 'savefaststruct' version saves variables from a structure | |
% this avoids the need for evalin which does not work inside | |
% parfor etc. |
NewerOlder