Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bilby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Container Registry
Model registry
Operate
Environments
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
lscsoft
bilby
Commits
502e8ba5
Commit
502e8ba5
authored
5 years ago
by
Gregory Ashton
Browse files
Options
Downloads
Patches
Plain Diff
Add in option to use the pickle file
parent
c7c8c5f8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!478
Rework of the skymap utilities
Pipeline
#60300
failed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bilby/gw/result.py
+32
-18
32 additions, 18 deletions
bilby/gw/result.py
with
32 additions
and
18 deletions
bilby/gw/result.py
+
32
−
18
View file @
502e8ba5
...
...
@@ -188,7 +188,7 @@ class CompactBinaryCoalesenceResult(CoreResult):
self
,
maxpts
=
None
,
trials
=
5
,
jobs
=
1
,
enable_multiresolution
=
True
,
objid
=
None
,
instruments
=
None
,
geo
=
False
,
dpi
=
600
,
transparent
=
False
,
colorbar
=
False
,
contour
=
[
50
,
90
],
annotate
=
True
,
cmap
=
'
cylon
'
):
annotate
=
True
,
cmap
=
'
cylon
'
,
load_pickle
=
False
):
"""
Generate a fits file and sky map from a result
Code adapted from ligo.skymap.tool.ligo_skymap_from_samples and
...
...
@@ -223,6 +223,9 @@ class CompactBinaryCoalesenceResult(CoreResult):
Annotate image with details
cmap: str
Name of the colormap to use
load_pickle: bool, str
If true, load the cached pickle file (default name), or the
pickle-file give as a path.
"""
try
:
...
...
@@ -242,23 +245,34 @@ class CompactBinaryCoalesenceResult(CoreResult):
logger
.
info
(
'
Taking random subsample of chain
'
)
data
=
data
.
sample
(
maxpts
)
try
:
pts
=
data
[[
'
ra
'
,
'
dec
'
,
'
luminosity_distance
'
]].
values
cls
=
kde
.
Clustered2Plus1DSkyKDE
distance
=
True
except
KeyError
:
logger
.
warning
(
"
The results file does not contain luminosity_distance
"
)
pts
=
data
[[
'
ra
'
,
'
dec
'
]].
values
cls
=
kde
.
Clustered2DSkyKDE
distance
=
False
logger
.
info
(
'
Initialising skymap class
'
)
skypost
=
cls
(
pts
,
trials
=
trials
,
multiprocess
=
jobs
)
obj_filename
=
os
.
path
.
join
(
self
.
outdir
,
'
{}_skypost.obj
'
.
format
(
self
.
label
))
logger
.
info
(
'
Pickling skymap to {}
'
.
format
(
obj_filename
))
with
open
(
obj_filename
,
'
wb
'
)
as
out
:
pickle
.
dump
(
skypost
,
out
)
default_obj_filename
=
os
.
path
.
join
(
self
.
outdir
,
'
{}_skypost.obj
'
.
format
(
self
.
label
))
if
load_pickle
is
False
:
try
:
pts
=
data
[[
'
ra
'
,
'
dec
'
,
'
luminosity_distance
'
]].
values
cls
=
kde
.
Clustered2Plus1DSkyKDE
distance
=
True
except
KeyError
:
logger
.
warning
(
"
The results file does not contain luminosity_distance
"
)
pts
=
data
[[
'
ra
'
,
'
dec
'
]].
values
cls
=
kde
.
Clustered2DSkyKDE
distance
=
False
logger
.
info
(
'
Initialising skymap class
'
)
skypost
=
cls
(
pts
,
trials
=
trials
,
multiprocess
=
jobs
)
logger
.
info
(
'
Pickling skymap to {}
'
.
format
(
default_obj_filename
))
with
open
(
default_obj_filename
,
'
wb
'
)
as
out
:
pickle
.
dump
(
skypost
,
out
)
else
:
if
isinstance
(
load_pickle
,
str
):
obj_filename
=
load_pickle
else
:
obj_filename
=
default_obj_filename
logger
.
info
(
'
Reading from pickle {}
'
.
format
(
obj_filename
))
with
open
(
obj_filename
,
'
rb
'
)
as
file
:
skypost
=
pickle
.
load
(
file
)
skypost
.
multiprocess
=
jobs
logger
.
info
(
'
Making skymap
'
)
hpmap
=
skypost
.
as_healpix
()
...
...
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