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
8b1de211
Commit
8b1de211
authored
2 months ago
by
Andrea Parenti
Committed by
Jonathan Correa Magdalena
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Refactor / 3
parent
4421661f
No related branches found
No related tags found
2 merge requests
!2
Draft: Feat/p8003
,
!1
First version
Pipeline
#162676
passed
2 months ago
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pyproject.toml
+1
-2
1 addition, 2 deletions
pyproject.toml
scripts/karabo_acquire.py
+0
-18
0 additions, 18 deletions
scripts/karabo_acquire.py
src/tempus/Tempus.py
+25
-18
25 additions, 18 deletions
src/tempus/Tempus.py
with
26 additions
and
38 deletions
pyproject.toml
+
1
−
2
View file @
8b1de211
...
...
@@ -20,5 +20,4 @@ authors = [
]
description
=
""
readme
=
"README.md"
dependencies
=
[
]
dependencies
=
[
'paramiko'
]
This diff is collapsed.
Click to expand it.
scripts/karabo_acquire.py
deleted
100644 → 0
+
0
−
18
View file @
4421661f
import
argparse
from
control
import
Timepix4control
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"
--shutter_time
"
,
type
=
int
,
default
=
20000
)
parser
.
add_argument
(
"
--t0_time
"
,
type
=
float
,
default
=
0.0001
)
parser
.
add_argument
(
"
--extratime
"
,
type
=
int
,
default
=
100000
)
parser
.
add_argument
(
"
--pad
"
,
type
=
bool
,
default
=
False
)
args
=
parser
.
parse_args
()
mytpx4
=
Timepix4control
(
1
)
mytpx4
.
external_shutter
(
delay
=
False
,
shutter_time
=
args
.
shutter_time
)
if
args
.
pad
:
mytpx4
.
external_t0_sync
(
delay
=
False
,
t0_time
=
args
.
t0_time
)
mytpx4
.
slowtakeevents
(
extratime
=
args
.
extratime
,
pad
=
args
.
pad
)
This diff is collapsed.
Click to expand it.
src/tempus/Tempus.py
+
25
−
18
View file @
8b1de211
...
...
@@ -220,19 +220,10 @@ class Tempus(Device):
async
def
_initialize
(
self
):
try
:
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
)
await
self
.
send_command
(
"
os.system(
'
devmem2 0x80010004 w 0x2
'
)
"
)
await
self
.
send_command
(
"
os.system(
'
devmem2 0x80010004 w 0x0
'
)
"
)
await
self
.
send_command
(
"
os.system(
'
devmem2 0x80010004 w 0x2
'
)
"
)
await
self
.
send_command
(
"
mytpx4 = Timepix4control(1)
"
,
sleep_time
=
5
)
await
self
.
send_command
(
f
"
os.system(
'
{
self
.
APP_DIR
}
/Timepix4_Init.py
'
)
"
,
sleep_time
=
3
)
await
self
.
send_command
(
"
mytpx4.initialisechip()
"
,
sleep_time
=
1
)
...
...
@@ -323,18 +314,24 @@ class Tempus(Device):
self
.
state
=
State
.
ACQUIRING
self
.
background_task
=
background
(
self
.
_acquire
())
async
def
_acquire
(
self
):
cmnd
=
[
self
.
COMMAND
,
*
self
.
ARGS
,
f
"
{
self
.
SCRIPT_DIR
}
/karabo_acquire.py
"
,
f
"
--shutter_time=
{
self
.
shutterTime
.
value
}
"
,
f
"
--t0_time=
{
self
.
t0Time
.
value
}
"
,
f
"
--pad=
{
self
.
externalSync
}
"
]
self
.
commandLog
=
f
"
Starting acquisition:
\n
{
'
'
.
join
(
cmnd
)
}
"
async
def
_acquire
(
self
):
# XXX test
await
self
.
send_command
(
"
mytpx4.external_shutter(delay=False,
"
f
"
shutter_time=
{
self
.
shutterTime
.
value
}
)
"
)
# XXX sleep_time
if
self
.
externalSync
:
await
self
.
send_command
(
"
mytpx4.external_t0_sync(delay=False,
"
f
"
t0_time=
{
self
.
t0Time
.
value
}
)
"
)
# XXX sleep_time
for
i
in
range
(
self
.
nAcquisitions
.
value
):
self
.
status
=
f
"
Acquisition #
{
i
}
"
await
self
.
send_command
(
"
mytpx4.slowtakeevents(extratime=100000,
"
f
"
pad=
{
self
.
externalSync
}
)
"
,
sleep_time
=
self
.
shutterTime
.
value
)
if
not
self
.
do_acquire
:
break
await
self
.
_execute_command
(
cmnd
,
State
.
ACQUIRING
,
f
"
Acquisition #
{
i
}
"
)
self
.
state
=
State
.
ACTIVE
self
.
status
=
"
Acquisition done
"
...
...
@@ -414,6 +411,16 @@ class Tempus(Device):
msg
=
f
"
Connected to
{
self
.
controllerIp
}
"
self
.
logger
.
info
(
msg
)
self
.
status
=
msg
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
)
await
self
.
send_command
(
"
mytpx4 = Timepix4control(1)
"
,
sleep_time
=
5
)
self
.
state
=
State
.
INIT
except
Exception
as
e
:
self
.
client
=
None
...
...
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