Skip to content

Instantly share code, notes, and snippets.

@gwbischof
Last active October 19, 2023 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gwbischof/a3950633a837103ac2705cda92e82127 to your computer and use it in GitHub Desktop.
Save gwbischof/a3950633a837103ac2705cda92e82127 to your computer and use it in GitHub Desktop.
. /Users/gbischof/miniconda3/etc/profile.d/conda.sh
if [ ! -z "$BS_PYTHONPATH" ]; then
if [ ! -z "$PYTHONPATH" ]; then
export PYTHONPATH=$PYTHONPATH:$BS_PYTHONPATH
else
export PYTHONPATH=$BS_PYTHONPATH
fi
fi
# If the above has not defined BS_AN_ENV and BS_AN_PROFILE we will error out
# violently on `conda activate` below.
conda_cmd="conda activate $BS_ENV"
$conda_cmd || exit 1
# Conditionally invoke LD_PRELOAD workaround for 2020-2 profiles.
if [[ "${BS_ENV}" == *"2020-2"* ]]; then
echo "Adding LD_PRELOAD"
export LD_PRELOAD=/opt/conda_envs/${BS_ENV}/lib/libgomp.so
fi
# setup the command we will use to start IPython below
ipython_cmd="ipython --profile=$BS_PROFILE --IPCompleter.use_jedi=False"
if [[ "$BS_PROFILE_DIR" ]]; then
ipython_cmd="$ipython_cmd --ipython-dir=$BS_PROFILE_DIR"
fi
args=$(python -c 'import sys; print(" ".join([x if " " not in x else repr(x) for x in sys.argv[1:]]))' "$@")
cat << EOL
$(tput smul; tput bold)Versions of DSSI software:$(tput sgr0)
$(python -c '\
msg = "Not installed"
try:
import bluesky
bluesky_version = "v{}".format(bluesky.__version__)
except ImportError:
bluesky_version = msg
try:
import ophyd
ophyd_version = "v{}".format(ophyd.__version__)
except ImportError:
ophyd_version = msg
try:
import databroker
databroker_version = "v{}".format(databroker.__version__)
except ImportError:
databroker_version = msg
print(" - Bluesky : {}".format(bluesky_version))
print(" - Ophyd : {}".format(ophyd_version))
print(" - Databroker : {}".format(databroker_version))
')
$(tput smul; tput bold)Links to Bluesky and Databroker tutorials:$(tput sgr0)
- $(tput setaf 4)http://nsls-ii.github.io/bluesky/tutorial.html$(tput sgr0)
- $(tput setaf 4)http://nsls-ii.github.io/databroker/tutorial.html$(tput sgr0)
If you get lost or confused, then we want to know! We have a friendly chat channel:
$(tput bold; tput setaf 1)https://gitter.im/NSLS-II/DAMA$(tput sgr0)
or you can file a bug to let us know where our documentation could be made more clear:
$(tput bold; tput setaf 1)https://github.com/NSLS-II/Bug-Reports/issues$(tput sgr0)
$(tput bold)bsui$(tput sgr0) is running these commands now to start an interactive computing environment for data acquisition:
$ ${conda_cmd}
$ PYTHONPATH=${PYTHONPATH}
$ ${ipython_cmd} ${args}
EOL
$ipython_cmd "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment