-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
155 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# coding=utf-8 | ||
# Copyright (C) Alex Urban (2019) | ||
# | ||
# This file is part of the GW DetChar python package. | ||
# | ||
# GW DetChar is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# GW DetChar is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with GW DetChar. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
"""Methods and utilties for optical scattering | ||
""" | ||
|
||
__author__ = 'Alex Urban <alexander.urban@ligo.org>' | ||
__credits__ = 'Duncan Macleod <duncan.macleod@ligo.org>' \ | ||
'Joshua Smith <joshua.smith@ligo.org>' \ | ||
'Andrew Lundgren <andrew.lundgren>@ligo.org>' | ||
|
||
# -- imports ------------------------------------------------------------------ | ||
|
||
# import scattering utils | ||
from .core import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# coding=utf-8 | ||
# Copyright (C) Alex Urban (2019) | ||
# | ||
# This file is part of the GW DetChar python package. | ||
# | ||
# GW DetChar is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# GW DetChar is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with GW DetChar. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
"""Simple command-line interface to gwdetchar.scattering | ||
""" | ||
|
||
import os | ||
import sys | ||
import numpy | ||
|
||
from matplotlib import (use, rcParams) | ||
use('agg') # noqa | ||
|
||
from gwpy.time import to_gps | ||
|
||
from .. import (cli, const) | ||
from ..omega import highpass | ||
from ..io.datafind import get_data | ||
from . import * | ||
|
||
__author__ = 'Alex Urban <alexander.urban@ligo.org>' | ||
__credits__ = 'Joshua Smith <joshua.smith@ligo.org>' \ | ||
'Andrew Lundgren <andrew.lundgren>@ligo.org>' \ | ||
'Duncan Macleod <duncan.macleod@ligo.org>' | ||
|
||
ASD_KW = { | ||
'method': 'median', | ||
'fftlength': 8, | ||
'overlap': 4, | ||
} | ||
|
||
logger = cli.logger('gwdetchar.scattering') | ||
|
||
|
||
def main(args=None): | ||
"""Parse command-line arguments, process optics, and write plots | ||
""" | ||
# define command-line arguments | ||
parser = cli.create_parser(description=__doc__) | ||
parser.add_argument('gpstime', type=to_gps, | ||
help='GPS time or datestring to analyze') | ||
cli.add_ifo_option(parser, ifo=const.IFO) | ||
parser.add_argument('-d', '--duration', type=float, default=60, | ||
help='Duration (seconds) of analysis, default: 60') | ||
parser.add_argument('-f', '--frequency-threshold', type=float, default=15, | ||
help='critical fringe frequency threshold (Hz), ' | ||
'default: %(default)s') | ||
parser.add_argument('-w', '--witness-channel', | ||
default='GDS-CALIB_STRAIN', | ||
help='name of witness channel (without IFO prefix), ' | ||
'default: %(default)s') | ||
parser.add_argument('-W', '--witness-frametype', default='{IFO}_HOFT_C00', | ||
help='frametype from which to read witness channel, ' | ||
'default: %(default)s') | ||
parser.add_argument('-o', '--output-dir', type=os.path.abspath, | ||
default=os.curdir, | ||
help='Output directory for analysis, ' | ||
'default: %(default)s') | ||
parser.add_argument('-p', '--plot-spectrogram', action='store_true', | ||
help='Include plot of a high-resolution spectrogram, ' | ||
'default: False') | ||
|
||
# parse arguments | ||
args = parser.parse_args(args) | ||
ifo = args.ifo | ||
gps = float(args.gpstime) | ||
gpsstart = gps - 0.5 * args.duration | ||
gpsend = gps + 0.5 * args.duration | ||
witness = ':'.join([ifo, args.witness_channel]) | ||
thresh = args.frequency_threshold | ||
logger.info('{0} Scattering: {1}'.format(ifo, gps)) | ||
|
||
# set up spectrogram | ||
if args.plot_spectrogram: | ||
logger.debug('Setting up a spectrogram of {}'.format(witness)) | ||
hoft = get_data(witness, start=gpsstart-2, end=gpsend+2, | ||
frametype=args.witness_frametype.format(IFO=ifo), | ||
verbose='Reading witness channel:'.rjust(30)) | ||
hoft = highpass(hoft, f_low=thresh) | ||
qspecgram = hoft.q_transform(qrange=(4, 150), gps=gps, logf=True, | ||
outseg=(gpsstart, gpsend), **ASD_KW) | ||
|
||
|
||
if __name__ == "__main__": # pragma: no-cover | ||
sys.exit(main()) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# coding=utf-8 | ||
# Copyright (C) Alex Urban (2019) | ||
# | ||
# This file is part of the GW DetChar python package. | ||
# | ||
# GW DetChar is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# GW DetChar is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with GW DetChar. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
"""Tests for :mod:`gwdetchar.scattering` | ||
""" | ||
|
||
__author__ = 'Alex Urban <alexander.urban@ligo.org>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters