示例#1
0
def load_injections(config=None, logger=None):
    """
    """
    if config is None:
        config = get_config()
    if logger is None:
        logger = get_logger()
    path = os.path.join(config['directories']['data'], 'input', 'injections')
    filename = os.path.join(path, config['injections']['catalogue_filename'])
    df = pd.read_csv(filename)
    logger.debug(f"Loaded {df.shape[0]} injections from file.")
    return df
示例#2
0
def load_gama_specobj(config=None, logger=None):
    """
    """
    if config is None:
        config = get_config()
    if logger is None:
        logger = get_logger()
    filename = os.path.join(config['directories']['data'], 'input',
                            'gama_specobj.csv')
    df = pd.read_csv(filename)
    df["ra"] = df["RA"]
    df["dec"] = df["DEC"]
    logger.debug(f"Loaded {df.shape[0]} GAMA objects.")
    return df
示例#3
0
    def __init__(self,
                 config=None,
                 logger=None,
                 zmin=0.0001,
                 zmax=2,
                 z_samples=500):
        """
        """
        self.logger = get_logger() if logger is None else logger
        self.config = get_config() if config is None else config

        self._cosmo = self.config["cosmology"]

        self._zmin = zmin
        self._zmax = zmax
        zz = np.linspace(self._zmin, self._zmax, z_samples)
        self._cosmo_interps = self._make_cosmo_interps(zz)
示例#4
0
def load_recovery_efficiency(config=None, logger=None):
    """
    """
    if config is None:
        config = get_config()
    if logger is None:
        logger = get_logger()

    dirname = os.path.join(config["directories"]["data"], "input", "injections")
    filename = config["injections"]["receff_filename"]

    logger.debug(f"Loading interpolated recover efficiency: {filename}.")
    with open(os.path.join(dirname, filename), "rb") as f:
        interp = pickle.load(f)

    fn = partial(recovery_efficiency, interp=interp)

    return fn
示例#5
0
def load_sample(config=None, logger=None, select=True):
    """
    """
    if config is None:
        config = get_config()
    if logger is None:
        logger = get_logger()
    filename = os.path.join(config['directories']['data'], 'input',
                            'lsbgs_public.csv')
    df = pd.read_csv(filename)

    if select:
        cond = select_samples(uae=df['mueff_av'].values,
                              rec=df['rec_arcsec'].values)
        cond &= df["g_r"] < GR_MAX
        # cond &= df["is_red"].values == 0
        df = df[cond].reset_index(drop=True)

    logger.debug(f"Loaded {df.shape[0]} LSBGs from file.")
    return df
示例#6
0
import os

from udgsizes.core import get_config, get_logger
from udgsizes.obs.sample import load_sample, load_gama_specobj
from udgsizes.utils import xmatch

if __name__ == "__main__":

    logger = get_logger()
    radius = 3. / 3600

    df = load_sample(select=False)
    dfg = load_gama_specobj()

    dfm = xmatch.match_dataframe(df, dfg, radius=radius)
    logger.info(f"Matched {dfm.shape[0]} sources.")

    datadir = get_config()["directories"]["data"]
    dfm.to_csv(os.path.join(datadir, "input", "lsbgs_gama_xmatch.csv"))