npz preview
This commit is contained in:
14
.bashrc.kuba
14
.bashrc.kuba
@@ -15,6 +15,7 @@ export LANG=en_US.UTF-8
|
||||
|
||||
export KRB5_CONFIG=".etcfiles/krb5.conf"
|
||||
export EDITOR="vim"
|
||||
export OMPI_MCA_opal_cuda_support=0
|
||||
|
||||
alias dotfiles="/usr/bin/git --git-dir=$HOME/.dotfiles.git --work-tree=$HOME"
|
||||
alias dvim="GIT_WORK_TREE='/home/kuba' GIT_DIR='/home/kuba/.dotfiles.git/' vim"
|
||||
@@ -27,17 +28,25 @@ open() { command xdg-open "$@" > /dev/null 2>&1 & }
|
||||
# Inspect .npz files
|
||||
npz_py_str="$(cat << EOM
|
||||
from sys import argv
|
||||
import numpy as np
|
||||
try:
|
||||
import matplotlib.pyplot as plt
|
||||
print('Imported matplotlib.pyplot as plt')
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
class Wrap:
|
||||
def __init__(self, fname):
|
||||
import numpy as np
|
||||
n = np.load(fname, allow_pickle=True)
|
||||
files = n.files
|
||||
globs = globals()
|
||||
print('Contains files', files)
|
||||
for f in files:
|
||||
setattr(self, f, n[f])
|
||||
globs[f] = n[f]
|
||||
|
||||
d = Wrap(argv[1])
|
||||
archive = Wrap(argv[1])
|
||||
print('Global namespace populated with "archive" and all files')
|
||||
EOM
|
||||
)"
|
||||
|
||||
@@ -60,6 +69,7 @@ source_existing ~/.python-venv.kuba/bin/activate
|
||||
# Source lmod module setup
|
||||
source_existing /usr/share/lmod/lmod/init/profile
|
||||
|
||||
|
||||
case $(hostname) in
|
||||
vera* )
|
||||
module use "$HOME/.modules.kuba/"
|
||||
|
||||
Reference in New Issue
Block a user