Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tempus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
karaboDevices
tempus
Commits
4421661f
Commit
4421661f
authored
2 months ago
by
Andrea Parenti
Committed by
Jonathan Correa Magdalena
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Refactor / 2
parent
5ae48f33
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!2
Draft: Feat/p8003
,
!1
First version
Pipeline
#162668
failed
2 months ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/karabo_config.py
+0
-36
0 additions, 36 deletions
scripts/karabo_config.py
src/tempus/Tempus.py
+37
-11
37 additions, 11 deletions
src/tempus/Tempus.py
with
37 additions
and
47 deletions
scripts/karabo_config.py
deleted
100644 → 0
+
0
−
36
View file @
5ae48f33
import
argparse
import
numpy
as
np
from
control
import
Timepix4control
MASTER_DIR
=
"
/home/timepix4/master
"
CFG_DIR
=
MASTER_DIR
+
"
/control/config
"
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"
--DAC_Vthreshold
"
,
type
=
int
,
default
=
6622
)
parser
.
add_argument
(
"
--DAC_VbiasIkrum
"
,
type
=
int
,
default
=
100
)
parser
.
add_argument
(
"
--equalisation_file
"
,
default
=
"
B3_equalisation_HV100.npy
"
)
parser
.
add_argument
(
"
--mask_file
"
,
default
=
"
W15_pixel-mask_200V_20240612_late2.npy
"
)
parser
.
add_argument
(
"
--pad
"
,
type
=
bool
,
default
=
False
)
args
=
parser
.
parse_args
()
mytpx4
=
Timepix4control
(
1
)
# set DACs and apply equalisation
exec
(
open
(
CFG_DIR
+
'
/B3_timing_dacs.py
'
).
read
())
mytpx4
.
setDAC
(
"
DAC_Vthreshold
"
,
args
.
DAC_Vthreshold
)
mytpx4
.
setDAC
(
"
DAC_VbiasIkrum
"
,
args
.
DAC_VbiasIkrum
)
with
open
(
CFG_DIR
+
'
/
'
+
args
.
equalisation_file
,
'
rb
'
)
as
f1
:
adj_values
=
np
.
load
(
f1
)
with
open
(
CFG_DIR
+
'
/
'
+
args
.
mask_file
,
'
rb
'
)
as
f2
:
mask_data
=
np
.
load
(
f2
)
mytpx4
.
writepixelregisters
(
dac_adj
=
adj_values
,
mask_bit
=
mask_data
)
mytpx4
.
slowsetupevents
(
pad
=
args
.
pad
)
mytpx4
.
setting_digital_pixel
()
This diff is collapsed.
Click to expand it.
src/tempus/Tempus.py
+
37
−
11
View file @
4421661f
...
...
@@ -68,6 +68,7 @@ class Tempus(Device):
COMMAND
=
"
ssh
"
APP_DIR
=
"
/home/timepix4/application
"
SCRIPT_DIR
=
"
/home/timepix4/master
"
CFG_DIR
=
"
/home/timepix4/master/control/config
"
def
__init__
(
self
,
configuration
):
super
().
__init__
(
configuration
)
...
...
@@ -222,6 +223,7 @@ class Tempus(Device):
await
self
.
send_command
(
f
"
cd
{
self
.
SCRIPT_DIR
}
"
)
await
self
.
send_command
(
"
python3
"
)
await
self
.
send_command
(
"
import os
"
)
await
self
.
send_command
(
"
import numpy as np
"
)
await
self
.
send_command
(
"
from control import Timepix4control
"
,
sleep_time
=
2
)
...
...
@@ -272,22 +274,46 @@ class Tempus(Device):
@Slot
(
displayedName
=
"
Configure
"
,
description
=
"
Run the configuration sequence. This can take about
"
"
30
s
"
,
"
45
s
"
,
allowedStates
=
{
State
.
ON
})
async
def
configure
(
self
):
self
.
state
=
State
.
CHANGING
self
.
status
=
"
Configuring TEMPUS
"
cmnd
=
[
self
.
COMMAND
,
*
self
.
ARGS
,
f
"
{
self
.
SCRIPT_DIR
}
/karabo_config.py
"
,
f
"
--DAC_Vthreshold=
{
self
.
vbiasIkrum
.
value
}
"
,
f
"
--DAC_VbiasIkrum=
{
self
.
vbiasIkrum
.
value
}
"
,
f
"
--equalisation_file=
{
self
.
equalisationFile
}
"
,
f
"
--mask_file=
{
self
.
maskFile
}
"
,
f
"
--pad=
{
self
.
externalSync
}
"
]
self
.
commandLog
=
(
f
"
Configuring TEMPUS:
\n
{
'
'
.
join
(
cmnd
)
}
\n
This can take about 30 s
"
)
self
.
background_task
=
background
(
self
.
_execute_command
(
cmnd
,
State
.
ACTIVE
,
"
Configured
"
))
"
Configuring TEMPUS:
\n
This will take about 45 s.
\n\n
"
)
self
.
background_task
=
background
(
self
.
_configure
())
async
def
_configure
(
self
):
try
:
await
self
.
send_command
(
f
"
exec(open(
'
{
self
.
CFG_DIR
}
/B3_timing_dacs.py
'
).read())
"
)
await
self
.
send_command
(
f
"
mytpx4.setDAC(
'
DAC_Vthreshold
'
,
{
self
.
vthreshold
.
value
}
)
"
)
await
self
.
send_command
(
f
"
mytpx4.setDAC(
'
DAC_VbiasIkrum
'
,
{
self
.
vbiasIkrum
.
value
}
)
"
)
await
self
.
send_command
(
f
"
with open(
'
{
self
.
CFG_DIR
}
/
{
self
.
equalisationFile
}
'
,
'
rb
'
)
"
"
as f1: adj_values = np.load(f1)
"
)
await
self
.
send_command
(
# XXX SyntaxError: invalid syntax
f
"
with open(
'
{
self
.
CFG_DIR
}
/
{
self
.
maskFile
}
'
,
'
rb
'
) as f2:
"
"
mask_data = np.load(f2)
"
)
await
self
.
send_command
(
"
mytpx4.writepixelregisters(dac_adj=adj_values,
"
"
mask_bit=mask_data)
"
,
sleep_time
=
30
)
await
self
.
send_command
(
f
"
mytpx4.slowsetupevents(pad=
{
self
.
externalSync
}
)
"
)
await
self
.
send_command
(
"
mytpx4.setting_digital_pixel()
"
)
except
Exception
as
e
:
self
.
logger
.
error
(
e
)
self
.
state
=
State
.
ERROR
self
.
status
=
str
(
e
)
self
.
commandLog
=
str
(
e
)
@Slot
(
displayedName
=
"
Acquire
"
,
...
...
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