Skip to content

Commit

Permalink
gwsumm.plot: add support for sortbycolor
Browse files Browse the repository at this point in the history
in trigger plots

Co-authored-by: Alex Urban <alexander.urban@ligo.org>
  • Loading branch information
duncanmmacleod and Alex Urban committed Jul 18, 2022
1 parent 06e8250 commit cf84460
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
17 changes: 15 additions & 2 deletions gwsumm/plot/triggers/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

from glue.lal import Cache

from gwpy import __version__ as gwpy_version
from gwpy.segments import Segment
from gwpy.time import to_gps

Expand Down Expand Up @@ -196,6 +197,7 @@ def main(args=None):
'cmap': get_plot('triggers').defaults.get('cmap', 'YlGnBu'),
'clim': (3, 50),
'colorlabel': 'Signal-to-noise ratio (SNR)',
'sortbycolor': True,
}

# update with user params
Expand Down Expand Up @@ -234,11 +236,22 @@ def main(args=None):

# format keywords for plot creation
plot_kw = OrderedDict(
(key, params.pop(key)) for
key in ('xscale', 'xlim', 'epoch', 'yscale', 'ylabel'))
(key, params.pop(key))
for key in (
'xscale',
'xlim',
'epoch',
'yscale',
'ylabel',
'sortbycolor',
)
)

# create plot
if args.tiles:
# sortbycolor is only supported in gwpy >=3.0.0
if gwpy_version < "2.2.0":
plot_kw.pop("sortbycolor")
plot = trigs.tile(args.x_column, args.y_column,
'duration', 'bandwidth', color=args.color,
edgecolor=params.pop('edgecolor', 'face'),
Expand Down
2 changes: 1 addition & 1 deletion gwsumm/plot/triggers/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def draw(self):
plotargs.append(dict())
# get plot arguments
for key in ['vmin', 'vmax', 'edgecolor', 'facecolor', 'cmap', 's',
'marker', 'rasterized']:
'marker', 'rasterized', 'sortbycolor']:
try:
val = self.pargs.pop(key)
except KeyError:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ install_requires =
astropy >=3.0.0
gwdatafind
gwdetchar >=2.0.0
gwpy >=2.0.0
gwpy >=2.0.3
gwtrigfind
lalsuite
ligo-segments
Expand Down

0 comments on commit cf84460

Please sign in to comment.