From 45502e1eb071971b082ba2d93409032493f300c3 Mon Sep 17 00:00:00 2001 From: Patrick Godwin <patrick.godwin@ligo.org> Date: Fri, 6 Jul 2018 11:59:37 -0700 Subject: [PATCH] inspiral_extrinsics.py: fix undefined class issues in TimePhaseSNR doctests, allow pytest to run doctests on inspiral_extrinsics.py for CI --- .gitlab-ci.yml | 2 +- .../python/stats/inspiral_extrinsics.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 48b132f200..972fe70720 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -178,7 +178,7 @@ test:gstlal-inspiral: script: - apt-get install -y python-pytest - cd gstlal-inspiral - - python -m pytest -v --doctest-modules --ignore gst/python --ignore tests --ignore python/stats/inspiral_extrinsics.py --ignore python/lloidplots.py --ignore python/llweb.py --ignore python/plotsegments.py --ignore python/plotsensitivity.py --ignore python/snglinspiraltable.py --ignore python/spawaveform.py --ignore python/spiirparts.py --ignore python/webpage.py --ignore python/imr_utils.py + - python -m pytest -v --doctest-modules --ignore gst/python --ignore tests --ignore python/lloidplots.py --ignore python/llweb.py --ignore python/plotsegments.py --ignore python/plotsensitivity.py --ignore python/snglinspiraltable.py --ignore python/spawaveform.py --ignore python/spiirparts.py --ignore python/webpage.py --ignore python/imr_utils.py only: - pushes - schedules diff --git a/gstlal-inspiral/python/stats/inspiral_extrinsics.py b/gstlal-inspiral/python/stats/inspiral_extrinsics.py index 5e0c4ed125..17f08683de 100644 --- a/gstlal-inspiral/python/stats/inspiral_extrinsics.py +++ b/gstlal-inspiral/python/stats/inspiral_extrinsics.py @@ -1193,7 +1193,7 @@ class TimePhaseSNR(object): """ return instrument combos for all the instruments internally stored in self.responses - >>> TPS.combos + >>> TimePhaseSNR.combos (('H1', 'L1'), ('H1', 'L1', 'V1'), ('H1', 'V1'), ('L1', 'V1')) """ return self.instrument_combos(self.responses) @@ -1203,7 +1203,7 @@ class TimePhaseSNR(object): """ Return all possible pairs of instruments for the instruments internally stored in self.responses - >>> TPS.pairs + >>> TimePhaseSNR.pairs (('H1', 'L1'), ('H1', 'V1'), ('L1', 'V1')) """ @@ -1218,7 +1218,7 @@ class TimePhaseSNR(object): This provides a way to index into the internal tree data for the delta T, delta phi, and deff ratios for each instrument pair. - >>> TPS.slices + >>> TimePhaseSNR.slices {('H1', 'L1'): [0, 1, 2], ('H1', 'V1'): [3, 4, 5], ('L1', 'V1'): [6, 7, 8]} """ # we will define indexes for slicing into a subset of instrument data @@ -1237,11 +1237,11 @@ class TimePhaseSNR(object): """ Given a list of instrument produce all the possible combinations of min_instruents or greater, e.g., - >>> TPS.instrument_combos(("H1","V1","L1"), min_instruments = 3) + >>> TimePhaseSNR.instrument_combos(("H1","V1","L1"), min_instruments = 3) (('H1', 'L1', 'V1'),) - >>> TPS.instrument_combos(("H1","V1","L1"), min_instruments = 2) + >>> TimePhaseSNR.instrument_combos(("H1","V1","L1"), min_instruments = 2) (('H1', 'L1'), ('H1', 'L1', 'V1'), ('H1', 'V1'), ('L1', 'V1')) - >>> TPS.instrument_combos(("H1","V1","L1"), min_instruments = 1) + >>> TimePhaseSNR.instrument_combos(("H1","V1","L1"), min_instruments = 1) (('H1',), ('H1', 'L1'), ('H1', 'L1', 'V1'), ('H1', 'V1'), ('L1',), ('L1', 'V1'), ('V1',)) **NOTE**: these combos are always returned in alphabetical order @@ -1262,7 +1262,7 @@ class TimePhaseSNR(object): """ Given a list of instruments, construct all possible pairs - >>> TPS.instrument_pairs(("H1","K1","V1","L1")) + >>> TimePhaseSNR.instrument_pairs(("H1","K1","V1","L1")) (('H1', 'K1'), ('H1', 'L1'), ('H1', 'V1')) **NOTE**: These are always in alphabetical order @@ -1280,7 +1280,7 @@ class TimePhaseSNR(object): ratios divided by the values in self.sigma into an output array according to the rules provided by slices. - >>> TPS.dtdphideffpoints({"H1":0, "L1":-.001, "V1":.001}, {"H1":0, "L1":0, "V1":1}, {"H1":1, "L1":3, "V1":4}, TPS.slices) + >>> TimePhaseSNR.dtdphideffpoints({"H1":0, "L1":-.001, "V1":.001}, {"H1":0, "L1":0, "V1":1}, {"H1":1, "L1":3, "V1":4}, TimePhaseSNR.slices) array([[ 1. , 0. , -5. , -1. , -2.54647899, -5. , -2. , -2.54647899, -5. ]], dtype=float32) @@ -1359,7 +1359,7 @@ class TimePhaseSNR(object): for the instruments specified by the input dictionaries. We also need the horizon distance because we convert to effective distance internally. - >>> TPS({"H1":0, "L1":0.001, "V1":0.001}, {"H1":0., "L1":1., "V1":1.}, {"H1":5., "L1":7., "V1":7.}, {"H1":1., "L1":1., "V1":1.}) + >>> TimePhaseSNR({"H1":0, "L1":0.001, "V1":0.001}, {"H1":0., "L1":1., "V1":1.}, {"H1":5., "L1":7., "V1":7.}, {"H1":1., "L1":1., "V1":1.}) array([ 9.51668418e-14], dtype=float32) """ -- GitLab