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
86bafed4
Commit
86bafed4
authored
12 years ago
by
Branson Stephens
Browse files
Options
Downloads
Patches
Plain Diff
Mark GRB events with graceid's like Exxxxx. Extract gpstime from VOEvent files.
parent
b36b2d3e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
gracedb/models.py
+4
-0
4 additions, 0 deletions
gracedb/models.py
gracedb/query.py
+7
-1
7 additions, 1 deletion
gracedb/query.py
gracedb/translator.py
+16
-0
16 additions, 0 deletions
gracedb/translator.py
utils/__init__.py
+15
-1
15 additions, 1 deletion
utils/__init__.py
with
42 additions
and
2 deletions
gracedb/models.py
+
4
−
0
View file @
86bafed4
...
...
@@ -89,6 +89,8 @@ class Event(models.Model):
return
"
T%04d
"
%
self
.
id
elif
self
.
analysisType
==
"
HWINJ
"
:
return
"
H%04d
"
%
self
.
id
elif
self
.
analysisType
==
"
GRB
"
:
return
"
E%04d
"
%
self
.
id
return
"
G%04d
"
%
self
.
id
def
weburl
(
self
):
...
...
@@ -150,6 +152,8 @@ class Event(models.Model):
return
e
if
(
id
[
0
]
==
"
H
"
)
and
(
e
.
analysisType
==
"
HWINJ
"
):
return
e
if
(
id
[
0
]
==
"
E
"
)
and
(
e
.
analysisType
==
"
GRB
"
):
return
e
if
(
id
[
0
]
==
"
G
"
):
return
e
raise
cls
.
DoesNotExist
()
...
...
This diff is collapsed.
Click to expand it.
gracedb/query.py
+
7
−
1
View file @
86bafed4
...
...
@@ -114,6 +114,12 @@ tidRange = tid + Suppress("..") + tid
tidQ
=
Optional
(
Suppress
(
Keyword
(
"
tid:
"
)))
+
(
tid
^
tidRange
)
tidQ
=
tidQ
.
setParseAction
(
maybeRange
(
"
tid
"
,
dbname
=
"
id
"
))
# External trigger event id
eid
=
Suppress
(
"
E
"
)
+
Word
(
"
0123456789
"
)
eidRange
=
eid
+
Suppress
(
"
..
"
)
+
eid
eidQ
=
Optional
(
Suppress
(
Keyword
(
"
eid:
"
)))
+
(
eid
^
eidRange
)
eidQ
=
eidQ
.
setParseAction
(
maybeRange
(
"
eid
"
,
dbname
=
"
id
"
))
# Submitter
submitter
=
QuotedString
(
'"'
).
setParseAction
(
lambda
toks
:
Q
(
submitter__name
=
toks
[
0
]))
submitterQ
=
Optional
(
Suppress
(
Keyword
(
"
submitter:
"
)))
+
submitter
...
...
@@ -214,7 +220,7 @@ ifoQ = ifoListQ | nifoQ
###########################
q
=
(
ifoQ
|
hasfarQ
|
gidQ
|
hidQ
|
tidQ
|
labelQ
|
atypeQ
|
groupQ
|
gpsQ
|
createdQ
|
submitterQ
|
runQ
|
attributeQ
).
setName
(
"
query term
"
)
q
=
(
ifoQ
|
hasfarQ
|
gidQ
|
hidQ
|
tidQ
|
eidQ
|
labelQ
|
atypeQ
|
groupQ
|
gpsQ
|
createdQ
|
submitterQ
|
runQ
|
attributeQ
).
setName
(
"
query term
"
)
#andTheseTags = ["attr"]
andTheseTags
=
[
"
nevents
"
]
...
...
This diff is collapsed.
Click to expand it.
gracedb/translator.py
+
16
−
0
View file @
86bafed4
...
...
@@ -18,6 +18,10 @@ from glue.gracedb.utils import populate_inspiral_tables, \
populate_coinc_tables
,
\
write_output_files
from
VOEventLib.VOEvent
import
*
from
VOEventLib.Vutil
import
*
from
utils
import
isoToGps
def
handle_uploaded_data
(
event
,
datafilename
,
log_filename
=
'
event.log
'
,
coinc_table_filename
=
'
coinc.xml
'
):
...
...
@@ -291,6 +295,13 @@ def handle_uploaded_data(event, datafilename,
f
.
close
()
except
:
pass
elif
event
.
analysisType
==
'
GRB
'
:
# Get the event time from the VOEvent file
try
:
event
.
gpstime
=
getGpsFromVOEvent
(
datafilename
)
except
:
event
.
gpstime
=
0
event
.
save
()
else
:
# XXX should we do something here?
pass
...
...
@@ -453,3 +464,8 @@ class CwbData(Translator):
def
writeCoincFile
(
self
,
path
):
pass
def
getGpsFromVOEvent
(
filename
):
v
=
parse
(
filename
)
wwd
=
getWhereWhen
(
v
)
gpstime
=
isoToGps
(
wwd
[
'
time
'
])
return
gpstime
This diff is collapsed.
Click to expand it.
utils/__init__.py
+
15
−
1
View file @
86bafed4
...
...
@@ -11,6 +11,7 @@ import pytz
import
datetime
import
calendar
from
time
import
mktime
gpsEpoch
=
calendar
.
timegm
((
1980
,
1
,
6
,
0
,
0
,
0
,
0
,
0
,
0
))
...
...
@@ -51,4 +52,17 @@ def gpsToUtc(gpsTime):
t
=
gpsToPosixTime
(
gpsTime
)
return
datetime
.
datetime
.
fromtimestamp
(
t
,
pytz
.
utc
)
def
isoToGps
(
t
):
# The input is a string in ISO time format: 2012-10-28T05:04:31.91
# First strip out whitespace, then split off the factional
# second. We'll add that back later.
t
=
t
.
strip
()
ISOTime
=
t
.
split
(
'
.
'
)[
0
]
ISOTime
=
datetime
.
datetime
.
strptime
(
ISOTime
,
"
%Y-%m-%dT%H:%M:%S
"
)
sec_substr
=
t
.
split
(
'
.
'
)[
1
]
if
sec_substr
:
fracSec
=
float
(
'
0.
'
+
sec_substr
)
else
:
fracSec
=
0
posixTime
=
mktime
(
ISOTime
.
timetuple
())
+
fracSec
return
int
(
round
(
posixToGpsTime
(
posixTime
)))
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