Loading .pre-commit-config.yaml +1 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ repos: "-D", # Flag to override settings in conf.py #"exclude_patterns=notebooks/*,_build", # Exclude notebooks and build dir from pre-commit "exclude_patterns=_build", # Exclude notebooks and build dir from pre-commit "-j 4", # Use multiple threads ] # Run unit tests, verify that they pass. Note that coverage is run against # the ./src directory here because that is what will be committed. In the Loading src/lsst_inaf_agile/catalog_agn.py +2 −2 Original line number Diff line number Diff line Loading @@ -191,7 +191,7 @@ class CatalogAGN: filename = f"{self.dirname}/agn.fits" if os.path.exists(filename) and not overwrite: logger.info(f"Returning an existing AGN catalog {filename}") return fitsio.read(filename) return util.read_fits(filename) logger.info(f"Creating the AGN catalog {filename}") self.catalog = np.empty_like(self.catalog_galaxy["ID"], dtype=self.get_dtype()) Loading Loading @@ -446,7 +446,7 @@ class CatalogAGN: if not os.path.exists(filename): return None fits = fitsio.read(filename) fits = util.read_fits(filename) return fits["LAMBDA"][0], fits["FLUX"][0] def _get_sed(self, i, ratio_max: float = 0.90, dlog_wav: float = 7.65e-4): Loading src/lsst_inaf_agile/catalog_galaxy.py +3 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,9 @@ class CatalogGalaxy: util.create_directory(filename) fitsio.write(filename, self.catalog, clobber=True) self.catalog = fitsio.read(filename) from lsst_inaf_agile.util import read_fits self.catalog = read_fits(filename) return self.catalog @staticmethod Loading src/lsst_inaf_agile/catalog_star.py +12 −4 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ import logging import os import fitsio import numpy as np import pyvo as vo from astropy import constants Loading Loading @@ -92,8 +91,7 @@ class CatalogStar: def get_stars(self, selection="rmag", maglim=28, fbin=1.0): """Query NOIRlab to retrieve the stellar catalogs from LSST-SIM.""" if os.path.exists(self.filename): logger.info(f"Reading {self.filename}") return fitsio.read(self.filename) return util.read_fits(self.filename) table = "lsst_sim.simdr2" if self.is_binary: Loading @@ -118,7 +116,15 @@ class CatalogStar: tap_service = vo.dal.TAPService("https://datalab.noirlab.edu/tap") tap_results = tap_service.search(query) table = tap_results.to_table() import warnings from astropy.units import UnitsWarning with warnings.catch_warnings(): warnings.simplefilter("ignore", UnitsWarning) table.write(self.filename) return table def is_cepheid(self, i): Loading Loading @@ -155,9 +161,11 @@ class CatalogStar: lc = self.get_lightcurve_mjd_binary(*args) return self.catalog[f"{band}_point"][i] if lc is None else lc # Handle cepheids if self.is_cepheid(i): return self.get_lightcurve_mjd_cepheid(*args) # Handle LPVs if self.is_lpv(i): return self.get_lightcurve_mjd_lpv(*args, self.is_c_rich(i)) Loading src/lsst_inaf_agile/egg.py +2 −5 Original line number Diff line number Diff line Loading @@ -82,14 +82,12 @@ class Egg: def get_sed(self, i): """Return an EGG SED.""" import fitsio dirname = os.path.dirname(self.egg_kwargs["save_sed"]) fname = f"{dirname}/egg-seds-{i}.fits" try: if not os.path.exists(fname): os.system(f"egg-getsed seds={dirname}/egg-seds.dat id={i}") return fitsio.read(fname) return util.read_fits(fname) except FileNotFoundError: logger.warning("Could not find galaxy sed") return None Loading Loading @@ -176,10 +174,9 @@ class Egg: @staticmethod def get_smf(z, key, filename): """Read an EGG-like stellar mass function from a file.""" import fitsio import numpy as np smf = fitsio.read(filename) smf = util.read_fits(filename) i = None for _i, (zlo, zhi) in enumerate(smf["ZB"][0].T): if zlo <= z < zhi: Loading Loading
.pre-commit-config.yaml +1 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ repos: "-D", # Flag to override settings in conf.py #"exclude_patterns=notebooks/*,_build", # Exclude notebooks and build dir from pre-commit "exclude_patterns=_build", # Exclude notebooks and build dir from pre-commit "-j 4", # Use multiple threads ] # Run unit tests, verify that they pass. Note that coverage is run against # the ./src directory here because that is what will be committed. In the Loading
src/lsst_inaf_agile/catalog_agn.py +2 −2 Original line number Diff line number Diff line Loading @@ -191,7 +191,7 @@ class CatalogAGN: filename = f"{self.dirname}/agn.fits" if os.path.exists(filename) and not overwrite: logger.info(f"Returning an existing AGN catalog {filename}") return fitsio.read(filename) return util.read_fits(filename) logger.info(f"Creating the AGN catalog {filename}") self.catalog = np.empty_like(self.catalog_galaxy["ID"], dtype=self.get_dtype()) Loading Loading @@ -446,7 +446,7 @@ class CatalogAGN: if not os.path.exists(filename): return None fits = fitsio.read(filename) fits = util.read_fits(filename) return fits["LAMBDA"][0], fits["FLUX"][0] def _get_sed(self, i, ratio_max: float = 0.90, dlog_wav: float = 7.65e-4): Loading
src/lsst_inaf_agile/catalog_galaxy.py +3 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,9 @@ class CatalogGalaxy: util.create_directory(filename) fitsio.write(filename, self.catalog, clobber=True) self.catalog = fitsio.read(filename) from lsst_inaf_agile.util import read_fits self.catalog = read_fits(filename) return self.catalog @staticmethod Loading
src/lsst_inaf_agile/catalog_star.py +12 −4 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ import logging import os import fitsio import numpy as np import pyvo as vo from astropy import constants Loading Loading @@ -92,8 +91,7 @@ class CatalogStar: def get_stars(self, selection="rmag", maglim=28, fbin=1.0): """Query NOIRlab to retrieve the stellar catalogs from LSST-SIM.""" if os.path.exists(self.filename): logger.info(f"Reading {self.filename}") return fitsio.read(self.filename) return util.read_fits(self.filename) table = "lsst_sim.simdr2" if self.is_binary: Loading @@ -118,7 +116,15 @@ class CatalogStar: tap_service = vo.dal.TAPService("https://datalab.noirlab.edu/tap") tap_results = tap_service.search(query) table = tap_results.to_table() import warnings from astropy.units import UnitsWarning with warnings.catch_warnings(): warnings.simplefilter("ignore", UnitsWarning) table.write(self.filename) return table def is_cepheid(self, i): Loading Loading @@ -155,9 +161,11 @@ class CatalogStar: lc = self.get_lightcurve_mjd_binary(*args) return self.catalog[f"{band}_point"][i] if lc is None else lc # Handle cepheids if self.is_cepheid(i): return self.get_lightcurve_mjd_cepheid(*args) # Handle LPVs if self.is_lpv(i): return self.get_lightcurve_mjd_lpv(*args, self.is_c_rich(i)) Loading
src/lsst_inaf_agile/egg.py +2 −5 Original line number Diff line number Diff line Loading @@ -82,14 +82,12 @@ class Egg: def get_sed(self, i): """Return an EGG SED.""" import fitsio dirname = os.path.dirname(self.egg_kwargs["save_sed"]) fname = f"{dirname}/egg-seds-{i}.fits" try: if not os.path.exists(fname): os.system(f"egg-getsed seds={dirname}/egg-seds.dat id={i}") return fitsio.read(fname) return util.read_fits(fname) except FileNotFoundError: logger.warning("Could not find galaxy sed") return None Loading Loading @@ -176,10 +174,9 @@ class Egg: @staticmethod def get_smf(z, key, filename): """Read an EGG-like stellar mass function from a file.""" import fitsio import numpy as np smf = fitsio.read(filename) smf = util.read_fits(filename) i = None for _i, (zlo, zhi) in enumerate(smf["ZB"][0].T): if zlo <= z < zhi: Loading