Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
whuie2
experiment-control
Commits
8bb3dd5c
Commit
8bb3dd5c
authored
Apr 18, 2022
by
ivette2
Browse files
helper functions for GUI
parent
0c63fb9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
GUI-Comm.py
0 → 100644
View file @
8bb3dd5c
import
cmot_tof
,
freespace_green_resonance
,
narrow_cooling_tweezer_align
'''
"cmot_tof.py" =="CMTF"
"freespace_green_resonance.py" =="FSGR"
"narrow_cooling_tweezer_align.py" == "NCTA"
'''
outdir
=
""
def
create_ss_obj
(
tag
,
params
=
0.0
):
if
(
tag
==
"CMTF"
):
SEQ
=
cmot_tof
.
make_sequence
(
"seq"
,
params
)
return
SEQ
if
(
tag
==
"FSGR"
):
SEQ
=
freespace_green_resonance
.
make_sequence
(
"seq"
)
return
SEQ
if
(
tag
==
"NCTA"
):
SEQ
=
narrow_cooling_tweezer_align
.
make_sequence
(
"seq"
,
params
)
return
SEQ
def
sequences_in_super
(
Supersequence
):
sequences_dict
=
Supersequence
.
to_primitives
()
return
sequences_dict
def
save_altered_super
(
seqs_dict
):
new_super_seq
=
SuperSequence
.
from_primitives
(
outdir
,
"new_SSS"
,
seqs_dict
)
new_super_seq
.
save
()
def
events_in_seq
(
name
,
seq
):
supsequence
=
SuperSequence
(
outdir
,
name
,
seq
)
sequenc
=
supsequence
.
by_times
()
print
(
sequenc
)
print
(
type
(
sequenc
))
'''
sequence = ssequence.to_sequence()
events_dict = sequence.to_primitives()
for i in events_dict.keys():
print(i)
return events_dict
'''
def
save_object
(
obj
,
filename
):
with
open
(
filename
,
'wb'
)
as
outp
:
pickle
.
dump
(
obj
,
outp
,
pickle
.
HIGHEST_PROTOCOL
)
def
create_dig_event
(
board
,
channel
,
voltage
,
state
,
name
,
time
):
eventaddr
=
'Events/'
+
name
+
'_dig'
+
'.txt'
newevent
=
open
(
eventaddr
,
'w'
)
#Fix string -> ints for mask and state
event
=
Event
(
EventType
.
Digital
,
board
,
connector
=
0
,
mask
=
ch
(),
state
=
ch
())
save_object
(
event
,
eventaddr
)
def
create_ana_event
(
board
,
channel
,
voltage
,
state
,
name
,
time
):
eventaddr
=
'Events/'
+
name
+
'_ana'
+
'.txt'
newevent
=
open
(
eventaddr
,
'w'
)
event
=
Event
(
EventType
.
Analog
,
board
,
connector
=
0
,
mask
=
ch
(),
state
=
ch
())
save_object
(
event
,
eventaddr
)
def
create_supersequence
():
pass
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment