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
48d3b821
Commit
48d3b821
authored
15 years ago
by
Brian Moe
Browse files
Options
Downloads
Patches
Plain Diff
Added Hardware Injection type and Hxxxx style grace ids.
parent
40b359f7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gracedb/models.py
+10
-3
10 additions, 3 deletions
gracedb/models.py
gracedb/query.py
+7
-5
7 additions, 5 deletions
gracedb/query.py
gracedb/translator.py
+17
-0
17 additions, 0 deletions
gracedb/translator.py
with
34 additions
and
8 deletions
gracedb/models.py
+
10
−
3
View file @
48d3b821
...
...
@@ -52,6 +52,7 @@ class Event(models.Model):
(
"
X
"
,
"
X
"
),
(
"
CWB
"
,
"
CWB
"
),
(
"
MBTA
"
,
"
MBTAOnline
"
),
(
"
HWINJ
"
,
"
HardwareInjection
"
),
)
submitter
=
models
.
ForeignKey
(
User
)
created
=
models
.
DateTimeField
(
auto_now_add
=
True
)
...
...
@@ -82,6 +83,8 @@ class Event(models.Model):
def
graceid
(
self
):
if
self
.
uid
:
return
self
.
uid
elif
self
.
analysisType
==
"
HWINJ
"
:
return
"
H%04d
"
%
self
.
id
return
"
G%04d
"
%
self
.
id
def
weburl
(
self
):
...
...
@@ -111,9 +114,13 @@ class Event(models.Model):
@classmethod
def
getByGraceid
(
cls
,
id
):
if
id
[
0
]
==
"
G
"
:
return
cls
.
objects
.
get
(
id
=
int
(
id
[
1
:]))
return
cls
.
objects
.
get
(
uid
=
id
)
if
id
[
0
]
not
in
"
GH
"
:
# Very old, probably useless data.
return
cls
.
objects
.
get
(
uid
=
id
)
e
=
cls
.
objects
.
get
(
id
=
int
(
id
[
1
:]))
if
(
id
[
0
]
==
"
G
"
and
e
.
analysisType
!=
"
HWINJ
"
)
or
(
id
[
0
]
==
"
H
"
and
e
.
analysisType
==
"
HWINJ
"
):
return
e
raise
cls
.
DoesNotExist
()
class
EventLog
(
models
.
Model
):
class
Meta
:
...
...
This diff is collapsed.
Click to expand it.
gracedb/query.py
+
7
−
5
View file @
48d3b821
...
...
@@ -11,11 +11,11 @@
#import pyparsing as p
from
models
import
Event
import
models
from
django.db.models
import
Q
from
pyparsing
import
\
Word
,
nums
,
Literal
,
delimitedList
,
Suppress
,
Group
,
\
Word
,
nums
,
Literal
,
delimitedList
,
Suppress
,
\
Keyword
,
Combine
,
Or
,
Optional
,
OneOrMore
,
alphas
,
Regex
,
\
opAssoc
,
operatorPrecedence
,
oneOf
,
\
stringStart
,
stringEnd
,
ParseException
...
...
@@ -27,7 +27,10 @@ def maybeRange(name):
return
name
,
Q
(
**
{
name
+
"
__range
"
:
toks
.
asList
()})
return
f
encodeType
=
dict
([(
x
[
1
],
x
[
0
])
for
x
in
Event
.
ANALYSIS_TYPE_CHOICES
])
encodeType
=
dict
(
[(
x
[
1
],
x
[
0
])
for
x
in
models
.
Event
.
ANALYSIS_TYPE_CHOICES
]
+
[(
x
[
0
],
x
[
0
])
for
x
in
models
.
Event
.
ANALYSIS_TYPE_CHOICES
]
)
def
doType
(
toks
):
return
(
"
type
"
,
Q
(
analysisType__in
=
[
encodeType
[
tok
]
for
tok
in
toks
]))
...
...
@@ -48,7 +51,7 @@ gpsQ = Optional(Suppress(Keyword("gpstime:"))) + (gpstime^gpstimeRange)
gpsQ
=
gpsQ
.
setParseAction
(
maybeRange
(
"
gpstime
"
))
# Analysis Groups
groupNames
=
[
"
Test
"
,
"
Burst
"
,
"
CBC
"
,
"
Stochastic
"
,
"
CW
"
]
groupNames
=
[
group
.
name
for
group
in
models
.
Group
.
objects
.
all
()
]
group
=
Or
(
map
(
Literal
,
groupNames
)).
setName
(
"
analysis group name
"
)
groupList
=
delimitedList
(
group
,
delim
=
'
|
'
).
setName
(
"
analysis group list
"
)
groupQ
=
(
Optional
(
Suppress
(
Keyword
(
"
group:
"
)))
+
groupList
)
...
...
@@ -56,7 +59,6 @@ groupQ = groupQ.setParseAction(lambda toks: ("group", Q(group__name__in=toks.asL
# Analysis Types
atypeNames
=
[
"
LowMass
"
,
"
HighMass
"
,
"
Inspiral
"
,
"
Omega
"
,
"
X
"
]
atypeNames
=
encodeType
.
keys
()
atype
=
Or
(
map
(
Literal
,
atypeNames
))
atypeList
=
delimitedList
(
atype
,
delim
=
'
|
'
).
\
...
...
This diff is collapsed.
Click to expand it.
gracedb/translator.py
+
17
−
0
View file @
48d3b821
...
...
@@ -231,6 +231,23 @@ def handle_uploaded_data(event, datafilename,
issuer
=
event
.
submitter
,
comment
=
"
Original Data
"
)
log
.
save
()
elif
event
.
analysisType
==
'
HWINJ
'
:
try
:
f
=
open
(
datafilename
,
"
r
"
)
for
line
in
f
.
readlines
():
if
line
.
startswith
(
"
gpstime:
"
):
times
=
line
.
split
()
event
.
gpstime
=
int
(
float
(
times
[
1
]))
event
.
save
()
break
f
.
close
()
except
:
pass
log
=
EventLog
(
event
=
event
,
filename
=
os
.
path
.
basename
(
datafilename
),
issuer
=
event
.
submitter
,
comment
=
"
Original Data
"
)
log
.
save
()
else
:
log
=
EventLog
(
event
=
event
,
filename
=
os
.
path
.
basename
(
datafilename
),
...
...
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