-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
70 lines (64 loc) · 2.3 KB
/
setup.sh
File metadata and controls
70 lines (64 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# Installation script for TopSpin Python API Wrapper
# This script sets up the Python environment and installs dependencies
echo "========================================"
echo "TopSpin Python API Wrapper - Setup"
echo "========================================"
echo ""
# Check if uv is installed
if ! command -v uv &> /dev/null; then
echo "[ERROR] uv is not installed!"
echo "Please install uv first:"
echo " pip install uv"
echo ""
exit 1
fi
echo "[1/4] Installing Python dependencies..."
uv pip install numpy xarray matplotlib adjustText
if [ $? -ne 0 ]; then
echo "[ERROR] Failed to install Python dependencies"
exit 1
fi
echo "[OK] Python dependencies installed"
echo ""
echo "[2/4] Installing TopSpin API package..."
# Install TopSpin API from TopSpin installation directory
if [ -f "D:/topspin/python/examples/bruker_nmr_api-2.1.0-py3-none-any.whl" ]; then
uv pip install "D:/topspin/python/examples/bruker_nmr_api-2.1.0-py3-none-any.whl"
if [ $? -ne 0 ]; then
echo "[ERROR] Failed to install TopSpin API package"
exit 1
fi
echo "[OK] TopSpin API package installed"
elif [ -f "/opt/topspin/python/examples/bruker_nmr_api-2.1.0-py3-none-any.whl" ]; then
uv pip install "/opt/topspin/python/examples/bruker_nmr_api-2.1.0-py3-none-any.whl"
if [ $? -ne 0 ]; then
echo "[ERROR] Failed to install TopSpin API package"
exit 1
fi
echo "[OK] TopSpin API package installed"
else
echo "[WARNING] TopSpin API package not found at D:/topspin/python/examples/"
echo "Please ensure TopSpin is installed at D:/topspin"
echo "Or modify the path in this script to match your TopSpin installation."
fi
echo ""
echo "[3/4] Creating example pulse sequence for testing..."
mkdir -p test_pulseprogram
echo "========================================"
echo "Installation completed successfully!"
echo "========================================"
echo ""
echo "Next steps:"
echo " 1. Activate the virtual environment:"
echo " source .venv/bin/activate"
echo ""
echo " 2. Test the installation:"
echo " python topspin_api.py"
echo ""
echo " 3. Run examples:"
echo " python example_pulse_sequence.py"
echo ""
echo " 4. Open a pulse sequence:"
echo " python example_pulse_sequence.py D:/topspin/examdata/Cyclosporine/1/pulseprogram"
echo ""