Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
locklost
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Austin Jennings
locklost
Commits
1a47204e
Commit
1a47204e
authored
2 years ago
by
Camilla Compton
Committed by
Jameson Rollins
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Change shift summary plot to look at lockloss by hour
parent
ac267496
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
locklost/summary.py
+32
-26
32 additions, 26 deletions
locklost/summary.py
with
32 additions
and
26 deletions
locklost/summary.py
+
32
−
26
View file @
1a47204e
...
...
@@ -32,15 +32,13 @@ def grab_data(gps):
"""
shift_times
=
{
'
H1
'
:
[
np
.
arange
(
0
,
8
),
np
.
arange
(
8
,
16
),
np
.
arange
(
16
,
24
)],
'
L1
'
:
[
np
.
concatenate
(([
23
],
np
.
arange
(
0
,
8
))),
np
.
arange
(
8
,
12
),
np
.
arange
(
12
,
22
)]
'
L1
'
:
[
np
.
concatenate
(([
22
,
23
],
np
.
arange
(
0
,
8
))),
np
.
arange
(
8
,
12
),
np
.
arange
(
12
,
22
)]
}
shift_names
=
[
'
owl
'
,
'
day
'
,
'
eve
'
]
shifts
=
{
shift_names
[
x
]:
{
'
time
'
:
shift_times
[
config
.
IFO
][
x
],
'
counts
'
:
0
}
for
x
in
range
(
3
)
}
shifts
=
defaultdict
(
lambda
:
defaultdict
(
int
))
for
x
in
range
(
3
):
for
time
in
shift_times
[
config
.
IFO
][
x
]:
shifts
[
shift_names
[
x
]][
time
]
=
0
transitions
=
defaultdict
(
int
)
observe_durations
=
[]
saturations
=
{
...
...
@@ -102,18 +100,18 @@ def check_tags(event, tags, tag_count):
def
check_shift
(
event
,
shifts
):
"""
Checks which operating shift event happened during.
"""
Checks which operating shift
and hour
event happened during.
Checks which operator shift the lockloss gps happened during and
increments
a counter for that
shift
(for locklosses from Observe).
Checks which operator shift
and hour
the lockloss gps happened during and
increments
a counter for that
hour
(for locklosses from Observe).
"""
if
not
event
.
has_tag
(
'
OBSERVE
'
):
return
shifts
gt
=
gpstime
.
fromgps
(
event
.
gps
)
gt
=
gt
.
astimezone
(
local_tz
)
for
key
in
shifts
:
if
gt
.
hour
in
shifts
[
key
][
'
ti
me
'
]:
shifts
[
key
][
'
counts
'
]
+=
1
for
shift_name
in
shifts
:
if
gt
.
hour
in
shifts
[
shift_na
me
]:
shifts
[
shift_name
][
gt
.
hour
]
+=
1
break
return
shifts
...
...
@@ -280,26 +278,34 @@ def plot_summary(path, epoch):
fig
.
savefig
(
outpath_plot
,
bbox_inches
=
'
tight
'
)
plt
.
close
()
# Lockloss shift plot
counts
=
[
x
[
'
counts
'
]
for
x
in
shifts
.
values
()]
shifts
=
shifts
.
keys
()
# Lockloss shift hour plot
colors
=
[
'
#1f77b4
'
,
'
#dbcb2b
'
,
'
#b41f2d
'
]
times
=
[]
counts
=
[]
shift_total
=
[]
for
shift_name
in
shifts
:
times
.
append
(
shifts
[
shift_name
].
keys
())
counts
.
append
(
shifts
[
shift_name
].
values
())
shift_total
.
append
(
sum
(
shifts
[
shift_name
].
values
()))
fig
,
ax
=
plt
.
subplots
(
1
,
figsize
=
(
22
,
16
))
shift_x
=
np
.
array
([
0
,
1
,
2
])
ax
.
bar
(
shift_x
,
counts
,
for
time
,
count
,
shift
,
total
,
color
in
zip
(
times
,
counts
,
shifts
.
keys
(),
shift_total
,
colors
):
ax
.
bar
(
time
,
count
,
color
=
color
,
label
=
'
{} total count: {}
'
.
format
(
shift
.
upper
(),
total
),
align
=
'
center
'
,
)
ax
.
set_xlabel
(
'
Operating shift
'
,
labelpad
=
10
)
ax
.
set_xlabel
(
'
Hour lockloss occurred ({})
'
.
format
(
local_tz
.
zone
)
,
labelpad
=
10
)
ax
.
set_ylabel
(
'
Number of locklosses
'
)
ax
.
set_title
(
'
Number of locklosses
per shift: %s
'
%
(
epoch
))
ax
.
set_x
ticks
(
shift_x
)
ax
.
set_xticklabels
(
shifts
,
rotation
=
45
,
ha
=
'
right
'
)
ax
.
set_xlim
([
-
1
,
shift_x
.
size
]
)
ax
.
set_title
(
'
Number of locklosses
from observing by hour: {}
'
.
format
(
epoch
))
ax
.
set_x
lim
([
-
0.9
,
23.9
]
)
ax
.
grid
(
)
plt
.
legend
(
loc
=
'
upper left
'
)
plt
.
gcf
().
text
(
0.02
,
0.02
,
"
Created: {}
"
.
format
(
gpsnow
()),
fontsize
=
16
)
fig
.
tight_layout
()
outpath_plot
=
os
.
path
.
join
(
epoch_path
,
'
Lockloss_by_
shift
'
)
outpath_plot
=
os
.
path
.
join
(
epoch_path
,
'
Lockloss_by_
hour
'
)
fig
.
savefig
(
outpath_plot
,
bbox_inches
=
'
tight
'
)
plt
.
close
()
...
...
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