From 014ecb7684571fc9f44b6b35cc34655eb6b592c5 Mon Sep 17 00:00:00 2001 From: "sunil.simha95@gmail.com" Date: Thu, 19 Feb 2026 13:17:34 -0600 Subject: [PATCH 1/7] getting rid of unncessary imports --- frb/figures/finder.py | 2 +- frb/surveys/des.py | 5 ----- frb/surveys/panstarrs.py | 3 --- frb/surveys/sdss.py | 2 -- frb/surveys/wise.py | 4 ---- 5 files changed, 1 insertion(+), 15 deletions(-) diff --git a/frb/figures/finder.py b/frb/figures/finder.py index 0993967ee..ccd8aab9b 100644 --- a/frb/figures/finder.py +++ b/frb/figures/finder.py @@ -26,7 +26,7 @@ from frb.surveys import images try: - from photutils import SkyRectangularAperture + from photutils.aperture import SkyRectangularAperture except ImportError: flag_photu = False print('Install the photutils package to be able to add a slit to an image') diff --git a/frb/surveys/des.py b/frb/surveys/des.py index 4b07120f4..3271dbfad 100644 --- a/frb/surveys/des.py +++ b/frb/surveys/des.py @@ -1,14 +1,9 @@ """DES Survey""" -import numpy as np -from astropy import units, io, utils - from frb.surveys import dlsurvey from frb.surveys import catalog_utils from frb.surveys import defs -from IPython import embed - # Dependencies try: from pyvo.dal import sia diff --git a/frb/surveys/panstarrs.py b/frb/surveys/panstarrs.py index cdfd744a1..bee8e473e 100644 --- a/frb/surveys/panstarrs.py +++ b/frb/surveys/panstarrs.py @@ -9,13 +9,10 @@ from astropy import units as u,utils as astroutils from astropy.io import fits -from astropy.coordinates import SkyCoord, match_coordinates_sky from astropy.table import Table, join from ..galaxies.defs import PanSTARRS_bands import importlib_resources -from .images import grab_from_url - import warnings import requests diff --git a/frb/surveys/sdss.py b/frb/surveys/sdss.py index 23ed961bf..a8a9325df 100644 --- a/frb/surveys/sdss.py +++ b/frb/surveys/sdss.py @@ -2,10 +2,8 @@ import warnings import numpy as np -from IPython import embed from astropy import units -from astropy.io import fits from astropy.coordinates import SkyCoord from astropy.coordinates import match_coordinates_sky from astropy.table import Table diff --git a/frb/surveys/wise.py b/frb/surveys/wise.py index 94445e329..8ea4201ab 100644 --- a/frb/surveys/wise.py +++ b/frb/surveys/wise.py @@ -7,10 +7,6 @@ from frb.surveys import surveycoord from frb.surveys import catalog_utils -from frb.surveys import defs - - -from IPython import embed try: from pyvo.dal import TAPService, sia From b17f16c25df0d09a8fb7351650a8f254fa7e986c Mon Sep 17 00:00:00 2001 From: "sunil.simha95@gmail.com" Date: Thu, 19 Feb 2026 13:18:38 -0600 Subject: [PATCH 2/7] more unnecessary imports --- frb/surveys/twomass.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/frb/surveys/twomass.py b/frb/surveys/twomass.py index 7570c182c..ac747e5fe 100644 --- a/frb/surveys/twomass.py +++ b/frb/surveys/twomass.py @@ -5,18 +5,12 @@ import numpy as np -from astropy import units as u,utils as astroutils -from astropy.io import fits -from astropy.coordinates import SkyCoord, match_coordinates_sky -from astropy.table import Table, join +from astropy import units as u from ..galaxies.defs import MASS_bands from astroquery.ipac.irsa import Irsa -from frb.surveys import surveycoord,catalog_utils,images +from frb.surveys import surveycoord,catalog_utils -import os - -from IPython import embed # Define the data model for 2MASS data photom = {} From f3833e4ecfd73db7cbc9d2d34167335d9bc5c949 Mon Sep 17 00:00:00 2001 From: "sunil.simha95@gmail.com" Date: Thu, 19 Feb 2026 15:06:28 -0600 Subject: [PATCH 3/7] remove unused imports from all .py files --- frb/dlas.py | 1 - frb/dm_kde/dm_frb_sim.py | 3 --- frb/dm_kde/pdf_fns.py | 2 -- frb/dm_kde/transient_kdes.py | 2 -- frb/figures/finder.py | 3 +-- frb/frb.py | 5 ----- frb/frb_surveys/chime.py | 4 ---- frb/galaxies/cigale.py | 2 +- frb/galaxies/eazy.py | 1 - frb/galaxies/extra_data.py | 1 - frb/galaxies/frbgalaxy.py | 3 --- frb/galaxies/galfit.py | 2 +- frb/galaxies/hosts.py | 3 --- frb/galaxies/mag_dm.py | 5 ----- frb/galaxies/nebular.py | 1 - frb/galaxies/offsets.py | 1 - frb/galaxies/photom.py | 5 ++--- frb/galaxies/utils.py | 5 +---- frb/halos/models.py | 2 -- frb/io.py | 3 --- frb/mw.py | 4 ---- frb/scripts/image.py | 1 - frb/scripts/iteration.py | 1 - frb/scripts/pz_given_dm.py | 9 --------- frb/scripts/pzdm_mag.py | 2 -- frb/scripts/pzdm_mag_crossmatch.py | 2 -- frb/scripts/r_vs_dm.py | 19 ------------------- frb/scripts/random_assoc.py | 4 ++-- frb/scripts/sightline.py | 2 -- frb/scripts/tns.py | 6 ------ frb/surveys/catalog_utils.py | 2 +- frb/surveys/decals.py | 1 - frb/surveys/delve.py | 1 - frb/surveys/galex.py | 8 +------- frb/surveys/heasarc.py | 2 -- frb/surveys/hsc.py | 7 +------ frb/surveys/nedlvs.py | 1 - frb/surveys/nsc.py | 1 - frb/surveys/psrcat.py | 2 -- frb/surveys/tns_util.py | 7 ------- frb/surveys/vista.py | 2 +- frb/tests/test_build.py | 1 - frb/tests/test_dmism.py | 5 ----- frb/tests/test_experiment.py | 3 --- frb/tests/test_finder.py | 1 - frb/tests/test_frb.py | 1 - frb/tests/test_frbdlas.py | 1 - frb/tests/test_frbem.py | 1 - frb/tests/test_frbhalos.py | 1 - frb/tests/test_frbhosts.py | 7 +++---- frb/tests/test_frbigm.py | 1 - frb/tests/test_frbio.py | 5 ----- frb/tests/test_frbobs.py | 3 --- frb/tests/test_frbrm.py | 2 -- frb/tests/test_frbtscatt.py | 1 - frb/tests/test_galaxies.py | 3 --- frb/tests/test_photom.py | 3 --- frb/tests/test_pzdm.py | 12 ------------ frb/tests/test_tnsscripts.py | 4 ++-- frb/utils.py | 2 -- 60 files changed, 17 insertions(+), 178 deletions(-) diff --git a/frb/dlas.py b/frb/dlas.py index 100baaabb..78a3a3fc0 100644 --- a/frb/dlas.py +++ b/frb/dlas.py @@ -5,7 +5,6 @@ from __future__ import print_function, absolute_import, division, unicode_literals import numpy as np -import pdb from scipy.interpolate import interp1d diff --git a/frb/dm_kde/dm_frb_sim.py b/frb/dm_kde/dm_frb_sim.py index 7d8115197..9ca36d7e1 100644 --- a/frb/dm_kde/dm_frb_sim.py +++ b/frb/dm_kde/dm_frb_sim.py @@ -7,12 +7,9 @@ import numpy as np import scipy as sp import pandas as pd -from pandas import DataFrame as df from scipy.stats import lognorm from scipy.signal import argrelextrema from pdf_fns import make_kde_funtion, make_pdf, rv_amount -import matplotlib -import matplotlib.pyplot as plt from astropy import units import random import logging diff --git a/frb/dm_kde/pdf_fns.py b/frb/dm_kde/pdf_fns.py index dfaf63115..ad789f7e8 100755 --- a/frb/dm_kde/pdf_fns.py +++ b/frb/dm_kde/pdf_fns.py @@ -2,8 +2,6 @@ import numpy as np import scipy as sp -import pandas as pd -import sklearn from sklearn.model_selection import GridSearchCV from sklearn.neighbors import KernelDensity diff --git a/frb/dm_kde/transient_kdes.py b/frb/dm_kde/transient_kdes.py index 97ac71e7b..52f8690ae 100644 --- a/frb/dm_kde/transient_kdes.py +++ b/frb/dm_kde/transient_kdes.py @@ -5,9 +5,7 @@ from asymmetric_kde import ProperGammaEstimator from pdf_fns import make_kde_funtion -from data import FRBs import numpy as np -import pandas as pd from scipy.signal import argrelextrema from astropy.stats import bootstrap from astropy.utils import NumpyRNGContext diff --git a/frb/figures/finder.py b/frb/figures/finder.py index ccd8aab9b..2f35e5a0e 100644 --- a/frb/figures/finder.py +++ b/frb/figures/finder.py @@ -1,5 +1,5 @@ """ Module for generating a finder chart """ -import os + import numpy as np from IPython import embed @@ -8,7 +8,6 @@ from matplotlib import font_manager import matplotlib.cm as cm -from PIL import Image from astropy import units from astropy.visualization.wcsaxes import SphericalCircle diff --git a/frb/frb.py b/frb/frb.py index e0e3b0822..7c82a873a 100644 --- a/frb/frb.py +++ b/frb/frb.py @@ -1,7 +1,6 @@ """ Module for an FRB event """ import inspect -from importlib import resources import importlib_resources import os @@ -21,10 +20,6 @@ from frb import mw from frb import defs from frb.galaxies import frbgalaxy - -from IPython import embed - - class GenericFRB(object): """ Parent object for FRBs diff --git a/frb/frb_surveys/chime.py b/frb/frb_surveys/chime.py index f88ea1c4b..c6780f540 100644 --- a/frb/frb_surveys/chime.py +++ b/frb/frb_surveys/chime.py @@ -1,6 +1,4 @@ """ CHIME/FRB calculations """ -import os -from astropy.io import ascii import numpy as np import matplotlib.pyplot as plt @@ -18,8 +16,6 @@ #import dustmaps.sfd #dustmaps.sfd.fetch() -from IPython import embed - def check_frb_mr(outfile:str='mr_pdf.png', pdf_file:str=None): """ Generate a plot of the host galaxy M_r PDF diff --git a/frb/galaxies/cigale.py b/frb/galaxies/cigale.py index 399b05651..c34724a8d 100644 --- a/frb/galaxies/cigale.py +++ b/frb/galaxies/cigale.py @@ -16,7 +16,7 @@ print("You will need to install pcigale to use the cigale.py module") else: from pcigale.analysis_modules import get_module - from pcigale.utils.console import INFO, WARNING, ERROR, console + from pcigale.utils.console import WARNING, ERROR, console from frb.surveys.catalog_utils import _detect_mag_cols, convert_mags_to_flux diff --git a/frb/galaxies/eazy.py b/frb/galaxies/eazy.py index 4746872c0..be308c0bc 100644 --- a/frb/galaxies/eazy.py +++ b/frb/galaxies/eazy.py @@ -14,7 +14,6 @@ from frb.surveys import catalog_utils from frb import defs -from IPython import embed # Necessary because people might not execute eazy from src # but might have a copy in bin or some other location. diff --git a/frb/galaxies/extra_data.py b/frb/galaxies/extra_data.py index 943c636f7..d875f055a 100644 --- a/frb/galaxies/extra_data.py +++ b/frb/galaxies/extra_data.py @@ -1,7 +1,6 @@ """ Methods to load up additional data """ import importlib_resources -import os import pandas diff --git a/frb/galaxies/frbgalaxy.py b/frb/galaxies/frbgalaxy.py index b7c5ee9da..65e5e026d 100644 --- a/frb/galaxies/frbgalaxy.py +++ b/frb/galaxies/frbgalaxy.py @@ -5,7 +5,6 @@ import numpy as np import os import warnings -import glob import importlib_resources @@ -25,8 +24,6 @@ from scipy.integrate import simpson -from IPython import embed - class FRBGalaxy(object): """ Parent class for galaxies in FRB fields diff --git a/frb/galaxies/galfit.py b/frb/galaxies/galfit.py index b85d1b6cd..4eb10e8d9 100755 --- a/frb/galaxies/galfit.py +++ b/frb/galaxies/galfit.py @@ -13,7 +13,7 @@ """ import numpy as np -import sys, os, subprocess +import os import warnings from astropy.io import fits diff --git a/frb/galaxies/hosts.py b/frb/galaxies/hosts.py index edb3f8dd1..421bc7ad9 100644 --- a/frb/galaxies/hosts.py +++ b/frb/galaxies/hosts.py @@ -2,9 +2,6 @@ Warning: Might get chopped up into pieces sommeday """ import numpy as np -import pdb - -import os import pandas from astropy import units diff --git a/frb/galaxies/mag_dm.py b/frb/galaxies/mag_dm.py index 62fa37f77..948c93d4e 100644 --- a/frb/galaxies/mag_dm.py +++ b/frb/galaxies/mag_dm.py @@ -5,19 +5,14 @@ #import healpy as hp -from cycler import cycler - from matplotlib import pyplot as plt import matplotlib.gridspec as gridspec from astropy.coordinates import Distance -from linetools.scripts.utils import coord_arg_to_coord -from frb.frb import FRB, build_table_of_frbs, list_of_frbs from frb.figures import utils as frb_fig_u from frb.galaxies import utils as frb_gal_u -from IPython import embed def r_vs_dm_figure(z_min, z_max, z, PzDM, outfile='fig_r_vs_z.png', diff --git a/frb/galaxies/nebular.py b/frb/galaxies/nebular.py index 8c0b16849..d6a09ea27 100644 --- a/frb/galaxies/nebular.py +++ b/frb/galaxies/nebular.py @@ -11,7 +11,6 @@ import dust_extinction -from IPython import embed try: from linetools.lists import linelist diff --git a/frb/galaxies/offsets.py b/frb/galaxies/offsets.py index f0c5ac44c..c24be9256 100644 --- a/frb/galaxies/offsets.py +++ b/frb/galaxies/offsets.py @@ -7,7 +7,6 @@ from astropy import units from astropy.coordinates import SkyCoord -from IPython import embed def angular_offset(frb, galaxy, nsigma=5., nsamp=2000, gal_sig=None): diff --git a/frb/galaxies/photom.py b/frb/galaxies/photom.py index e353e62e4..5c59f42d8 100644 --- a/frb/galaxies/photom.py +++ b/frb/galaxies/photom.py @@ -9,13 +9,12 @@ from IPython import embed -from astropy.io import fits -from astropy.table import Table, hstack, vstack, join +from astropy.table import Table, hstack, vstack from astropy.coordinates import SkyCoord from astropy.coordinates import match_coordinates_sky from astropy import units from astropy.wcs import utils as wcs_utils -from astropy.nddata import Cutout2D + from astropy.wcs import WCS from astropy import stats diff --git a/frb/galaxies/utils.py b/frb/galaxies/utils.py index 3af6099a8..d4175f4cb 100644 --- a/frb/galaxies/utils.py +++ b/frb/galaxies/utils.py @@ -2,12 +2,10 @@ import os import glob -from IPython import embed - import importlib_resources import numpy as np from scipy.interpolate import interp1d -import warnings + import pandas @@ -19,7 +17,6 @@ flg_specdb = True from astropy.coordinates import SkyCoord -from astropy import units import pandas as pd diff --git a/frb/halos/models.py b/frb/halos/models.py index 72165c33b..e2621f8f0 100644 --- a/frb/halos/models.py +++ b/frb/halos/models.py @@ -18,8 +18,6 @@ from frb.defs import frb_cosmo as cosmo -from IPython import embed - # Speed up calculations m_p = constants.m_p.cgs.value # g diff --git a/frb/io.py b/frb/io.py index 20a3aba19..2dd3e1d13 100644 --- a/frb/io.py +++ b/frb/io.py @@ -3,9 +3,6 @@ import importlib_resources import gzip import json -import os - - def load_dla_fits(): dla_fit_file = str(importlib_resources.files('frb.data.IGM')/'dla_fits.json') diff --git a/frb/mw.py b/frb/mw.py index 9174cc8ba..58c5042a4 100644 --- a/frb/mw.py +++ b/frb/mw.py @@ -2,12 +2,8 @@ """ from __future__ import print_function, absolute_import, division, unicode_literals -import os import numpy as np -from astropy import units -import warnings - from frb.halos.models import ModifiedNFW from ne2001 import density diff --git a/frb/scripts/image.py b/frb/scripts/image.py index 6e189c8c6..132f76440 100644 --- a/frb/scripts/image.py +++ b/frb/scripts/image.py @@ -4,7 +4,6 @@ """ from __future__ import (print_function, absolute_import, division, unicode_literals) -from IPython import embed def parser(options=None): import argparse diff --git a/frb/scripts/iteration.py b/frb/scripts/iteration.py index 51cc5f2ea..cd01dce72 100644 --- a/frb/scripts/iteration.py +++ b/frb/scripts/iteration.py @@ -8,7 +8,6 @@ import pandas from scipy.optimize import minimize # to hold one of these parameters constant, just remove it from the arg set here -from zdm import cosmology as cos from scipy.stats import poisson # internal counter NCF=0 diff --git a/frb/scripts/pz_given_dm.py b/frb/scripts/pz_given_dm.py index 9c3352d34..b1df15af4 100644 --- a/frb/scripts/pz_given_dm.py +++ b/frb/scripts/pz_given_dm.py @@ -3,15 +3,6 @@ # It should be possible to remove all the matplotlib calls from this # but in the current implementation it is not removed. import argparse -import imp -import numpy as np -import os - -from zdm import iteration as it -from zdm import io -from zdm.craco import loading - -from IPython import embed def main(pargs): diff --git a/frb/scripts/pzdm_mag.py b/frb/scripts/pzdm_mag.py index 384e7d384..758981abe 100644 --- a/frb/scripts/pzdm_mag.py +++ b/frb/scripts/pzdm_mag.py @@ -4,8 +4,6 @@ as well as the limiting magnitude for the host galaxy Defaults to using a perfect telescope model for the DM-z grid """ -from IPython import embed - def parser(options=None): import argparse diff --git a/frb/scripts/pzdm_mag_crossmatch.py b/frb/scripts/pzdm_mag_crossmatch.py index dfa7aa77d..08ac44fa8 100644 --- a/frb/scripts/pzdm_mag_crossmatch.py +++ b/frb/scripts/pzdm_mag_crossmatch.py @@ -4,8 +4,6 @@ as well as the limiting magnitude for the host galaxy Defaults to using a perfect telescope model for the DM-z grid """ -from IPython import embed - def parser(options=None): import argparse diff --git a/frb/scripts/r_vs_dm.py b/frb/scripts/r_vs_dm.py index 0f97e1e6d..1f1733ec6 100644 --- a/frb/scripts/r_vs_dm.py +++ b/frb/scripts/r_vs_dm.py @@ -1,37 +1,18 @@ """ Estimate magnitude range for a host FRB given DM """ import numpy as np -import glob, os, sys, json -import pdb - -from scipy.interpolate import interp1d #import healpy as hp -from cycler import cycler -import matplotlib as mpl -import seaborn as sns - -import pandas - from matplotlib import pyplot as plt import matplotlib.gridspec as gridspec from astropy.coordinates import Distance -from astropy import visualization as vis from astropy.coordinates import SkyCoord -from linetools import utils as ltu -from linetools.scripts.utils import coord_arg_to_coord - -from frb.frb import FRB, build_table_of_frbs, list_of_frbs from frb.figures import utils as frb_fig_u -from frb.figures import dm as frb_fig_dm from frb.galaxies import utils as frb_gal_u from frb import mw -from frb.dm import prob_dmz, igm - -from IPython import embed # user parameters FRB = 'FRB20240304' diff --git a/frb/scripts/random_assoc.py b/frb/scripts/random_assoc.py index 645f5401c..85c5f4ebb 100755 --- a/frb/scripts/random_assoc.py +++ b/frb/scripts/random_assoc.py @@ -3,9 +3,9 @@ from astropy import units as u from astropy.table import Table from matplotlib import pyplot as plt -import pdb + from frb.surveys import des -import sys,os + import progressbar as pb #pip install progressbar2 from matplotlib import pyplot as plt import seaborn as sns diff --git a/frb/scripts/sightline.py b/frb/scripts/sightline.py index f8539a4ed..fd3ad2245 100644 --- a/frb/scripts/sightline.py +++ b/frb/scripts/sightline.py @@ -2,7 +2,6 @@ """ Script to print a summary of a given FRB to the terminal """ -from IPython import embed def parser(options=None): import argparse @@ -22,7 +21,6 @@ def parser(options=None): def main(pargs): """ Run """ - import json from linetools import utils as ltu from linetools.scripts.utils import coord_arg_to_coord diff --git a/frb/scripts/tns.py b/frb/scripts/tns.py index c682e1aa7..067197f8f 100644 --- a/frb/scripts/tns.py +++ b/frb/scripts/tns.py @@ -2,24 +2,18 @@ @author: Yuxin Dong last edited: March 3, 2025 """ import numpy as np -import pandas as pd import json import time import requests import os -import sys from collections import OrderedDict from astropy.coordinates import SkyCoord import ligo.skymap.plot # KEEP: needed for projections in matplotlib -from astropy import units as u -from scipy.stats import chi2 from astropy.io import ascii -from matplotlib.patches import Ellipse import matplotlib.pyplot as plt -import matplotlib from frb.surveys import utils_crossmatching as utils import argparse diff --git a/frb/surveys/catalog_utils.py b/frb/surveys/catalog_utils.py index 9d993a046..45adf81e4 100644 --- a/frb/surveys/catalog_utils.py +++ b/frb/surveys/catalog_utils.py @@ -3,7 +3,7 @@ import numpy as np from astropy.coordinates import SkyCoord -from astropy.table import Table, hstack, vstack, setdiff, join +from astropy.table import Table, hstack, vstack, join from astropy import units from frb.galaxies.defs import valid_filters diff --git a/frb/surveys/decals.py b/frb/surveys/decals.py index 17039e2d5..d7c162061 100644 --- a/frb/surveys/decals.py +++ b/frb/surveys/decals.py @@ -1,7 +1,6 @@ """DECaLS""" import numpy as np -from astropy import units, io, utils from astropy.table import Table from frb.surveys import dlsurvey diff --git a/frb/surveys/delve.py b/frb/surveys/delve.py index 335ed90d3..eb1a953c2 100644 --- a/frb/surveys/delve.py +++ b/frb/surveys/delve.py @@ -1,7 +1,6 @@ """DELVE survey""" import numpy as np -from astropy import units, io, utils from frb.surveys import dlsurvey, defs from frb.surveys import catalog_utils diff --git a/frb/surveys/galex.py b/frb/surveys/galex.py index a2503257e..72e262a2c 100644 --- a/frb/surveys/galex.py +++ b/frb/surveys/galex.py @@ -3,16 +3,10 @@ """ -import numpy as np - -from astropy import units as u,utils as astroutils -from astropy.io import fits -from astropy.coordinates import SkyCoord, match_coordinates_sky -from astropy.table import Table, join from ..galaxies.defs import GALEX_bands from astroquery.mast import Catalogs -from frb.surveys import surveycoord,catalog_utils,images +from frb.surveys import surveycoord,catalog_utils import os diff --git a/frb/surveys/heasarc.py b/frb/surveys/heasarc.py index 6c4710c8a..3d3828b7e 100644 --- a/frb/surveys/heasarc.py +++ b/frb/surveys/heasarc.py @@ -1,7 +1,5 @@ """ Surveys to be accessed through the HEASARC interface (via astroquery""" -import pdb - from astropy.table import Table from astropy import units, wcs diff --git a/frb/surveys/hsc.py b/frb/surveys/hsc.py index 9ca2f5828..44e769a6f 100644 --- a/frb/surveys/hsc.py +++ b/frb/surveys/hsc.py @@ -1,15 +1,10 @@ #!/bin/env python3 import json -import argparse -import urllib.request, urllib.error, urllib.parse +import urllib.request, urllib.error import time import sys import csv -import getpass import os -import os.path -import re -import ssl from io import StringIO from . import surveycoord from . import catalog_utils diff --git a/frb/surveys/nedlvs.py b/frb/surveys/nedlvs.py index 78c1fa843..9fe83b2b3 100644 --- a/frb/surveys/nedlvs.py +++ b/frb/surveys/nedlvs.py @@ -1,6 +1,5 @@ #!/bin/env python3 import os -import os.path from . import surveycoord from astropy.table import Table from frb.defs import frb_cosmo diff --git a/frb/surveys/nsc.py b/frb/surveys/nsc.py index 41976063e..098ec559a 100644 --- a/frb/surveys/nsc.py +++ b/frb/surveys/nsc.py @@ -1,7 +1,6 @@ """NOIRLab source catalog""" import numpy as np -from astropy import units, io, utils from frb.surveys import dlsurvey, defs from frb.surveys import catalog_utils diff --git a/frb/surveys/psrcat.py b/frb/surveys/psrcat.py index 030413b07..1d23f5a27 100644 --- a/frb/surveys/psrcat.py +++ b/frb/surveys/psrcat.py @@ -1,7 +1,5 @@ """ PSRCat survey """ -import pdb - import numpy as np from astropy.table import Table diff --git a/frb/surveys/tns_util.py b/frb/surveys/tns_util.py index ef85f689a..3d561b0bf 100644 --- a/frb/surveys/tns_util.py +++ b/frb/surveys/tns_util.py @@ -1,16 +1,9 @@ """ Created by Yuxin Dong """ - -import numpy as np -import matplotlib.pyplot as plt -import math -import pandas as pd from astropy import units as u from astropy.coordinates import SkyCoord -import os import requests import json from collections import OrderedDict -from astropy.coordinates import Angle # For searches diff --git a/frb/surveys/vista.py b/frb/surveys/vista.py index 32a23d647..a174cb04d 100644 --- a/frb/surveys/vista.py +++ b/frb/surveys/vista.py @@ -1,7 +1,7 @@ """VISTA catalog""" import numpy as np -from astropy import units, io, utils +from astropy import io, utils from frb.surveys import dlsurvey from frb.surveys import catalog_utils diff --git a/frb/tests/test_build.py b/frb/tests/test_build.py index 52719e9e8..f673ecee4 100644 --- a/frb/tests/test_build.py +++ b/frb/tests/test_build.py @@ -2,7 +2,6 @@ # TEST_UNICODE_LITERALS -import numpy as np import os import pytest diff --git a/frb/tests/test_dmism.py b/frb/tests/test_dmism.py index 67a3a14c0..20286a15f 100644 --- a/frb/tests/test_dmism.py +++ b/frb/tests/test_dmism.py @@ -3,13 +3,8 @@ # TEST_UNICODE_LITERALS import numpy as np -import pytest - -from astropy import units as u -from astropy.coordinates import SkyCoord from frb.dm import dm_ism_healpix_map -from frb import mw def test_dm_ism_from_healpix(): diff --git a/frb/tests/test_experiment.py b/frb/tests/test_experiment.py index 97bcdf5a1..bb296fdbe 100644 --- a/frb/tests/test_experiment.py +++ b/frb/tests/test_experiment.py @@ -3,9 +3,6 @@ # TEST_UNICODE_LITERALS -import pytest -import os - from frb.experiment import Experiment #def data_path(filename): diff --git a/frb/tests/test_finder.py b/frb/tests/test_finder.py index 23efdb274..47e14545d 100644 --- a/frb/tests/test_finder.py +++ b/frb/tests/test_finder.py @@ -1,7 +1,6 @@ # TESTS FOR FINDER CHARTS import pytest -import numpy as np import os import matplotlib diff --git a/frb/tests/test_frb.py b/frb/tests/test_frb.py index f329e5e92..7fed82af7 100644 --- a/frb/tests/test_frb.py +++ b/frb/tests/test_frb.py @@ -3,7 +3,6 @@ # TEST_UNICODE_LITERALS -import pytest import numpy as np from astropy import units diff --git a/frb/tests/test_frbdlas.py b/frb/tests/test_frbdlas.py index f2678834c..c51124b95 100644 --- a/frb/tests/test_frbdlas.py +++ b/frb/tests/test_frbdlas.py @@ -5,7 +5,6 @@ import numpy as np import pytest -import os from astropy.units import Quantity from astropy import units as u diff --git a/frb/tests/test_frbem.py b/frb/tests/test_frbem.py index 573a58b58..9eb497ae9 100644 --- a/frb/tests/test_frbem.py +++ b/frb/tests/test_frbem.py @@ -4,7 +4,6 @@ # TEST_UNICODE_LITERALS -import pytest import numpy as np from astropy import units diff --git a/frb/tests/test_frbhalos.py b/frb/tests/test_frbhalos.py index 62e9e7e67..c8d69e0bb 100644 --- a/frb/tests/test_frbhalos.py +++ b/frb/tests/test_frbhalos.py @@ -4,7 +4,6 @@ # TEST_UNICODE_LITERALS import numpy as np -import pytest from numpy.random import rand try: diff --git a/frb/tests/test_frbhosts.py b/frb/tests/test_frbhosts.py index f4021a0b8..0032aac84 100644 --- a/frb/tests/test_frbhosts.py +++ b/frb/tests/test_frbhosts.py @@ -18,7 +18,6 @@ from frb.frb import FRB from frb.galaxies import mag_dm -from frb.dm import prob_dmz def data_path(filename): data_dir = os.path.join(os.path.dirname(__file__), 'files') @@ -91,7 +90,7 @@ def test_luminosity(): outfile = data_path('test_frbhost.json') frb121102 = FRB.by_name('FRB20121102A') host121102 = frbgalaxy.FRBHost.from_json(frb121102, outfile) - Lum_Ha, Lum_Ha_err = host121102.calc_nebular_lum('Halpha') + Lum_Ha, _ = host121102.calc_nebular_lum('Halpha') # Test assert Lum_Ha.unit == units.erg/units.s assert np.isclose(Lum_Ha.value, 2.9447660789951146e+40) @@ -134,9 +133,9 @@ def test_get_spectra(): def test_table(): - frbs, hosts = utils.list_of_hosts() + _, _ = utils.list_of_hosts() - host_tbl, host_units = utils.build_table_of_hosts() + host_tbl, _ = utils.build_table_of_hosts() # Tests assert len(host_tbl) > 15 diff --git a/frb/tests/test_frbigm.py b/frb/tests/test_frbigm.py index 5e2d09dcb..667be78ff 100644 --- a/frb/tests/test_frbigm.py +++ b/frb/tests/test_frbigm.py @@ -4,7 +4,6 @@ # TEST_UNICODE_LITERALS import numpy as np -import pytest from astropy import units as u from astropy.cosmology import Planck15, FlatLambdaCDM diff --git a/frb/tests/test_frbio.py b/frb/tests/test_frbio.py index 85014c69a..e41d0970d 100644 --- a/frb/tests/test_frbio.py +++ b/frb/tests/test_frbio.py @@ -3,11 +3,6 @@ # TEST_UNICODE_LITERALS -import pytest -import os - -from astropy.table import Table - from frb.io import load_dla_fits #def data_path(filename): diff --git a/frb/tests/test_frbobs.py b/frb/tests/test_frbobs.py index 69921d240..c22e9eead 100644 --- a/frb/tests/test_frbobs.py +++ b/frb/tests/test_frbobs.py @@ -3,9 +3,6 @@ # TEST_UNICODE_LITERALS -import pytest -import os - from astropy.table import Table from frb.frbcat import FRBCat diff --git a/frb/tests/test_frbrm.py b/frb/tests/test_frbrm.py index 666997894..3ec49a3be 100644 --- a/frb/tests/test_frbrm.py +++ b/frb/tests/test_frbrm.py @@ -4,8 +4,6 @@ # TEST_UNICODE_LITERALS -import pytest -import os import numpy as np from astropy.coordinates import SkyCoord diff --git a/frb/tests/test_frbtscatt.py b/frb/tests/test_frbtscatt.py index fd66111ee..8bdaa30c3 100644 --- a/frb/tests/test_frbtscatt.py +++ b/frb/tests/test_frbtscatt.py @@ -4,7 +4,6 @@ # TEST_UNICODE_LITERALS import numpy as np -import pytest from astropy import units as u from astropy import constants as const diff --git a/frb/tests/test_galaxies.py b/frb/tests/test_galaxies.py index 0fa82d906..b045f12f9 100644 --- a/frb/tests/test_galaxies.py +++ b/frb/tests/test_galaxies.py @@ -1,10 +1,7 @@ # TEST_UNICODE_LITERALS -import pytest -import os import numpy as np -from astropy.table import Table from astropy import units from astropy.coordinates import SkyCoord diff --git a/frb/tests/test_photom.py b/frb/tests/test_photom.py index 00b715d82..27b72c7d4 100644 --- a/frb/tests/test_photom.py +++ b/frb/tests/test_photom.py @@ -3,15 +3,12 @@ # TEST_UNICODE_LITERALS -import pytest -import os import numpy as np import importlib_resources from astropy.table import Table from astropy import units from astropy.io import fits -from astropy.coordinates import SkyCoord from astropy.nddata import Cutout2D from astropy.wcs import WCS diff --git a/frb/tests/test_pzdm.py b/frb/tests/test_pzdm.py index 1b83a2db4..713e78cf4 100644 --- a/frb/tests/test_pzdm.py +++ b/frb/tests/test_pzdm.py @@ -4,20 +4,8 @@ # TEST_UNICODE_LITERALS -#import pytest -import os import numpy as np -from astropy.coordinates import SkyCoord -from astropy import units -from astropy.table import Table - -from linetools.spectra import xspectrum1d - -from frb.galaxies import frbgalaxy, defs, utils -from frb.frb import FRB - -from frb.galaxies import mag_dm from frb.dm import prob_dmz diff --git a/frb/tests/test_tnsscripts.py b/frb/tests/test_tnsscripts.py index ed26fcdc3..7588896d7 100644 --- a/frb/tests/test_tnsscripts.py +++ b/frb/tests/test_tnsscripts.py @@ -26,9 +26,9 @@ def test_tns(): theta = 0.0 dec = 54.3116510708 ra = 210.910674637 - skip = None + # skip = None single_obj = True - outfile = 'outfile.txt' + # outfile = 'outfile.txt' match = tns.main(filename=None, name=None, diff --git a/frb/utils.py b/frb/utils.py index 7e777a8d0..3757046e3 100644 --- a/frb/utils.py +++ b/frb/utils.py @@ -8,8 +8,6 @@ import json, gzip -from IPython import embed - # Simple method to help with value/units in def assign_value(tfrb, key, ilist, tbl_units): """ From 911d843045c2e646ac88e9d78129fbc8e707dd7d Mon Sep 17 00:00:00 2001 From: "sunil.simha95@gmail.com" Date: Thu, 19 Feb 2026 15:07:03 -0600 Subject: [PATCH 4/7] replace type with datatype --- frb/surveys/panstarrs.py | 8 ++++---- frb/tests/test_frbsurveys.py | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/frb/surveys/panstarrs.py b/frb/surveys/panstarrs.py index bee8e473e..41f5cd35b 100644 --- a/frb/surveys/panstarrs.py +++ b/frb/surveys/panstarrs.py @@ -301,7 +301,7 @@ def _check_legal(table,release): raise ValueError("Bad value for table (for {} must be one of {})".format(release, ", ".join(tablelist))) def _ps1metadata(table="stack",release="dr2", - baseurl="https://catalogs.mast.stsci.edu/api/v0.1/panstarrs"): + baseurl="https://catalogs.mast.stsci.edu/api/v0.1/panstarrs"): """Return metadata for the specified catalog and table Args: @@ -313,15 +313,15 @@ def _ps1metadata(table="stack",release="dr2", """ _check_legal(table,release) - url = "{baseurl}/{release}/{table}/metadata".format(**locals()) + url = f"{baseurl}/{release}/{table}/metadata" r = requests.get(url) r.raise_for_status() v = r.json() # convert to astropy table local_metadata_path = importlib_resources.files('frb').joinpath('data','Public', 'Pan-STARRS','ps1_{}_{}_metadata.csv'.format(release,table)) try: - tab = Table(rows=[(x['name'],x['type'],x['description']) for x in v], - names=('name','type','description')) + tab = Table(rows=[(x['name'],x['datatype'],x['description']) for x in v], + names=('name','datatype','description')) # Cache locally # Create directory if it doesn't exist if not os.path.isfile(local_metadata_path): diff --git a/frb/tests/test_frbsurveys.py b/frb/tests/test_frbsurveys.py index c592c6732..14cb4499e 100644 --- a/frb/tests/test_frbsurveys.py +++ b/frb/tests/test_frbsurveys.py @@ -2,7 +2,6 @@ # Most of these are *not* done with Travis yet # TEST_UNICODE_LITERALS -from calendar import c import numpy as np import astropy import pytest @@ -207,7 +206,7 @@ def test_panstarrs(): metadata = _ps1metadata() assert isinstance(metadata,Table) assert len(metadata) > 0 - assert np.all(np.isin(metadata.colnames, ['name', 'type', 'description'])) + assert np.all(np.isin(metadata.colnames, ['name', 'datatype', 'description'])) @nedlvs def test_nedlvs(): From 59f2bba96a0465de0a34d2ae8e83cbc2fd1b1d54 Mon Sep 17 00:00:00 2001 From: "sunil.simha95@gmail.com" Date: Thu, 19 Feb 2026 17:10:24 -0600 Subject: [PATCH 5/7] appease CI gods --- frb/dm_kde/sort_transient_data.py | 2 +- setup.cfg | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/frb/dm_kde/sort_transient_data.py b/frb/dm_kde/sort_transient_data.py index e869fd01b..4623d09ac 100644 --- a/frb/dm_kde/sort_transient_data.py +++ b/frb/dm_kde/sort_transient_data.py @@ -1,6 +1,6 @@ """ Module to correct pulsar and FRB DMs for the MW ISM """ -from ne2001 import ne_io, density #ne2001 ism model +from ne2001 import density #ne2001 ism model import pygedm #ymw ism model import numpy as np import pandas as pd diff --git a/setup.cfg b/setup.cfg index b7e478982..7dce066cd 100755 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,13 @@ [aliases] test=pytest + +[options.extras_require] +test = + pytest>=6.0 + pytest-cov +alldeps = + ne2001 + astropath + linetools + eazy-py + cigale \ No newline at end of file From 42fc8150fa84d25ebb46f64942828ab25609170f Mon Sep 17 00:00:00 2001 From: "sunil.simha95@gmail.com" Date: Thu, 19 Feb 2026 17:14:46 -0600 Subject: [PATCH 6/7] take 2 at appeasing CI gods --- setup.cfg | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 7dce066cd..312277a7f 100755 --- a/setup.cfg +++ b/setup.cfg @@ -9,5 +9,4 @@ alldeps = ne2001 astropath linetools - eazy-py - cigale \ No newline at end of file + pcigale \ No newline at end of file From 17bc3adc94862281f58cc5450d408ea20740973e Mon Sep 17 00:00:00 2001 From: "sunil.simha95@gmail.com" Date: Thu, 19 Feb 2026 17:17:37 -0600 Subject: [PATCH 7/7] take 3 --- setup.cfg | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 312277a7f..6766ade11 100755 --- a/setup.cfg +++ b/setup.cfg @@ -8,5 +8,4 @@ test = alldeps = ne2001 astropath - linetools - pcigale \ No newline at end of file + linetools \ No newline at end of file