Commit 1d4ba272 authored by Leo Pound Singer's avatar Leo Pound Singer
Browse files

Add warnings about move of BAYESTAR to ligo.skymap

parent 277889e6
......@@ -31,10 +31,7 @@ AC_CONFIG_FILES([ \
src/Makefile \
src/version.c \
swig/Makefile \
test/Makefile \
test/baseline/Makefile \
test/data/Makefile \
test/data/gstlal_reference_psd/Makefile
test/Makefile
])
AC_USE_SYSTEM_EXTENSIONS
AM_INIT_AUTOMAKE([ \
......
......@@ -34,6 +34,10 @@ from __future__ import division
from __future__ import print_function
from lalinference.bayestar.deprecation import warn
warn('ligo-skymap-stats')
# Command line interface.
import argparse
from lalinference.bayestar import command
......
......@@ -21,6 +21,9 @@ The output is a GeoJSON FeatureCollection (http://geojson.org/).
"""
from lalinference.bayestar.deprecation import warn
warn('ligo-skymap-contour')
# Command line interface
import argparse
......
......@@ -44,6 +44,9 @@ integrator.
"""
from lalinference.bayestar.deprecation import warn
warn('bayestar-localize-coincs')
# Command line interface.
import argparse
from lalinference.bayestar import command
......
......@@ -36,6 +36,9 @@ terminal, or redirected from a fifo):
# Command line interface
#
from lalinference.bayestar.deprecation import warn
warn('bayestar-localize-lvalert')
from lalinference.bayestar import command
methods = '''
......
......@@ -30,6 +30,9 @@ Public-domain cartographic data is courtesy of Natural Earth
# Command line interface
from lalinference.bayestar.deprecation import warn
warn('ligo-skymap-plot')
import argparse
from lalinference.bayestar import command
parser = command.ArgumentParser(parents=[command.figure_parser])
......
......@@ -21,6 +21,9 @@ false alarm rate.
"""
from __future__ import division
from lalinference.bayestar.deprecation import warn
warn('ligo-skymap-plot-stats')
# Command line interface.
import argparse
from lalinference.bayestar import command
......
......@@ -23,6 +23,9 @@ from __future__ import division
# Command line interface
from lalinference.bayestar.deprecation import warn
warn('ligo-skymap-plot-volume')
# Set no-op backend, because seaborn imports pyplot and we must not load X11
import matplotlib
matplotlib.use('Template')
......
......@@ -34,6 +34,9 @@ there is a choice for how to generate perturbed time and phase measurements:
from __future__ import division
from lalinference.bayestar.deprecation import warn
warn('bayestar-realize-coincs')
# Determine list of known detectors for command line arguments.
import lal
available_ifos = sorted(det.frDetector.prefix
......
......@@ -24,6 +24,9 @@ import lal
import lalsimulation
from lalinference.bayestar import command
from lalinference.bayestar.deprecation import warn
warn('bayestar-sample-model-psd-stats')
# Get names of PSD functions.
psd_name_prefix = 'SimNoisePSD'
psd_names = sorted(
......
......@@ -11,6 +11,7 @@ pymodule_PYTHON = \
__init__.py \
command.py \
decorator.py \
deprecation.py \
distance.py \
filter.py \
ligolw.py \
......
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.bayestar')
......@@ -521,3 +521,7 @@ def iterlines(file, start_message=start_msg, stop_message=stop_msg):
if is_tty:
print(stop_message, file=sys.stderr)
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.tool')
import inspect
import os
import re
import sys
import warnings
import textwrap
__all__ = ('warn',)
# Python <3.7 hides all DeprecationWarnings by default, whereas Python 3.7
# shows DeprecationWarnings that occur in main script (__main__) or in
# an interactive session. This subclass produces the Python 3.7 behavior.
class MovedWarning(DeprecationWarning):
pass
warnings.filterwarnings(
'default', category=MovedWarning, module='__main__')
def rewrap(s):
return textwrap.fill(re.sub(r'\s+', ' ', s))
def warn(new=None, old=None, kind='module'):
if old is None:
old = inspect.getmodule(inspect.currentframe().f_back.f_code).__name__
kind = 'module'
if old == '__main__':
old = os.path.basename(sys.argv[0])
old.replace('.py', '')
kind = 'tool'
if new is None:
new = old.replace('lalinference', 'ligo.skymap')
kwargs = dict(old=old, new=new, kind=kind)
message = '"{}" has moved to ligo.skymap.\n\n'.format(old)
message += rewrap(
'''The {old} {kind} from LALInference has been replaced by the {new}
{kind} from the ligo.skymap package. The old {kind} is no longer
tested and supported and will be removed in a future version of
LALInference. Please update to the ligo.skymap package.'''.format(
**kwargs))
python_version = sys.version_info[:2]
min_python_version = (3, 5)
if python_version < min_python_version:
message += '\n\n'
message += rewrap(
'''The ligo.skymap package requires Python {min_major}.{min_minor}
or newer. You have Python {major}.{minor}. Before installing
ligo.skymap, please update to Python {min_major}.{min_minor} or
newer.'''.format(
major=python_version[0],
minor=python_version[1],
min_major=min_python_version[0],
min_minor=min_python_version[1]))
message += '\n\n'
message += rewrap(
'''You can install ligo.skymap with pip by running this command in your
shell:''')
message += '\n\n'
message += ' pip install ligo.skymap'
message += '\n'
warnings.warn(message, MovedWarning, stacklevel=2)
import warnings
from .. import distance
from ..distance import *
__all__ = distance.__all__
warnings.warn('lalinference.bayestar.distance is deprecated, use lalinference.distance instead', DeprecationWarning)
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.distance')
......@@ -35,7 +35,6 @@ import lalsimulation
# My own imports
from .decorator import memoized
log = logging.getLogger('BAYESTAR')
......@@ -715,3 +714,7 @@ __interpolants = {
def interpolate_max(imax, y, window_length, method='catmull-rom'):
return __interpolants[method](imax, y, window_length)
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.bayestar.filter')
......@@ -2,5 +2,5 @@ import warnings
from .. import distance
from ..moc import *
__all__ = moc.__all__
warnings.warn('lalinference.bayestar.moc is deprecated, use lalinference.moc instead', DeprecationWarning)
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.moc')
......@@ -584,42 +584,6 @@ def _get_detector_location(ifo):
def get_detector_pair_axis(ifo1, ifo2, gmst):
"""Find the sky position where the line between two detectors pierces the
celestial sphere.
Parameters
----------
ifo1, ifo2 : str or `~lal.Detector` or `numpy.ndarray`
The detector positions. Can be specifed by name (e.g. `'H1'`), or by
`lal.Detector` object (e.g., as returned by
`lalsimulation.DetectorPrefixToLALDetector('H1')` or by the geocentric
Cartesian position in meters.
gmst : float
The Greenwich mean sidereal time in radians, as returned by
`lal.GreenwichMeanSiderealTime`.
Returns
-------
pole_ra : float
The right ascension in radians at which a ray from `ifo1` to `ifo2`
would pierce the celestial sphere.
pole_dec : float
The declination in radians at which a ray from `ifo1` to `ifo2` would
pierce the celestial sphere.
light_travel_time : float
The light travel time from `ifo1` to `ifo2` in seconds.
Example
-------
>>> ret = get_detector_pair_axis('H1', 'L1', 41758.384193753656)
>>> print(*np.around(ret, 5))
5.94546 -0.47622 0.01001
"""
ifo1 = _get_detector_location(ifo1)
ifo2 = _get_detector_location(ifo2)
......
......@@ -48,6 +48,9 @@ except ImportError:
import lal
import lalsimulation
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.bayestar')
log = logging.getLogger('BAYESTAR')
......
......@@ -29,6 +29,8 @@ import lalsimulation
from scipy import interpolate
from scipy import linalg
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.bayestar.filter')
log = logging.getLogger('BAYESTAR')
......
......@@ -639,3 +639,6 @@ def parameters_to_marginal_moments(prob, distmu, distsigma):
rbar = (prob * distmean).sum()
r2bar = (prob * (np.square(diststd) + np.square(distmean))).sum()
return rbar, np.sqrt(r2bar - np.square(rbar))
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.distance')
......@@ -119,3 +119,6 @@ def eigenframe_to_icrs(from_coo, to_frame):
return np.column_stack((from_coo.e_x.xyz.value,
from_coo.e_y.xyz.value,
from_coo.e_z.xyz.value))
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.coordinates.eigenframe')
......@@ -429,3 +429,6 @@ def reconstruct_nested(m, order='depthfirst', extra=True):
# FIXME: Replace with `yield from` in Python 3
for _ in func(m, extra):
yield _
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.healpix_tree')
......@@ -30,3 +30,6 @@ for _, module, _ in pkgutil.iter_modules([os.path.dirname(__file__)]):
# Clean up
del os, pkgutil, six
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.io')
......@@ -30,3 +30,6 @@ for _, module, _ in pkgutil.iter_modules([os.path.dirname(__file__)]):
# Clean up
del os, pkgutil, six
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.io.events')
......@@ -122,3 +122,6 @@ class SingleEvent(six.with_metaclass(ABCMeta)):
return _fmt(self, keys)
__repr__ = __str__
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.io.events.base')
......@@ -74,3 +74,6 @@ class DetectorDisabledEvent(Event):
return self.base_event.template_args
open = DetectorDisabledEventSource
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.io.events.detector_disabled')
......@@ -50,3 +50,6 @@ class GraceDBEventSource(EventSource):
open = GraceDBEventSource
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.io.events.gracedb')
......@@ -232,3 +232,6 @@ class HDFSingleEvent(SingleEvent):
open = HDFEventSource
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.io.events.hdf')
......@@ -282,3 +282,6 @@ class LigoLWSingleEvent(SingleEvent):
open = LigoLWEventSource
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.io.events.ligolw')
......@@ -81,3 +81,6 @@ def MagicEventSource(f, *args, **kwargs):
open = MagicEventSource
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.io.events.magic')
......@@ -48,3 +48,6 @@ class SQLiteEventSource(LigoLWEventSource):
open = SQLiteEventSource
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.io.events.sqlite')
......@@ -558,3 +558,6 @@ if __name__ == '__main__':
runtime=21.5)
print(read_sky_map('test.fits.gz'))
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.io.fits')
......@@ -270,3 +270,6 @@ def write_samples(table, filename, metadata=None, **kwargs):
raise KeyError(
'Unable to set metadata {0}[{1}] = {2}'.format(
internal_path, key, value))
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.io.hdf5')
......@@ -111,3 +111,6 @@ class BoundedKDE(gaussian_kde):
construct the KDE that have a lower KDE density than ``pt``."""
return np.count_nonzero(self(self.dataset) < self(pt)) / self.n
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.kde')
......@@ -129,3 +129,6 @@ def rasterize(moc_data):
that were in moc_data, with the exception of the UNIQ column.
"""
return _moc.rasterize(moc_data)
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.moc')
......@@ -33,3 +33,6 @@ for _, module, _ in pkgutil.iter_modules([os.path.dirname(__file__)]):
# Clean up
del os, pkgutil, six
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.plot')
......@@ -218,3 +218,6 @@ class AstroLambertAxes(LambertAxes):
self.xaxis.set_major_formatter(self.RaFormatter(degrees))
projection_registry.register(AstroLambertAxes)
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.plot.allsky')
......@@ -44,3 +44,6 @@ def wrapped_angle(a):
def wrapped_angle_deg(a):
"""Convert an angle to a reference angle between 0 and 2*pi."""
return np.mod(a, 360)
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.plot.angle')
......@@ -49,3 +49,6 @@ for name in ['cylon']:
locals().update({name: cmap})
# Register with Matplotlib.
cm.register_cmap(cmap=cmap)
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.plot.cmap')
......@@ -216,3 +216,6 @@ def outline_text(ax):
effects = [patheffects.withStroke(linewidth=2, foreground='w')]
for artist in ax.findobj(text.Text):
artist.set_path_effects(effects)
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.plot.healpix')
......@@ -65,3 +65,6 @@ def reticle(inner=0.5, outer=1.0, angle=0.0, which='lrtb'):
verts = np.dot(verts, R)
verts = np.swapaxes([inner * verts, outer * verts], 0, 1).reshape(-1, 2)
return Path(verts, codes)
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.plot.marker')
......@@ -192,3 +192,6 @@ def make_rect_poly(width, height, theta, phi, subdivisions=10):
else:
# Return list of vertices as longitude, latitude pairs.
return np.column_stack((wrapped_angle(phis), 0.5 * np.pi - thetas))
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.plot.poly')
......@@ -278,3 +278,6 @@ class PPPlot(axes.Axes):
return cls, {}
projection_registry.register(PPPlot)
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.plot.pp')
......@@ -61,3 +61,6 @@ def TemporaryDirectory(suffix='', prefix='tmp', dir=None, delete=True):
finally:
if delete:
shutil.rmtree(dir)
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.util.file')
......@@ -69,3 +69,6 @@ def get_filename(connection):
except ValueError:
raise RuntimeError('Expected exactly one attached database')
return filename
from lalinference.bayestar.deprecation import warn
warn('ligo.skymap.util.sqlite')
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE LIGO_LW SYSTEM "http://ldas-sw.ligo.caltech.edu/doc/ligolwAPI/html/ligolw_dtd.txt"><LIGO_LW>
<Table Name="processgroup:process:table">
<Column Name="processgroup:process:program" Type="lstring"/>
<Column Name="processgroup:process:version" Type="lstring"/>
<Column Name="processgroup:process:cvs_repository" Type="lstring"/>
<Column Name="processgroup:process:cvs_entry_time" Type="int_4s"/>
<Column Name="processgroup:process:comment" Type="lstring"/>
<Column Name="processgroup:process:is_online" Type="int_4s"/>
<Column Name="processgroup:process:node" Type="lstring"/>
<Column Name="processgroup:process:username" Type="lstring"/>
<Column Name="processgroup:process:unix_procid" Type="int_4s"/>
<Column Name="processgroup:process:start_time" Type="int_4s"/>
<Column Name="processgroup:process:end_time" Type="int_4s"/>
<Column Name="processgroup:process:jobid" Type="int_4s"/>
<Column Name="processgroup:process:domain" Type="lstring"/>
<Column Name="processgroup:process:ifos" Type="lstring"/>
<Column Name="processgroup:process:process_id" Type="ilwd:char"/>
<Stream Name="processgroup:process:table" Type="Local" Delimiter=",">
"inspinj","df26f1b39773c794bea00d14d299304f71eab4e0","UNCLEAN: Modified working tree",1150130991," ",0,"gs66-wintermute","273296831",19542,1150482408,1150482408,0,"lalapps","","process:process_id:0"
</Stream>
</Table>
<Table Name="process_paramsgroup:process_params:table">
<Column Name="process_paramsgroup:process_params:program" Type="lstring"/>
<Column Name="process_paramsgroup:process_params:process_id" Type="ilwd:char"/>
<Column Name="process_paramsgroup:process_params:param" Type="lstring"/>
<Column Name="process_paramsgroup:process_params:type" Type="lstring"/>
<Column Name="process_paramsgroup:process_params:value" Type="lstring"/>
<Stream Name="process_paramsgroup:process_params:table" Type="Local" Delimiter=",">
"inspinj","process:process_id:0","--m-distr","string","fixMasses",
"inspinj","process:process_id:0","--fixed-mass1","float","1.400000",
"inspinj","process:process_id:0","--fixed-mass2","float","1.400000",
"inspinj","process:process_id:0","--gps-start-time","int","1000000000",
"inspinj","process:process_id:0","--gps-end-time","int","1000000010",
"inspinj","process:process_id:0","--d-distr","string","uniform",
"inspinj","process:process_id:0","--min-distance","float","1.000000e+03",
"inspinj","process:process_id:0","--max-distance","float","1.000000e+06",
"inspinj","process:process_id:0","--l-distr","string","random",
"inspinj","process:process_id:0","--i-distr","string","uniform",
"inspinj","process:process_id:0","--f-lower","float","30.000000",
"inspinj","process:process_id:0","--waveform","string","TaylorF2threePointFivePN",
"inspinj","process:process_id:0","--disable-spin","string","",
"inspinj","process:process_id:0","--time-step","float","1.000000e+00",
"inspinj","process:process_id:0","--userTag","string","TEST"
</Stream>
</Table>
<Table Name="sim_inspiralgroup:sim_inspiral:table">
<Column Name="sim_inspiralgroup:sim_inspiral:process_id" Type="ilwd:char"/>
<Column Name="sim_inspiralgroup:sim_inspiral:waveform" Type="lstring"/>
<Column Name="sim_inspiralgroup:sim_inspiral:geocent_end_time" Type="int_4s"/>
<Column Name="sim_inspiralgroup:sim_inspiral:geocent_end_time_ns" Type="int_4s"/>
<Column Name="sim_inspiralgroup:sim_inspiral:h_end_time" Type="int_4s"/>
<Column Name="sim_inspiralgroup:sim_inspiral:h_end_time_ns" Type="int_4s"/>
<Column Name="sim_inspiralgroup:sim_inspiral:l_end_time" Type="int_4s"/>
<Column Name="sim_inspiralgroup:sim_inspiral:l_end_time_ns" Type="int_4s"/>
<Column Name="sim_inspiralgroup:sim_inspiral:g_end_time" Type="int_4s"/>
<Column Name="sim_inspiralgroup:sim_inspiral:g_end_time_ns" Type="int_4s"/>
<Column Name="sim_inspiralgroup:sim_inspiral:t_end_time" Type="int_4s"/>
<Column Name="sim_inspiralgroup:sim_inspiral:t_end_time_ns" Type="int_4s"/>
<Column Name="sim_inspiralgroup:sim_inspiral:v_end_time" Type="int_4s"/>
<Column Name="sim_inspiralgroup:sim_inspiral:v_end_time_ns" Type="int_4s"/>
<Column Name="sim_inspiralgroup:sim_inspiral:end_time_gmst" Type="real_8"/>
<Column Name="sim_inspiralgroup:sim_inspiral:source" Type="lstring"/>