Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GraceDB Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Container 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
Michael William Coughlin
GraceDB Server
Commits
b48ac750
Commit
b48ac750
authored
5 years ago
by
Jonah Kanner
Committed by
GraceDB
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
working first draft
parent
84a67db3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gracedb/superevents/views.py
+42
-7
42 additions, 7 deletions
gracedb/superevents/views.py
gracedb/templates/superevents/public.html
+3
-1
3 additions, 1 deletion
gracedb/templates/superevents/public.html
with
45 additions
and
8 deletions
gracedb/superevents/views.py
+
42
−
7
View file @
b48ac750
...
...
@@ -113,6 +113,7 @@ class SupereventFileList(SupereventDetailView):
context
[
'
file_list
'
]
=
file_list
return
context
# NOTE: file "detail" or downloads (and associated permissions) are
# handled through the API. Links on the file list page point to the
# API file download page.
...
...
@@ -123,21 +124,55 @@ class SupereventPublic(ListView):
filter_permissions
=
[
'
superevents.view_superevent
'
]
log_view_permission
=
'
superevents.view_log
'
def
get_queryset
(
self
,
**
kwargs
):
# -- Query only for public events
qs
=
Superevent
.
objects
.
filter
(
is_exposed
=
True
,
category
=
'
T
'
)
#-- Change cateogry to P for production
return
qs
def
get_context_data
(
self
,
**
kwargs
):
# Get base context
context
=
ListView
.
get_context_data
(
self
,
**
kwargs
)
#-- For each superevent, get list of log messages
#-- For each superevent, get list of log messages and construct pastro string
candidates
=
0
for
se
in
context
[
'
object_list
'
]:
viewable_logs
=
get_objects_for_user
(
self
.
request
.
user
,
self
.
log_view_permission
,
se
.
log_set
.
all
()).
filter
(
tags__name
=
'
em_follow
'
)
#-- want this label to be analyst_comment
commentlist
=
''
for
log
in
viewable_logs
:
commentlist
+=
log
.
comment
commentlist
+=
'
--
'
self
.
log_view_permission
,
se
.
log_set
.
all
()).
filter
(
tags__name
=
'
em_follow
'
)
#-- change to analyst_comment
se
.
comments
=
commentlist
se
.
comments
=
'
**
'
.
join
([
log
.
comment
for
log
in
viewable_logs
])
#-- Get list of voevents
voevents
=
se
.
voevent_set
.
all
()
# -- Filter out retractions
good_voevents
=
sorted
([
voe
for
voe
in
voevents
if
voe
.
voevent_type
!=
'
RE
'
],
key
=
lambda
voe
:
voe
.
N
)
# -- Find retractions
retraction_list
=
[
voe
for
voe
in
voevents
if
voe
.
voevent_type
==
'
RE
'
]
if
len
(
retraction_list
)
>
0
:
se
.
retract
=
True
else
:
se
.
retract
=
False
candidates
+=
1
# -- Read out probabilities
voe
=
good_voevents
[
-
1
]
pastro_values
=
[
(
"
BNS
"
,
voe
.
prob_bns
),
(
"
NSBH
"
,
voe
.
prob_nsbh
),
(
"
BBH
"
,
voe
.
prob_bbh
),
(
"
Terrestrial
"
,
voe
.
prob_terrestrial
),
(
"
MassGap
"
,
voe
.
prob_mass_gap
)
]
sourcelist
=
[]
for
key
,
value
in
pastro_values
:
if
value
>
0.01
:
prob
=
int
(
round
(
100
*
value
))
if
prob
==
100
:
prob
=
'
>99
'
sourcestr
=
"
{0} ({1}%)
"
.
format
(
key
,
prob
)
sourcelist
.
append
(
sourcestr
)
se
.
sourcetypes
=
'
,
'
.
join
(
sourcelist
)
se
.
N
=
voe
.
N
context
[
'
candidates
'
]
=
candidates
return
context
...
...
This diff is collapsed.
Click to expand it.
gracedb/templates/superevents/public.html
+
3
−
1
View file @
b48ac750
...
...
@@ -44,7 +44,9 @@
{% endblock %}
{% block content %}
<h3>
O3 detection candidates: {{ meta.candidates }}
</h3>
<h1>
LIGO/Virgo Public Alerts
</h1>
<h3>
O3 detection candidates: {{ candidates }}
</h3>
<br/><br/>
...
...
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