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 zipfile | |
zout = zipfile.ZipFile('nmf.zip', "w", zipfile.ZIP_DEFLATED) # <--- this is the change you need to make | |
zout.write('nmf.h5') | |
zout.close() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
soffice --headless --convert-to xlsx:"Calc MS Excel 2007 XML" *.csv --outdir <output folder> |
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 | |
apt-get update | |
apt-get upgrade -y | |
apt-get install -y autoconf libtool libxext-dev libncurses5-dev bison flex apt-utils wget | |
cd $HOME | |
git clone https://github.com/nrnhines/nrn | |
cd nrn | |
./build.sh | |
./configure --prefix=`pwd` --with-nrnpython=/usr/bin/python3 --without-iv |
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 | |
sudo apt-get update | |
sudo apt-get install -y libxext-dev libncurses5-dev autoconf libtool bison flex | |
cd ~ | |
git clone https://github.com/nrnhines/nrn | |
cd nrn | |
./build.sh | |
./configure --prefix=`pwd` --with-nrnpython=python3 --without-iv |
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
def unique_row(a): | |
b = np.ascontiguousarray(a).view(np.dtype((np.void, a.dtype.itemsize * a.shape[1]))) | |
_, idx = np.unique(b, return_index=True) | |
unique_a = a[idx] | |
return unique_a |
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
def lfactorial(n): | |
from scipy.special import gammaln | |
return gammaln(n+1) | |
def lchoose(n, k): | |
from scipy.special import gammaln |
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 | |
git clone https://github.com/pyenv/pyenv .pyenv | |
echo 'export PYENV_ROOT="/.pyenv"' >> ~/.bashrc | |
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(pyenv init -)"' >> ~/.bashrc | |
exec $SHELL | |
pyenv install miniconda3-latest | |
pyenv shell miniconda3-latest | |
conda install numpy scipy jupyter matplotlib scikit-learn |
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
def load_h5_data(file_name): | |
with h5py.File(file_name,'r') as f: | |
return {key:f[key][:] for key in list(f.keys())} | |
def detect_soma_centroid(M): | |
""" | |
detect the coordinate of soma on stack image. | |
Return |
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
def rotate_roi(d): | |
ang_deg = d['wParamsNum'][31] # ratoate angle (degree) | |
ang_rad = ang_deg * np.pi / 180 # ratoate angle (radian) | |
d_rois = d['ROIs'] | |
d_rois_rot = scipy.ndimage.interpolation.rotate(d_rois, ang_deg) | |
(shift_x, shift_y) = 0.5 * (np.array(d_rois_rot.shape) - np.array(d_rois.shape)) | |
(cx, cy) = 0.5 * np.array(d_rois.shape) |
NewerOlder