Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
maroc_csa
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
white-rabbit
maroc_csa
Commits
da7a3237
Commit
da7a3237
authored
Sep 25, 2017
by
David Cussans
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding changes to Python scripts
parent
f261b396
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
92 additions
and
2 deletions
+92
-2
MarocDAQ.py
firmware/scripts/MarocDAQ.py
+2
-1
MarocHistograms.py
firmware/scripts/MarocHistograms.py
+1
-1
MarocRC.py
firmware/scripts/MarocRC.py
+76
-0
MarocUnpackingThread.py
firmware/scripts/MarocUnpackingThread.py
+4
-0
takeMarocData.py
firmware/scripts/takeMarocData.py
+1
-0
takeMarocData.sh
firmware/scripts/takeMarocData.sh
+8
-0
No files found.
firmware/scripts/MarocDAQ.py
View file @
da7a3237
...
...
@@ -16,7 +16,8 @@ class MarocDAQ(object):
self
.
internalTriggers
=
internalTriggers
# Set to > 0 to fire internal triggers.
self
.
timeStampEventSize
=
12
self
.
timeStampBufferSize
=
512
self
.
adcEventSize
=
26
# size of each event
# self.adcEventSize = 26 # size of each event
self
.
adcEventSize
=
32
# size of each event in firmware that rounds up to 2^5
self
.
adcBufferSize
=
4096
# size of rolling buffer. Be careful - buffer size changes with firmware version.....
self
.
numMaroc
=
1
...
...
firmware/scripts/MarocHistograms.py
View file @
da7a3237
...
...
@@ -112,7 +112,7 @@ class MarocHistograms(object):
self
.
logger
.
debug
(
"Histogramming data =
\n
%
s"
%
(
' , '
.
join
([
format
(
i
,
'08x'
)
for
i
in
ADCData
])
))
for
ADCIndex
in
range
(
0
,
len
(
ADCData
)):
self
.
logger
.
debug
(
"Filling histogram for channel
%
i
"
%
ADCIndex
)
self
.
logger
.
debug
(
"Filling histogram for channel
%
i
, value
%
i"
%
(
ADCIndex
,
ADCData
[
ADCIndex
])
)
self
.
adcHistograms
[
ADCIndex
]
.
Fill
(
ADCData
[
ADCIndex
])
# Fill time-stamp histogram
...
...
firmware/scripts/MarocRC.py
0 → 100644
View file @
da7a3237
#
#
# Python class to set up MAROC-3 dynamic ("R") control register.
#
#
import
ConfigParser
import
logging
from
marocLogging
import
marocLogging
from
itertools
import
imap
class
MarocRC
(
object
):
"""Sets up an array of 32-bit words that can be written to MAROC-3 dynamic ("R") control register via a block write to IPBus-based firmware."""
def
__init__
(
self
,
hold1
,
hold2
,
debugLevel
=
logging
.
DEBUG
):
self
.
numRCbits
=
128
# number of bits in dynamic control register. 2 x number of channels
self
.
busWidth
=
32
self
.
numWords
=
self
.
numRCbits
/
self
.
busWidth
self
.
debugLevel
=
debugLevel
self
.
logger
=
logging
.
getLogger
(
__name__
)
marocLogging
(
self
.
logger
,
debugLevel
)
self
.
hold1
=
hold1
self
.
hold2
=
hold2
def
setRCData
(
self
,
hold1
,
hold2
):
self
.
hold1
=
hold1
self
.
hold2
=
hold2
def
getWordArray
(
self
):
RCData
=
self
.
numWords
*
[
0x0
]
hold1Word
=
self
.
hold1
/
self
.
busWidth
hold1Bit
=
self
.
hold1
%
self
.
busWidth
RCData
[
hold1Word
]
=
1
<<
hold1Bit
hold2Word
=
2
+
(
self
.
hold2
/
self
.
busWidth
)
hold2Bit
=
self
.
hold2
%
self
.
busWidth
RCData
[
hold2Word
]
=
1
<<
hold2Bit
self
.
logger
.
info
(
"RC hold1Word , hold1Bit =
%
i ,
%
i"
%
(
hold1Word
,
hold1Bit
))
self
.
logger
.
info
(
"RC hold2Word , hold2Bit =
%
i ,
%
i"
%
(
hold2Word
,
hold2Bit
))
self
.
logger
.
info
(
"RC array =
%
i ,
%
i
%
i
%
i "
%
(
RCData
[
0
]
,
RCData
[
1
]
,
RCData
[
2
]
,
RCData
[
3
]
,)
)
return
(
RCData
)
def
readConfigFile
(
self
,
fName
):
"""Reads a configuration file with 'windows-INI' like syntax.
Expects one section , RC , with entries hold1 , hold2
hold1 , hold2 is which output should be active
"""
self
.
logger
.
info
(
"Reading Configuration from
%
s"
%
(
fName
))
config
=
ConfigParser
.
SafeConfigParser
()
config
.
optionxform
=
str
# stop parser from changing to lower case.
config
.
read
(
fName
)
self
.
hold1
=
config
.
getint
(
'RC'
,
"hold1"
)
self
.
hold2
=
config
.
getint
(
'RC'
,
"hold2"
)
self
.
logger
.
info
(
"RC register values from config file: hold1 , hold2 =
%
i ,
%
i "
%
(
self
.
hold1
,
self
.
hold2
)
)
firmware/scripts/MarocUnpackingThread.py
View file @
da7a3237
...
...
@@ -125,6 +125,10 @@ def unpack_maroc_data(name, rawDataQueue , recordingDataQueue, histogramDataQueu
# Push data to recording.
recordingDataQueue
.
put
(
unpackedData
)
# Bodge - give time for histogrammer to fill the last histogram before sending poison pill to data recorder.
# If the ROOT file is closed the histograms become undefined....
time
.
sleep
(
2.0
)
poisonPill
=
[
-
1
]
histogramDataQueue
.
put
(
poisonPill
)
logger
.
info
(
"Fed poison pill to histogrammer"
)
...
...
firmware/scripts/takeMarocData.py
View file @
da7a3237
...
...
@@ -24,6 +24,7 @@ from PyChipsUser import *
from
Queue
import
Queue
#from multiprocessing import Queue
#debugLevel = logging.DEBUG
debugLevel
=
logging
.
INFO
logger
=
logging
.
getLogger
(
__name__
)
...
...
firmware/scripts/takeMarocData.sh
0 → 100755
View file @
da7a3237
#!/bin/sh
export
LD_LIBRARY_PATH
=
/opt/cactus/lib:
$LD_LIBRARY_PATH
export
PATH
=
/opt/cactus/bin:
$PATH
export
PYTHONPATH
=
./PyChips_1_5_0_pre2A/src/:
$PYTHONPATH
python takeMarocData.py
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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