Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
PythonControl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PA
Operation
PythonControl
Commits
3fc14cf6
Commit
3fc14cf6
authored
May 30, 2023
by
Alexis GAMELIN
Browse files
Options
Downloads
Patches
Plain Diff
Add switch_injection_mode and set_injection
parent
ae873a9e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
injection.py
+51
-4
51 additions, 4 deletions
injection.py
with
51 additions
and
4 deletions
injection.py
+
51
−
4
View file @
3fc14cf6
...
@@ -62,17 +62,64 @@ def _get_extraction_table(bucket_list):
...
@@ -62,17 +62,64 @@ def _get_extraction_table(bucket_list):
get_extraction_table
=
np
.
vectorize
(
_get_extraction_table
)
get_extraction_table
=
np
.
vectorize
(
_get_extraction_table
)
def
set_SPM_injection
(
bucket_list
,
fine_delay
):
def
switch_injection_mode
(
injection_mode
):
"""
Allow to switch the injection mode.
Parameters
----------
injection_mode :
"
SPM
"
or
"
LPM
"
Injection
"
Short Pulse Mode
"
or
"
Long Pulse Mode
"
.
"""
spm
=
DeviceProxy
(
"
LIN/SY/LOCAL.SPM.1
"
)
lpm
=
DeviceProxy
(
"
LIN/SY/LOCAL.LPM.1
"
)
if
injection_mode
==
"
SPM
"
:
if
spm
.
spmLinacEvent
!=
2
:
lpm
.
lpmEvent
=
0
spm
.
spmLinacEvent
=
0
time
.
sleep
(
0.1
)
spm
.
spmLinacEvent
=
2
elif
injection_mode
==
"
LPM
"
:
if
lpm
.
lpmEvent
!=
2
:
spm
.
spmLinacEvent
=
0
lpm
.
lpmEvent
=
0
time
.
sleep
(
0.1
)
lpm
.
lpmEvent
=
2
else
:
raise
ValueError
(
"
injection_mode should be
'
LPM
'
or
'
SPM
'
.
"
)
def
set_injection
(
injection_mode
,
bucket_list
,
fine_delay
):
"""
Set injection mode and bucket list to be filled.
Parameters
----------
injection_mode :
"
SPM
"
or
"
LPM
"
Injection
"
Short Pulse Mode
"
or
"
Long Pulse Mode
"
.
bucket_list : array like of int or int
Bucket number list, buckets are numbered from 1 to 416.
fine_delay : float
Fine delay in [s].
"""
switch_injection_mode
(
injection_mode
)
central
=
DeviceProxy
(
"
ANS/SY/CENTRAL
"
)
central
=
DeviceProxy
(
"
ANS/SY/CENTRAL
"
)
extraction
=
get_extraction_table
(
bucket_list
)
extraction
=
get_extraction_table
(
bucket_list
)
linac
=
get_linac_table
(
bucket_list
,
fine_delay
)
linac
=
get_linac_table
(
bucket_list
,
fine_delay
)
n_bucket
=
len
(
extraction
)
n_bucket
=
len
(
extraction
)
central
.
settables
(
np
.
concatenate
((
np
.
array
([
n_bucket
]),
extraction
,
linac
)))
central
.
settables
(
np
.
concatenate
((
np
.
array
([
n_bucket
]),
extraction
,
linac
)))
def
inject_beam
(
booster_cav
):
def
inject_beam
(
booster_cav
):
"""
Inject beam into the storage ring using the current injection setup.
Parameters
----------
booster_cav : int
Booster cavity number to be used.
"""
if
booster_cav
==
1
:
if
booster_cav
==
1
:
cav_booster
=
DeviceProxy
(
'
BOO/RF/LLE.1
'
)
cav_booster
=
DeviceProxy
(
'
BOO/RF/LLE.1
'
)
rampe
=
DeviceProxy
(
"
BOO/RF/RAMPETENSION
"
)
rampe
=
DeviceProxy
(
"
BOO/RF/RAMPETENSION
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment