npz preview

This commit is contained in:
2021-08-11 08:00:49 +02:00
parent ef68cae1c0
commit ea1dee10d0

View File

@@ -15,6 +15,7 @@ export LANG=en_US.UTF-8
export KRB5_CONFIG=".etcfiles/krb5.conf" export KRB5_CONFIG=".etcfiles/krb5.conf"
export EDITOR="vim" export EDITOR="vim"
export OMPI_MCA_opal_cuda_support=0
alias dotfiles="/usr/bin/git --git-dir=$HOME/.dotfiles.git --work-tree=$HOME" 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" 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 # Inspect .npz files
npz_py_str="$(cat << EOM npz_py_str="$(cat << EOM
from sys import argv 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: class Wrap:
def __init__(self, fname): def __init__(self, fname):
import numpy as np
n = np.load(fname, allow_pickle=True) n = np.load(fname, allow_pickle=True)
files = n.files files = n.files
globs = globals()
print('Contains files', files) print('Contains files', files)
for f in files: for f in files:
setattr(self, f, n[f]) 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 EOM
)" )"
@@ -60,6 +69,7 @@ source_existing ~/.python-venv.kuba/bin/activate
# Source lmod module setup # Source lmod module setup
source_existing /usr/share/lmod/lmod/init/profile source_existing /usr/share/lmod/lmod/init/profile
case $(hostname) in case $(hostname) in
vera* ) vera* )
module use "$HOME/.modules.kuba/" module use "$HOME/.modules.kuba/"