From c604005531db1c768acb2e9d94e8e05904e30136 Mon Sep 17 00:00:00 2001 From: Tito Dal Canton Date: Wed, 22 Jan 2025 10:40:22 +0100 Subject: [PATCH 1/5] Change requirements, drop special case from tox.ini --- requirements.txt | 4 ++-- setup.py | 2 +- tox.ini | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index 2a87a4f7a1f..15a4dfe3755 100644 --- a/requirements.txt +++ b/requirements.txt @@ -34,8 +34,8 @@ urllib3 # addresses incompatibility between old flask/jinja2 and latest markupsafe markupsafe <= 2.0.1 -# Requirements for ligoxml access needed by some workflows -python-ligo-lw >= 1.8.1 +# Requirements for LIGO Light-Weight XML format access needed by some workflows +igwn-ligolw # Needed for Parameter Estimation Tasks emcee==2.2.1 diff --git a/setup.py b/setup.py index 70aa3c5ea8b..ee4315ce0ba 100755 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ 'setuptools', 'gwdatafind', 'pegasus-wms.api >= 5.0.8', - 'python-ligo-lw >= 1.7.0', + 'igwn-ligolw', 'igwn-segments', 'lalsuite!=7.2', 'lscsoft-glue>=1.59.3', diff --git a/tox.ini b/tox.ini index 623054bcc0b..0d94ed9c95f 100644 --- a/tox.ini +++ b/tox.ini @@ -16,8 +16,6 @@ conda_deps = cxx-compiler gsl mysqlclient - ; these packages don't install cleanly with pip, conda has patches - python-ligo-lw [bbhx] deps = From ba08d3c6ace5417a42740bfebeb596a8e7a7c85b Mon Sep 17 00:00:00 2001 From: Tito Dal Canton Date: Wed, 22 Jan 2025 10:42:42 +0100 Subject: [PATCH 2/5] Drop outdated version checks from test suite --- tools/pycbc_test_suite.sh | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/tools/pycbc_test_suite.sh b/tools/pycbc_test_suite.sh index 75cc706a49c..7a41bafd157 100755 --- a/tools/pycbc_test_suite.sh +++ b/tools/pycbc_test_suite.sh @@ -82,14 +82,10 @@ if [ "$PYCBC_TEST_TYPE" = "search" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then popd # run PyCBC Live test - if ((${PYTHON_MINOR_VERSION} > 7)); then - # ligo.skymap is only supporting python3.8+, and older releases are - # broken by a new release of python-ligo-lw - pushd examples/live - bash -e run.sh - test_result - popd - fi + pushd examples/live + bash -e run.sh + test_result + popd # run pycbc_multi_inspiral (PyGRB) test pushd examples/multi_inspiral @@ -149,14 +145,10 @@ if [ "$PYCBC_TEST_TYPE" = "inference" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then popd ## Run pycbc_make_skymap example - if ((${PYTHON_MINOR_VERSION} > 7)); then - # ligo.skymap is only supporting python3.8+, and older releases are - # broken by a new release of python-ligo-lw - pushd examples/make_skymap - bash -e simulated_data.sh - test_result - popd - fi + pushd examples/make_skymap + bash -e simulated_data.sh + test_result + popd fi if [ "$PYCBC_TEST_TYPE" = "docs" ] || [ -z ${PYCBC_TEST_TYPE+x} ]; then From e62adbe3dd4b5832755cebaf272c0005dc29571e Mon Sep 17 00:00:00 2001 From: Tito Dal Canton Date: Wed, 22 Jan 2025 11:11:27 +0100 Subject: [PATCH 3/5] Replace imports --- bin/all_sky_search/pycbc_coinc_hdfinjfind | 2 +- bin/all_sky_search/pycbc_make_bayestar_skymap | 2 +- .../pycbc_prepare_xml_for_gracedb | 4 ++-- bin/all_sky_search/pycbc_sngls_pastro | 2 +- bin/all_sky_search/pycbc_strip_injections | 2 +- bin/bank/pycbc_aligned_bank_cat | 2 +- bin/bank/pycbc_bank_verification | 2 +- bin/bank/pycbc_geom_aligned_bank | 4 ++-- bin/bank/pycbc_tmpltbank_to_chi_params | 2 +- bin/hwinj/pycbc_generate_hwinj | 8 ++++---- bin/minifollowups/pycbc_sngl_minifollowup | 4 ++-- bin/plotting/pycbc_page_segments | 2 +- bin/plotting/pycbc_page_vetotable | 4 ++-- .../pycbc_plot_Nth_loudest_coinc_omicron.py | 2 +- bin/pycbc_banksim | 4 ++-- bin/pycbc_banksim_match_combine | 2 +- bin/pycbc_banksim_skymax | 4 ++-- bin/pycbc_convertinjfiletohdf | 2 +- bin/pycbc_faithsim | 4 ++-- bin/pycbc_faithsim_collect_results | 2 +- bin/pycbc_get_ffinal | 6 +++--- bin/pycbc_inj_cut | 4 ++-- bin/pycbc_make_banksim | 6 +++--- bin/pycbc_make_faithsim | 4 ++-- bin/pycbc_optimal_snr | 4 ++-- bin/pycbc_randomize_inj_dist_by_optsnr | 4 ++-- bin/pycbc_split_inspinj | 4 ++-- bin/pycbc_splitbank | 6 +++--- bin/pycbc_upload_xml_to_gracedb | 4 ++-- examples/live/check_results.py | 4 ++-- examples/workflow/dayhopecheck/dayhopecheck.py | 6 +++--- pycbc/dq.py | 2 +- pycbc/events/veto.py | 2 +- pycbc/inject/inject.py | 2 +- pycbc/io/gracedb.py | 6 +++--- pycbc/io/hdf.py | 6 +++--- pycbc/io/ligolw.py | 18 +++++++++--------- pycbc/io/record.py | 2 +- pycbc/psd/read.py | 2 +- pycbc/tmpltbank/bank_output_utils.py | 2 +- pycbc/types/frequencyseries.py | 2 +- pycbc/waveform/bank.py | 2 +- pycbc/workflow/core.py | 6 +++--- pycbc/workflow/datafind.py | 2 +- test/test_injection.py | 6 +++--- test/test_io_live.py | 4 ++-- tools/timing/banksim/banksim.py | 4 ++-- 47 files changed, 90 insertions(+), 90 deletions(-) diff --git a/bin/all_sky_search/pycbc_coinc_hdfinjfind b/bin/all_sky_search/pycbc_coinc_hdfinjfind index f3806b9c823..b7c74d70ac0 100755 --- a/bin/all_sky_search/pycbc_coinc_hdfinjfind +++ b/bin/all_sky_search/pycbc_coinc_hdfinjfind @@ -4,7 +4,7 @@ files. """ import argparse, logging, types, numpy, os.path -from ligo.lw import lsctables, utils as ligolw_utils +from igwn_ligolw import lsctables, utils as ligolw_utils import igwn_segments as segments import pycbc from pycbc import events, init_logging diff --git a/bin/all_sky_search/pycbc_make_bayestar_skymap b/bin/all_sky_search/pycbc_make_bayestar_skymap index 3e32f028975..d1c7af81ffb 100644 --- a/bin/all_sky_search/pycbc_make_bayestar_skymap +++ b/bin/all_sky_search/pycbc_make_bayestar_skymap @@ -22,7 +22,7 @@ import os import glob import tempfile -from ligo.lw import lsctables, utils as ligolw_utils +from igwn_ligolw import lsctables, utils as ligolw_utils import pycbc from pycbc.waveform import bank as wavebank diff --git a/bin/all_sky_search/pycbc_prepare_xml_for_gracedb b/bin/all_sky_search/pycbc_prepare_xml_for_gracedb index 4e25a4d5b07..f26964b0592 100755 --- a/bin/all_sky_search/pycbc_prepare_xml_for_gracedb +++ b/bin/all_sky_search/pycbc_prepare_xml_for_gracedb @@ -29,8 +29,8 @@ matplotlib.use('agg') import lal import lal.series -from ligo.lw import lsctables -from ligo.lw import utils as ligolw_utils +from igwn_ligolw import lsctables +from igwn_ligolw import utils as ligolw_utils from igwn_segments import segment, segmentlist import pycbc diff --git a/bin/all_sky_search/pycbc_sngls_pastro b/bin/all_sky_search/pycbc_sngls_pastro index 4be30131617..84f6d179a08 100644 --- a/bin/all_sky_search/pycbc_sngls_pastro +++ b/bin/all_sky_search/pycbc_sngls_pastro @@ -12,7 +12,7 @@ coincidences. import pycbc, pycbc.io, copy import argparse, logging, numpy as np -from ligo.lw import lsctables, utils as ligolw_utils +from igwn_ligolw import lsctables, utils as ligolw_utils from pycbc import conversions as conv from pycbc.events import veto from pycbc.io.ligolw import LIGOLWContentHandler diff --git a/bin/all_sky_search/pycbc_strip_injections b/bin/all_sky_search/pycbc_strip_injections index 027ad6b5ac7..09e79150c9f 100644 --- a/bin/all_sky_search/pycbc_strip_injections +++ b/bin/all_sky_search/pycbc_strip_injections @@ -2,7 +2,7 @@ import numpy, argparse, pycbc.pnutils, logging from pycbc.events import veto from pycbc.io.ligolw import LIGOLWContentHandler -from ligo.lw import ligolw, table, utils as ligolw_utils +from igwn_ligolw import ligolw, table, utils as ligolw_utils effd = {"H1":"eff_dist_h", "L1":"eff_dist_l", "V1":"eff_dist_v"} diff --git a/bin/bank/pycbc_aligned_bank_cat b/bin/bank/pycbc_aligned_bank_cat index b3bb947a951..96962ffaca7 100644 --- a/bin/bank/pycbc_aligned_bank_cat +++ b/bin/bank/pycbc_aligned_bank_cat @@ -25,7 +25,7 @@ import logging import glob import argparse import numpy -from ligo.lw import utils +from igwn_ligolw import utils from pycbc import tmpltbank # Old ligolw output functions no longer imported at package level import pycbc.tmpltbank.bank_output_utils as bank_output diff --git a/bin/bank/pycbc_bank_verification b/bin/bank/pycbc_bank_verification index 97d65b07be6..613e8f2d312 100644 --- a/bin/bank/pycbc_bank_verification +++ b/bin/bank/pycbc_bank_verification @@ -29,7 +29,7 @@ import matplotlib matplotlib.use('Agg') import pylab -from ligo.lw import lsctables, utils as ligolw_utils +from igwn_ligolw import lsctables, utils as ligolw_utils import pycbc import pycbc.version diff --git a/bin/bank/pycbc_geom_aligned_bank b/bin/bank/pycbc_geom_aligned_bank index 48aac1d30d0..988f66e5c50 100644 --- a/bin/bank/pycbc_geom_aligned_bank +++ b/bin/bank/pycbc_geom_aligned_bank @@ -31,8 +31,8 @@ import logging import configparser from scipy import spatial -from ligo.lw import ligolw -from ligo.lw import utils as ligolw_utils +from igwn_ligolw import ligolw +from igwn_ligolw import utils as ligolw_utils import pycbc import pycbc.psd diff --git a/bin/bank/pycbc_tmpltbank_to_chi_params b/bin/bank/pycbc_tmpltbank_to_chi_params index b0314589ccb..817d2fbbe8c 100644 --- a/bin/bank/pycbc_tmpltbank_to_chi_params +++ b/bin/bank/pycbc_tmpltbank_to_chi_params @@ -33,7 +33,7 @@ import argparse import logging import numpy -from ligo.lw import lsctables, utils as ligolw_utils +from igwn_ligolw import lsctables, utils as ligolw_utils from pycbc import tmpltbank, psd, strain from pycbc.io.ligolw import LIGOLWContentHandler diff --git a/bin/hwinj/pycbc_generate_hwinj b/bin/hwinj/pycbc_generate_hwinj index 1bb28dc0c90..75f20ca6618 100644 --- a/bin/hwinj/pycbc_generate_hwinj +++ b/bin/hwinj/pycbc_generate_hwinj @@ -22,10 +22,10 @@ import numpy import os import sys -from ligo.lw import ligolw -from ligo.lw import lsctables -from ligo.lw import table -from ligo.lw import utils +from igwn_ligolw import ligolw +from igwn_ligolw import lsctables +from igwn_ligolw import table +from igwn_ligolw import utils import pycbc import pycbc.version diff --git a/bin/minifollowups/pycbc_sngl_minifollowup b/bin/minifollowups/pycbc_sngl_minifollowup index ea65cfb97c7..98e8fc3afd6 100644 --- a/bin/minifollowups/pycbc_sngl_minifollowup +++ b/bin/minifollowups/pycbc_sngl_minifollowup @@ -22,8 +22,8 @@ import argparse import logging import numpy -from ligo.lw import table -from ligo.lw import utils as ligolw_utils +from igwn_ligolw import table +from igwn_ligolw import utils as ligolw_utils from pycbc import init_logging, add_common_pycbc_options from pycbc.results import layout diff --git a/bin/plotting/pycbc_page_segments b/bin/plotting/pycbc_page_segments index 9a3f92ad8a2..5dbbb1a5a15 100644 --- a/bin/plotting/pycbc_page_segments +++ b/bin/plotting/pycbc_page_segments @@ -40,7 +40,7 @@ def timestr(s): return t def get_name(segment_file): - from ligo.lw import table, utils as ligolw_utils + from igwn_ligolw import table, utils as ligolw_utils from pycbc.io.ligolw import LIGOLWContentHandler indoc = ligolw_utils.load_filename( diff --git a/bin/plotting/pycbc_page_vetotable b/bin/plotting/pycbc_page_vetotable index 8e7a69a952f..e3c6d9077e3 100644 --- a/bin/plotting/pycbc_page_vetotable +++ b/bin/plotting/pycbc_page_vetotable @@ -23,8 +23,8 @@ import logging import numpy import sys -from ligo.lw import lsctables -from ligo.lw import utils +from igwn_ligolw import lsctables +from igwn_ligolw import utils import pycbc.results from pycbc.results import save_fig_with_metadata diff --git a/bin/plotting/pycbc_plot_Nth_loudest_coinc_omicron.py b/bin/plotting/pycbc_plot_Nth_loudest_coinc_omicron.py index 51a99d903f7..ba4d7c045ce 100644 --- a/bin/plotting/pycbc_plot_Nth_loudest_coinc_omicron.py +++ b/bin/plotting/pycbc_plot_Nth_loudest_coinc_omicron.py @@ -12,7 +12,7 @@ matplotlib.use('Agg') import matplotlib.pyplot as plt -from ligo.lw import lsctables, utils +from igwn_ligolw import lsctables, utils import pycbc.events from pycbc.waveform import ( diff --git a/bin/pycbc_banksim b/bin/pycbc_banksim index 0af218957ec..2f7f3bb226b 100644 --- a/bin/pycbc_banksim +++ b/bin/pycbc_banksim @@ -23,8 +23,8 @@ from numpy import complex64, array from argparse import ArgumentParser from math import ceil, log -from ligo.lw import utils as ligolw_utils -from ligo.lw import lsctables +from igwn_ligolw import utils as ligolw_utils +from igwn_ligolw import lsctables from pycbc.pnutils import mass1_mass2_to_mchirp_eta from pycbc.pnutils import mass1_mass2_to_tau0_tau3 diff --git a/bin/pycbc_banksim_match_combine b/bin/pycbc_banksim_match_combine index 652fd0b8813..f95029562b5 100644 --- a/bin/pycbc_banksim_match_combine +++ b/bin/pycbc_banksim_match_combine @@ -25,7 +25,7 @@ bank files, and the number of injections in each must correspond one-to-one. import argparse import numpy as np -from ligo.lw import utils, table +from igwn_ligolw import utils, table import pycbc from pycbc import pnutils diff --git a/bin/pycbc_banksim_skymax b/bin/pycbc_banksim_skymax index b5abcb9e056..1116765617f 100644 --- a/bin/pycbc_banksim_skymax +++ b/bin/pycbc_banksim_skymax @@ -23,8 +23,8 @@ from argparse import ArgumentParser from math import ceil, log from tqdm import tqdm -from ligo.lw import utils as ligolw_utils -from ligo.lw import lsctables +from igwn_ligolw import utils as ligolw_utils +from igwn_ligolw import lsctables from pycbc.pnutils import mass1_mass2_to_mchirp_eta from pycbc.pnutils import nearest_larger_binary_number diff --git a/bin/pycbc_convertinjfiletohdf b/bin/pycbc_convertinjfiletohdf index a9835523acc..259bc5162b2 100755 --- a/bin/pycbc_convertinjfiletohdf +++ b/bin/pycbc_convertinjfiletohdf @@ -30,7 +30,7 @@ from pycbc.io.record import FieldArray from pycbc.io.hdf import HFile from pycbc.io.ligolw import LIGOLWContentHandler -from ligo.lw import utils as ligolw_utils, lsctables +from igwn_ligolw import utils as ligolw_utils, lsctables # Handlers for alternative injection formats diff --git a/bin/pycbc_faithsim b/bin/pycbc_faithsim index 694b818ac46..01a0a915146 100644 --- a/bin/pycbc_faithsim +++ b/bin/pycbc_faithsim @@ -28,8 +28,8 @@ from numpy import complex64 import argparse import sys -from ligo.lw import utils as ligolw_utils -from ligo.lw import lsctables +from igwn_ligolw import utils as ligolw_utils +from igwn_ligolw import lsctables import pycbc.strain import pycbc.psd diff --git a/bin/pycbc_faithsim_collect_results b/bin/pycbc_faithsim_collect_results index 88a167678fa..60ca40d41a3 100755 --- a/bin/pycbc_faithsim_collect_results +++ b/bin/pycbc_faithsim_collect_results @@ -8,7 +8,7 @@ computing the match between them and creating a .dat file with the results. import argparse import numpy as np -from ligo.lw import utils, lsctables +from igwn_ligolw import utils, lsctables from pycbc import add_common_pycbc_options, init_logging from pycbc.io.ligolw import LIGOLWContentHandler diff --git a/bin/pycbc_get_ffinal b/bin/pycbc_get_ffinal index b273550b656..e2fe7685554 100644 --- a/bin/pycbc_get_ffinal +++ b/bin/pycbc_get_ffinal @@ -14,9 +14,9 @@ import argparse import pycbc from pycbc import waveform -from ligo.lw import utils as ligolw_utils -from ligo.lw import table -from ligo.lw.utils import process +from igwn_ligolw import utils as ligolw_utils +from igwn_ligolw import table +from igwn_ligolw.utils import process appx_options = waveform.td_approximants() + waveform.fd_approximants() diff --git a/bin/pycbc_inj_cut b/bin/pycbc_inj_cut index bdcf07d994f..30e2d7e4f82 100644 --- a/bin/pycbc_inj_cut +++ b/bin/pycbc_inj_cut @@ -30,8 +30,8 @@ import argparse import logging import numpy -from ligo.lw import utils as ligolw_utils -from ligo.lw import lsctables +from igwn_ligolw import utils as ligolw_utils +from igwn_ligolw import lsctables import pycbc import pycbc.inject diff --git a/bin/pycbc_make_banksim b/bin/pycbc_make_banksim index 3198b1cf0dc..10b2842f07d 100644 --- a/bin/pycbc_make_banksim +++ b/bin/pycbc_make_banksim @@ -94,8 +94,8 @@ def mkdir(dir_name): pass def mc_min_max_from_sorted_file(fname): - from ligo.lw.utils import load_filename - from ligo.lw.table import Table + from igwn_ligolw.utils import load_filename + from igwn_ligolw.table import Table from pycbc.pnutils import mass1_mass2_to_mchirp_eta from pycbc.io.ligolw import LIGOLWContentHandler @@ -303,7 +303,7 @@ f = open("scripts/pycbc_banksim_collect_results", "w") f.write("""#!/usr/bin/env python from os.path import isfile from numpy import * -from ligo.lw import utils, table +from igwn_ligolw import utils, table import glob from pycbc.io.ligolw import LIGOLWContentHandler diff --git a/bin/pycbc_make_faithsim b/bin/pycbc_make_faithsim index f9294cd5e85..03f61b1ad1a 100644 --- a/bin/pycbc_make_faithsim +++ b/bin/pycbc_make_faithsim @@ -147,7 +147,7 @@ dag.add_node(pnode) f = open("scripts/pycbc_faithsim_collect_results", "w") f.write("""#!/usr/bin/env python from numpy import * -from ligo.lw import utils, table, lsctables +from igwn_ligolw import utils, table, lsctables import glob from pycbc.io.ligolw import LIGOLWContentHandler @@ -218,7 +218,7 @@ matplotlib.use('Agg') import matplotlib.cm import pylab from numpy import * -from ligo.lw import utils, table, lsctables +from igwn_ligolw import utils, table, lsctables from matplotlib.ticker import MultipleLocator, FormatStrFormatter import glob diff --git a/bin/pycbc_optimal_snr b/bin/pycbc_optimal_snr index 121f0b8c1ab..60e44278b6f 100644 --- a/bin/pycbc_optimal_snr +++ b/bin/pycbc_optimal_snr @@ -27,8 +27,8 @@ import argparse import multiprocessing import numpy as np -from ligo.lw import utils as ligolw_utils -from ligo.lw import lsctables +from igwn_ligolw import utils as ligolw_utils +from igwn_ligolw import lsctables import pycbc import pycbc.inject diff --git a/bin/pycbc_randomize_inj_dist_by_optsnr b/bin/pycbc_randomize_inj_dist_by_optsnr index 3b6c3b78ed6..d5f0fbd71f5 100644 --- a/bin/pycbc_randomize_inj_dist_by_optsnr +++ b/bin/pycbc_randomize_inj_dist_by_optsnr @@ -11,8 +11,8 @@ import time from scipy import stats, special from argparse import ArgumentParser -from ligo.lw import lsctables -from ligo.lw import utils as ligolw_utils +from igwn_ligolw import lsctables +from igwn_ligolw import utils as ligolw_utils import pycbc from pycbc.io.ligolw import LIGOLWContentHandler diff --git a/bin/pycbc_split_inspinj b/bin/pycbc_split_inspinj index 7cfaef6143b..dfd2400779c 100644 --- a/bin/pycbc_split_inspinj +++ b/bin/pycbc_split_inspinj @@ -2,8 +2,8 @@ # Copyright (C) 2014 Andrew Lundgren import argparse -from ligo.lw import utils as ligolw_utils -from ligo.lw import lsctables +from igwn_ligolw import utils as ligolw_utils +from igwn_ligolw import lsctables from itertools import cycle import pycbc diff --git a/bin/pycbc_splitbank b/bin/pycbc_splitbank index ab4f59e6276..1bc942aefcc 100644 --- a/bin/pycbc_splitbank +++ b/bin/pycbc_splitbank @@ -30,9 +30,9 @@ import argparse from numpy import random, ceil -from ligo.lw import ligolw -from ligo.lw import lsctables -from ligo.lw import utils as ligolw_utils +from igwn_ligolw import ligolw +from igwn_ligolw import lsctables +from igwn_ligolw import utils as ligolw_utils import pycbc from pycbc.io.ligolw import LIGOLWContentHandler, create_process_table diff --git a/bin/pycbc_upload_xml_to_gracedb b/bin/pycbc_upload_xml_to_gracedb index 53554343c77..f26e0a0d087 100755 --- a/bin/pycbc_upload_xml_to_gracedb +++ b/bin/pycbc_upload_xml_to_gracedb @@ -30,8 +30,8 @@ matplotlib.use('agg') from ligo.gracedb.rest import GraceDb import lal import lal.series -from ligo.lw import lsctables -from ligo.lw import utils as ligolw_utils +from igwn_ligolw import lsctables +from igwn_ligolw import utils as ligolw_utils from igwn_segments import segment, segmentlist import pycbc diff --git a/examples/live/check_results.py b/examples/live/check_results.py index 42b932ae88e..437a68d4eb7 100755 --- a/examples/live/check_results.py +++ b/examples/live/check_results.py @@ -8,8 +8,8 @@ import pycbc from pycbc.io import FieldArray, HFile from pycbc.io.ligolw import LIGOLWContentHandler -from ligo.lw.utils import load_filename as load_xml_doc -from ligo.lw import lsctables +from igwn_ligolw.utils import load_filename as load_xml_doc +from igwn_ligolw import lsctables from pycbc import conversions as conv from ligo.skymap.io import LigoLWEventSource diff --git a/examples/workflow/dayhopecheck/dayhopecheck.py b/examples/workflow/dayhopecheck/dayhopecheck.py index 5a9c887634d..2cfc766f3c3 100755 --- a/examples/workflow/dayhopecheck/dayhopecheck.py +++ b/examples/workflow/dayhopecheck/dayhopecheck.py @@ -49,9 +49,9 @@ import igwn_segments as segments import pycbc.workflow as _workflow -from ligo.lw import ligolw -from ligo.lw import utils as ligolw_utils -from ligo.lw.utils import process as ligolw_process +from igwn_ligolw import ligolw +from igwn_ligolw import utils as ligolw_utils +from igwn_ligolw.utils import process as ligolw_process from glue.segmentdb import segmentdb_utils diff --git a/pycbc/dq.py b/pycbc/dq.py index acdb0031006..02be566297b 100644 --- a/pycbc/dq.py +++ b/pycbc/dq.py @@ -52,7 +52,7 @@ def parse_veto_definer(veto_def_filename, ifos): Returns a dictionary first indexed by ifo, then category level, and finally a list of veto definitions. """ - from ligo.lw import table, utils as ligolw_utils + from igwn_ligolw import table, utils as ligolw_utils from pycbc.io.ligolw import LIGOLWContentHandler as h data = {} diff --git a/pycbc/events/veto.py b/pycbc/events/veto.py index c1f77d6f0a9..ec4f22fd1ce 100644 --- a/pycbc/events/veto.py +++ b/pycbc/events/veto.py @@ -4,7 +4,7 @@ import logging import numpy from igwn_segments import segment, segmentlist -from ligo.lw import table, lsctables, utils as ligolw_utils +from igwn_ligolw import table, lsctables, utils as ligolw_utils logger = logging.getLogger('pycbc.events.veto') diff --git a/pycbc/inject/inject.py b/pycbc/inject/inject.py index 1e15c692df8..921e544ddfb 100644 --- a/pycbc/inject/inject.py +++ b/pycbc/inject/inject.py @@ -32,7 +32,7 @@ from abc import ABCMeta, abstractmethod import lal -from ligo.lw import utils as ligolw_utils, ligolw, lsctables +from igwn_ligolw import utils as ligolw_utils, ligolw, lsctables from pycbc import waveform, frame, libutils from pycbc.opt import LimitedSizeDict diff --git a/pycbc/io/gracedb.py b/pycbc/io/gracedb.py index 38827b12c31..c612403622c 100644 --- a/pycbc/io/gracedb.py +++ b/pycbc/io/gracedb.py @@ -10,9 +10,9 @@ from multiprocessing.dummy import threading import lal -from ligo.lw import ligolw -from ligo.lw import lsctables -from ligo.lw import utils as ligolw_utils +from igwn_ligolw import ligolw +from igwn_ligolw import lsctables +from igwn_ligolw import utils as ligolw_utils import pycbc from pycbc import version as pycbc_version diff --git a/pycbc/io/hdf.py b/pycbc/io/hdf.py index e5d61afe4a1..fd8e93b8b39 100644 --- a/pycbc/io/hdf.py +++ b/pycbc/io/hdf.py @@ -12,9 +12,9 @@ from io import BytesIO from lal import LIGOTimeGPS -from ligo.lw import ligolw -from ligo.lw import lsctables -from ligo.lw import utils as ligolw_utils +from igwn_ligolw import ligolw +from igwn_ligolw import lsctables +from igwn_ligolw import utils as ligolw_utils from pycbc.io.ligolw import ( return_search_summary, diff --git a/pycbc/io/ligolw.py b/pycbc/io/ligolw.py index ef7d58faa84..59b6a60ab5d 100644 --- a/pycbc/io/ligolw.py +++ b/pycbc/io/ligolw.py @@ -18,16 +18,16 @@ import os import sys import numpy -from ligo.lw import lsctables -from ligo.lw import ligolw -from ligo.lw.ligolw import Param, LIGOLWContentHandler \ +from igwn_ligolw import lsctables +from igwn_ligolw import ligolw +from igwn_ligolw.ligolw import Param, LIGOLWContentHandler \ as OrigLIGOLWContentHandler -from ligo.lw.lsctables import TableByName -from ligo.lw.table import Column, TableStream -from ligo.lw.types import FormatFunc, FromPyType, ToPyType -from ligo.lw.utils import process as ligolw_process -from ligo.lw.param import Param as LIGOLWParam -from ligo.lw.array import Array as LIGOLWArray +from igwn_ligolw.lsctables import TableByName +from igwn_ligolw.table import Column, TableStream +from igwn_ligolw.types import FormatFunc, FromPyType, ToPyType +from igwn_ligolw.utils import process as ligolw_process +from igwn_ligolw.param import Param as LIGOLWParam +from igwn_ligolw.array import Array as LIGOLWArray import pycbc.version as pycbc_version diff --git a/pycbc/io/record.py b/pycbc/io/record.py index 1fbc73aa176..b8e3db5e9ef 100644 --- a/pycbc/io/record.py +++ b/pycbc/io/record.py @@ -29,7 +29,7 @@ """ import types, re, copy, numpy, inspect -from ligo.lw import types as ligolw_types +from igwn_ligolw import types as ligolw_types from pycbc import coordinates, conversions, cosmology from pycbc.population import population_models from pycbc.waveform import parameters diff --git a/pycbc/psd/read.py b/pycbc/psd/read.py index 05ba2d6f42d..104624f39ce 100644 --- a/pycbc/psd/read.py +++ b/pycbc/psd/read.py @@ -166,7 +166,7 @@ def from_xml(filename, length, delta_f, low_freq_cutoff, ifo_string=None, """ import lal.series - from ligo.lw import utils as ligolw_utils + from igwn_ligolw import utils as ligolw_utils with open(filename, 'rb') as fp: ct_handler = lal.series.PSDContentHandler diff --git a/pycbc/tmpltbank/bank_output_utils.py b/pycbc/tmpltbank/bank_output_utils.py index 334a2bd00aa..11c08bf95a8 100644 --- a/pycbc/tmpltbank/bank_output_utils.py +++ b/pycbc/tmpltbank/bank_output_utils.py @@ -2,7 +2,7 @@ import numpy from lal import PI, MTSUN_SI, TWOPI, GAMMA -from ligo.lw import ligolw, lsctables, utils as ligolw_utils +from igwn_ligolw import ligolw, lsctables, utils as ligolw_utils from pycbc import pnutils from pycbc.tmpltbank.lambda_mapping import ethinca_order_from_string diff --git a/pycbc/types/frequencyseries.py b/pycbc/types/frequencyseries.py index d0d51e64af9..47e65870f49 100644 --- a/pycbc/types/frequencyseries.py +++ b/pycbc/types/frequencyseries.py @@ -400,7 +400,7 @@ def save(self, path, group=None, ifo='P1'): _numpy.savetxt(path, output) elif ext == '.xml' or path.endswith('.xml.gz'): from pycbc.io.ligolw import make_psd_xmldoc - from ligo.lw import utils + from igwn_ligolw import utils if self.kind != 'real': raise ValueError('XML only supports real frequency series') diff --git a/pycbc/waveform/bank.py b/pycbc/waveform/bank.py index 2c1d152e08a..3424dc5cb8b 100644 --- a/pycbc/waveform/bank.py +++ b/pycbc/waveform/bank.py @@ -31,7 +31,7 @@ import h5py from copy import copy import numpy as np -from ligo.lw import lsctables, utils as ligolw_utils +from igwn_ligolw import lsctables, utils as ligolw_utils import pycbc.waveform import pycbc.pnutils import pycbc.waveform.compress diff --git a/pycbc/workflow/core.py b/pycbc/workflow/core.py index 7037f23ae64..0a25ecdb0bd 100644 --- a/pycbc/workflow/core.py +++ b/pycbc/workflow/core.py @@ -47,9 +47,9 @@ import lal import lal.utils import Pegasus.api # Try and move this into pegasus_workflow -from ligo.lw import lsctables, ligolw -from ligo.lw import utils as ligolw_utils -from ligo.lw.utils import segments as ligolw_segments +from igwn_ligolw import lsctables, ligolw +from igwn_ligolw import utils as ligolw_utils +from igwn_ligolw.utils import segments as ligolw_segments from pycbc import makedir from pycbc.io.ligolw import LIGOLWContentHandler, create_process_table diff --git a/pycbc/workflow/datafind.py b/pycbc/workflow/datafind.py index 1a9310fb470..fa427076c76 100644 --- a/pycbc/workflow/datafind.py +++ b/pycbc/workflow/datafind.py @@ -34,7 +34,7 @@ import urllib.parse import igwn_segments as segments -from ligo.lw import utils, table +from igwn_ligolw import utils, table from gwdatafind import find_urls as find_frame_urls from pycbc.workflow.core import SegFile, File, FileList, make_analysis_dir diff --git a/test/test_injection.py b/test/test_injection.py index 2ffb8479bfa..dc0f5b474ab 100644 --- a/test/test_injection.py +++ b/test/test_injection.py @@ -26,9 +26,9 @@ import unittest import numpy import itertools -from ligo.lw import ligolw -from ligo.lw import lsctables -from ligo.lw import utils as ligolw_utils +from igwn_ligolw import ligolw +from igwn_ligolw import lsctables +from igwn_ligolw import utils as ligolw_utils from utils import parse_args_cpu_only, simple_exit # Injection tests only need to happen on the CPU diff --git a/test/test_io_live.py b/test/test_io_live.py index d35e5516a1c..3bada104709 100644 --- a/test/test_io_live.py +++ b/test/test_io_live.py @@ -25,8 +25,8 @@ from pycbc.types import TimeSeries, FrequencySeries from pycbc.io.gracedb import CandidateForGraceDB from pycbc.io.ligolw import LIGOLWContentHandler -from ligo.lw import lsctables -from ligo.lw import utils as ligolw_utils +from igwn_ligolw import lsctables +from igwn_ligolw import utils as ligolw_utils from lal import series as lalseries # if we have the GraceDb module then we can do deeper tests, diff --git a/tools/timing/banksim/banksim.py b/tools/timing/banksim/banksim.py index 407dffdd614..59405af72f8 100644 --- a/tools/timing/banksim/banksim.py +++ b/tools/timing/banksim/banksim.py @@ -26,8 +26,8 @@ import sys from numpy import complex64,float32 from optparse import OptionParser -from ligo.lw import utils as ligolw_utils -from ligo.lw import table, lsctables +from igwn_ligolw import utils as ligolw_utils +from igwn_ligolw import table, lsctables from pycbc.utils import mass1_mass2_to_mchirp_eta from pycbc.waveform import get_td_waveform, get_fd_waveform, td_approximants, fd_approximants From 2352dd4a9840cb3761b0efac10096c0a297b2ce1 Mon Sep 17 00:00:00 2001 From: Tito Dal Canton Date: Wed, 22 Jan 2025 11:15:25 +0100 Subject: [PATCH 4/5] Update a comment and docstring --- pycbc/io/ligolw.py | 2 +- pycbc/io/record.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pycbc/io/ligolw.py b/pycbc/io/ligolw.py index 59b6a60ab5d..7f52d3578c0 100644 --- a/pycbc/io/ligolw.py +++ b/pycbc/io/ligolw.py @@ -144,7 +144,7 @@ def create_process_table(document, program_name=None, detectors=None, if options is None: options = {} - # ligo.lw does not like `cvs_entry_time` being an empty string + # igwn_ligolw does not like `cvs_entry_time` being an empty string cvs_entry_time = pycbc_version.date or None opts = options.copy() diff --git a/pycbc/io/record.py b/pycbc/io/record.py index b8e3db5e9ef..fac126bce61 100644 --- a/pycbc/io/record.py +++ b/pycbc/io/record.py @@ -708,7 +708,7 @@ def bar(self): Convert a LIGOLW xml table: >>> type(sim_table) - ligo.lw.lsctables.SimInspiralTable + igwn_ligolw.lsctables.SimInspiralTable >>> sim_array = FieldArray.from_ligolw_table(sim_table) >>> sim_array.mass1 array([ 2.27440691, 1.85058105, 1.61507106, ..., 2.0504961 , From bfa8c0a7dc96b013bf798078067f3b7aa348a90b Mon Sep 17 00:00:00 2001 From: Tito Dal Canton Date: Wed, 22 Jan 2025 11:17:50 +0000 Subject: [PATCH 5/5] Take care of deprecation --- pycbc/io/ligolw.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pycbc/io/ligolw.py b/pycbc/io/ligolw.py index 7f52d3578c0..4be07e2086d 100644 --- a/pycbc/io/ligolw.py +++ b/pycbc/io/ligolw.py @@ -20,13 +20,12 @@ import numpy from igwn_ligolw import lsctables from igwn_ligolw import ligolw -from igwn_ligolw.ligolw import Param, LIGOLWContentHandler \ +from igwn_ligolw.ligolw import LIGOLWContentHandler \ as OrigLIGOLWContentHandler from igwn_ligolw.lsctables import TableByName from igwn_ligolw.table import Column, TableStream from igwn_ligolw.types import FormatFunc, FromPyType, ToPyType from igwn_ligolw.utils import process as ligolw_process -from igwn_ligolw.param import Param as LIGOLWParam from igwn_ligolw.array import Array as LIGOLWArray import pycbc.version as pycbc_version @@ -183,7 +182,7 @@ def legacy_row_id_converter(ContentHandler): def endElementNS(self, uri_localname, qname, __orig_endElementNS=ContentHandler.endElementNS): """Convert values of elements from ilwdchar to int.""" - if isinstance(self.current, Param) and self.current.Type in IDTypes: + if isinstance(self.current, ligolw.Param) and self.current.Type in IDTypes: old_type = ToPyType[self.current.Type] old_val = str(old_type(self.current.pcdata)) new_value = ROWID_PYTYPE(old_val.split(":")[-1]) @@ -265,7 +264,7 @@ def _build_series(series, dim_names, comment, delta_name, delta_unit): if comment is not None: elem.appendChild(ligolw.Comment()).pcdata = comment elem.appendChild(ligolw.Time.from_gps(series.epoch, 'epoch')) - elem.appendChild(LIGOLWParam.from_pyvalue('f0', series.f0, unit='s^-1')) + elem.appendChild(ligolw.Param.from_pyvalue('f0', series.f0, unit='s^-1')) delta = getattr(series, delta_name) if numpy.iscomplexobj(series.data.data): data = numpy.row_stack(( @@ -308,7 +307,7 @@ def make_psd_xmldoc(psddict, xmldoc=None): 's^-1' ) fs = lw.appendChild(xmlseries) - fs.appendChild(LIGOLWParam.from_pyvalue('instrument', instrument)) + fs.appendChild(ligolw.Param.from_pyvalue('instrument', instrument)) return xmldoc def snr_series_to_xml(snr_series, document, sngl_inspiral_id): @@ -326,7 +325,7 @@ def snr_series_to_xml(snr_series, document, sngl_inspiral_id): 's' ) snr_node = document.childNodes[-1].appendChild(snr_xml) - eid_param = LIGOLWParam.from_pyvalue('event_id', sngl_inspiral_id) + eid_param = ligolw.Param.from_pyvalue('event_id', sngl_inspiral_id) snr_node.appendChild(eid_param) def get_table_columns(table):