DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
wibmod
scripts
wib_update_config.py
Go to the documentation of this file.
1
#!/usr/bin/env python3
2
3
import
wibmod.conf_utils
as
wcu
4
import
conffwk
5
6
import
click
7
8
@click.command()
9
@click.argument('conf_db', nargs=1, type=click.Path(exists=True)
)
10
@click.option('--pulser', is_flag=True, help='Enable pulser (otherwise, disable)
')
11
@click.option
(
'--femb-mask'
, type=str,
12
default=
'0xF'
, help=
'FEMB mask for changes (default=0xF, apply to all)'
)
13
@click.option('--pulser-dac','-p', default=20, help='Pulser DAC value (default=20)
')
14
@click.option
(
'--pulser-channel-mask'
, type=str,
15
default=
'0xFFFF'
, help=
'Pulser channel mask (default=0xFFFF, all on)'
)
16
@click.option
(
'--gain'
,
'-g'
, default=2,
17
help =
'Gain setting [14, 25, 7.8, 4.7 mV/fC]-->[0,1,2,3] (default=2, 7.8 mV/fC)'
)
18
@click.option
(
'--peak-time'
,
'-s'
, default=3,
19
help =
'Peak time (shaping) setting [1, 0.5, 3, 2 us]-->[0,1,2,3] (default=3, 2 us)'
)
20
21
def
wib_update_config
(conf_db,pulser,femb_mask,pulser_dac,pulser_channel_mask,gain,peak_time):
22
23
femb_mask = int(femb_mask,0)
24
pulser_channel_mask = int(pulser_channel_mask,0)
25
26
if(femb_mask!=0xF):
27
raise
click.BadParameter(
"FEMB mask not currently working for values != 0xF. Please rerun"
)
28
29
#get the database
30
db =
conffwk.Configuration
(
'oksconflibs:'
+ conf_db)
31
32
#loop over all wib settings
33
for
wib_setting
in
db.get_dals(
'WIBSettings'
):
34
35
#do the pulser config
36
if(pulser):
37
wib_setting = wcu.enable_pulser_wib(wib_setting=wib_setting,
38
pulse_dac=pulser_dac,
39
femb_mask=femb_mask,
40
channel_mask=pulser_channel_mask)
41
else
:
42
wib_setting = wcu.disable_pulser_wib(wib_setting=wib_setting)
43
44
#if gain or peak_time is set, change those too
45
wib_setting = wcu.set_gain_peak_time_wib(wib_setting=wib_setting,
46
gain=gain,
47
peak_time=peak_time,
48
femb_mask=femb_mask)
49
50
#update the wib setting. Recurse so FEMBSettings also get updated
51
db.update_dal(wib_setting,recurse=
True
)
52
53
db.commit()
54
55
if
__name__ ==
'__main__'
:
56
wib_update_config
()
conffwk.Configuration.Configuration
Definition
Configuration.py:29
wib_update_config
Definition
wib_update_config.py:1
Generated on
for DUNE-DAQ by
1.17.0