Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gstlal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Duncan Macleod
gstlal
Commits
e2fa2574
Commit
e2fa2574
authored
6 years ago
by
Kipp Cannon
Browse files
Options
Downloads
Patches
Plain Diff
snglinspiraltable: performance
- move performance-critical methods to the C layer
parent
7bfa6e0e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gstlal-inspiral/python/snglinspiraltable.c
+78
-0
78 additions, 0 deletions
gstlal-inspiral/python/snglinspiraltable.c
gstlal-inspiral/python/snglinspiraltable.py
+0
-14
0 additions, 14 deletions
gstlal-inspiral/python/snglinspiraltable.py
with
78 additions
and
14 deletions
gstlal-inspiral/python/snglinspiraltable.c
+
78
−
0
View file @
e2fa2574
...
...
@@ -32,6 +32,7 @@
#include
<Python.h>
#include
<numpy/ndarrayobject.h>
#include
<structmember.h>
#include
<lal/Date.h>
#include
<lal/TimeSeries.h>
#include
<lal/Units.h>
...
...
@@ -39,6 +40,9 @@
#include
<snglinspiralrowtype.h>
static
PyObject
*
LIGOTimeGPSType
=
NULL
;
/*
* ============================================================================
*
...
...
@@ -165,6 +169,63 @@ static int pylal_inline_string_set(PyObject *obj, PyObject *val, void *data)
}
static
PyObject
*
end_get
(
PyObject
*
obj
,
void
*
null
)
{
return
PyObject_CallFunction
(
LIGOTimeGPSType
,
"ii"
,
((
gstlal_GSTLALSnglInspiral
*
)
obj
)
->
row
.
end
.
gpsSeconds
,
((
gstlal_GSTLALSnglInspiral
*
)
obj
)
->
row
.
end
.
gpsNanoSeconds
);
}
static
int
end_set
(
PyObject
*
obj
,
PyObject
*
val
,
void
*
null
)
{
int
end_time
,
end_time_ns
;
PyObject
*
converted
=
PyObject_CallFunctionObjArgs
(
LIGOTimeGPSType
,
val
,
NULL
);
PyObject
*
attr
=
NULL
;;
if
(
!
converted
)
goto
error
;
attr
=
PyObject_GetAttrString
(
converted
,
"gpsSeconds"
);
if
(
!
attr
)
goto
error
;
end_time
=
PyInt_AsLong
(
attr
);
Py_DECREF
(
attr
);
attr
=
PyObject_GetAttrString
(
converted
,
"gpsNanoSeconds"
);
if
(
!
attr
)
goto
error
;
end_time_ns
=
PyInt_AsLong
(
attr
);
Py_DECREF
(
attr
);
Py_DECREF
(
converted
);
XLALGPSSet
(
&
((
gstlal_GSTLALSnglInspiral
*
)
obj
)
->
row
.
end
,
end_time
,
end_time_ns
);
return
0
;
error:
Py_XDECREF
(
converted
);
Py_XDECREF
(
attr
);
return
-
1
;
}
static
PyObject
*
template_id_get
(
PyObject
*
obj
,
void
*
null
)
{
return
PyInt_FromLong
(((
gstlal_GSTLALSnglInspiral
*
)
obj
)
->
row
.
Gamma
[
0
]);
}
static
int
template_id_set
(
PyObject
*
obj
,
PyObject
*
val
,
void
*
null
)
{
int
template_id
=
PyInt_AsLong
(
val
);
if
(
template_id
==
-
1
&&
PyErr_Occurred
())
return
-
1
;
((
gstlal_GSTLALSnglInspiral
*
)
obj
)
->
row
.
Gamma
[
0
]
=
template_id
;
return
0
;
}
static
PyObject
*
snr_component_get
(
PyObject
*
obj
,
void
*
data
)
{
COMPLEX8TimeSeries
*
snr
=
((
gstlal_GSTLALSnglInspiral
*
)
obj
)
->
snr
;
...
...
@@ -209,6 +270,8 @@ static struct PyGetSetDef getset[] = {
{
"ifo"
,
pylal_inline_string_get
,
pylal_inline_string_set
,
"ifo"
,
&
(
struct
pylal_inline_string_description
)
{
offsetof
(
gstlal_GSTLALSnglInspiral
,
row
.
ifo
),
LIGOMETA_IFO_MAX
}},
{
"search"
,
pylal_inline_string_get
,
pylal_inline_string_set
,
"search"
,
&
(
struct
pylal_inline_string_description
)
{
offsetof
(
gstlal_GSTLALSnglInspiral
,
row
.
search
),
LIGOMETA_SEARCH_MAX
}},
{
"channel"
,
pylal_inline_string_get
,
pylal_inline_string_set
,
"channel"
,
&
(
struct
pylal_inline_string_description
)
{
offsetof
(
gstlal_GSTLALSnglInspiral
,
row
.
channel
),
LIGOMETA_CHANNEL_MAX
}},
{
"end"
,
end_get
,
end_set
,
"end"
,
NULL
},
{
"template_id"
,
template_id_get
,
template_id_set
,
"template_id"
,
NULL
},
{
"_snr_name"
,
snr_component_get
,
NULL
,
".snr.name"
,
"_snr_name"
},
{
"_snr_epoch_gpsSeconds"
,
snr_component_get
,
NULL
,
".snr.epoch.gpsSeconds"
,
"_snr_epoch_gpsSeconds"
},
{
"_snr_epoch_gpsNanoSeconds"
,
snr_component_get
,
NULL
,
".snr.epoch.gpsNanoSeconds"
,
"_snr_epoch_gpsNanoSeconds"
},
...
...
@@ -381,6 +444,21 @@ PyMODINIT_FUNC init_snglinspiraltable(void)
import_array
();
/* LIGOTimeGPS */
{
PyObject
*
lal
=
PyImport_ImportModule
(
"lal"
);
if
(
!
lal
)
return
;
LIGOTimeGPSType
=
PyDict_GetItemString
(
PyModule_GetDict
(
lal
),
"LIGOTimeGPS"
);
if
(
!
LIGOTimeGPSType
)
{
Py_DECREF
(
lal
);
return
;
}
Py_INCREF
(
LIGOTimeGPSType
);
Py_DECREF
(
lal
);
}
/* SnglInspiralTable */
if
(
PyType_Ready
(
&
gstlal_GSTLALSnglInspiral_Type
)
<
0
)
return
;
...
...
This diff is collapsed.
Click to expand it.
gstlal-inspiral/python/snglinspiraltable.py
+
0
−
14
View file @
e2fa2574
...
...
@@ -30,7 +30,6 @@ class GSTLALSnglInspiral(_snglinspiraltable.GSTLALSnglInspiral):
process_id_type
=
ilwd
.
get_ilwdchar_class
(
"
process
"
,
"
process_id
"
)
event_id_type
=
ilwd
.
get_ilwdchar_class
(
"
sngl_inspiral
"
,
"
event_id
"
)
end
=
lsctables
.
gpsproperty
(
"
end_time
"
,
"
end_time_ns
"
)
spin1
=
lsctables
.
SnglInspiral
.
spin1
spin2
=
lsctables
.
SnglInspiral
.
spin2
...
...
@@ -83,16 +82,3 @@ class GSTLALSnglInspiral(_snglinspiraltable.GSTLALSnglInspiral):
@snr_time_series.deleter
def
snr_time_series
(
self
):
self
.
_snr_time_series_deleter
()
#
# simulate template_id column
# FIXME: add a proper column for this
#
@property
def
template_id
(
self
):
return
int
(
self
.
Gamma0
)
@template_id.setter
def
template_id
(
self
,
template_id
):
self
.
Gamma0
=
float
(
template_id
)
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