-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple_open_pulse.py
More file actions
47 lines (35 loc) · 1.25 KB
/
simple_open_pulse.py
File metadata and controls
47 lines (35 loc) · 1.25 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
#!/usr/bin/env python3
"""
Simple pulse sequence opener using TopSpin Python API.
This script demonstrates how to open pulse sequences with minimal code.
Usage (from TopSpin command line):
xpy3 simple_open_pulse.py
Usage (from external terminal, with API server running):
D:\topspin\python\python.exe simple_open_pulse.py
"""
from bruker.api.topspin import Topspin
def main():
"""Open pulse sequence editor in TopSpin."""
print("Opening pulse sequence editor in TopSpin...")
print("=" * 50)
# Initialize TopSpin
top = Topspin()
dp = top.getDataProvider()
# Get current dataset
current = dp.getCurrentDataset()
if current is None:
print("No dataset currently open in TopSpin.")
print("\nTo open a pulse sequence:")
print("1. Open an experiment in TopSpin")
print("2. Run this script again")
print("\nOr directly open pulse sequence editor:")
print(" Type 'edpul' in TopSpin command line")
return
print(f"Current dataset: {current.getIdentifier()}")
# Open pulse sequence editor
print("\nOpening pulse sequence editor...")
current.launch("edpul")
print("Pulse sequence editor opened!")
print("=" * 50)
if __name__ == "__main__":
main()