Commit 5a5a18f3 authored by Akke Viitanen's avatar Akke Viitanen
Browse files

Fix remaining logger entries

parent 3ee337b0
Loading
Loading
Loading
Loading
+16 −16
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ try:
    POSTERIOR_DISTRIBUTION = pd.read_csv(f"{ROOT}/data/posteriors/posterior_frozen.dat", sep=' ')
    PARAMETER_NAMES = POSTERIOR_DISTRIBUTION.columns
except:
    logger.warning("Warning, posterior distribution not found")
    logger.warning("Posterior distribution not found")


# Dictionary for pre-loaded observations
@@ -194,7 +194,7 @@ class CatalogGalaxyAGN:
            logger.info(f"-- Nstar        {len(self.star)}")
            logger.info(f"-- Nbinary      {len(self.star_binary)}")
        else:
            logger.info("Creating", self.filename_catalog)
            logger.info(f"Creating {self.filename_catalog}")
            self.star = None
            self.star_binary = None

@@ -834,7 +834,7 @@ class CatalogGalaxyAGN:
                for z in np.arange(np.floor(self.catalog["Z"].min()), np.ceil(self.catalog["Z"].max()), self.dz):
                    for m in np.arange(np.floor(self.catalog["M"].min()), np.ceil(self.catalog["M"].max()), self.dm):

                        logger.info(t, z, m)
                        logger.info(f"{t} {z} {m}")
                        select = self._get_select(z=z, m=m, t=t)
                        if select.sum() == 0:
                            continue
@@ -850,7 +850,7 @@ class CatalogGalaxyAGN:
                                np.save(filename, func(10 ** (m + self.dm / 2), z + self.dz / 2, type=t))
                            ret += [np.load(filename)]
                        duty_cycle[select] = ret[1] / ret[0]
                        logger.info(f"Duty cycle t={t} z={z:6.2f}, m={m:6.2f} N={select.sum()} f={ret[1]/ret[0]}")
                        logger.info(f"Duty cycle t={t} z={z:6.2f} m={m:6.2f} N={select.sum()} f={ret[1]/ret[0]}")

        elif self.type_plambda == "zou+2024":
            duty_cycle = self.catalog["log_lambda_SAR"] >= 32.0
@@ -947,7 +947,7 @@ class CatalogGalaxyAGN:
                    #   N_CTK = X * N_CTN / (1 - X)

                    select = self._get_select(z=z, l=l)
                    logger.info(z, l)
                    logger.info(f"{z} {l}")
                    if select.sum() == 0:
                        continue

@@ -979,7 +979,7 @@ class CatalogGalaxyAGN:

            for i in range(self.catalog.size):

                logger.info(i, self.catalog.size, "%.2f" % (100 * i / self.catalog.size))
                logger.info(f"{i}  {self.catalog.size}  {100 * i / self.catalog.size}")

                if self.catalog["log_lambda_SAR"][i] >= 32.0:
                    continue
@@ -1134,7 +1134,7 @@ class CatalogGalaxyAGN:
            filename = f"{dirname}/seds/egg-seds-{component}-{i}.fits"
            if not os.path.exists(filename):
                cmd = f"egg-getsed seds={dirname}/egg-seds.dat id={i} component={component} out={filename}"
                logger.info("Running", cmd)
                logger.info(f"Running {cmd}")
                os.system(cmd)

        else:
@@ -1380,7 +1380,7 @@ class CatalogGalaxyAGN:
            idxs = uid_agn
        idxs = np.atleast_1d(idxs)

        logger.info(f"Getting AGN lightcurves {band} {idxs}, {idxs.size}")
        logger.info(f"Getting AGN lightcurves {band} {idxs} {idxs.size}")

        for ndone, i in enumerate(idxs):

@@ -1447,7 +1447,7 @@ class CatalogGalaxyAGN:
        radius1 = self._get_radius_star(s[f"c{i1}_mass"], s[f"c{i1}_logg"])
        radius2 = self._get_radius_star(s[f"c{i2}_mass"], s[f"c{i2}_logg"])
        if not np.isfinite(radius1 + radius2):
            logger.warning(f"Non-finite radius encounterd for binary star {i} in {band}, returning None")
            logger.warning(f"Non-finite radius encounterd for binary star {i} in {band} returning None")
            return None

        if radius1 <= radius2:
@@ -1476,7 +1476,7 @@ class CatalogGalaxyAGN:
            return_full=True
        )
        if ret is None:
            logger.warning(f"No eclipse found for binary star {i} in {band}, returning None")
            logger.warning(f"No eclipse found for binary star {i} in {band} returning None")
        return ret

    def write_instance_catalog(
@@ -1492,7 +1492,7 @@ class CatalogGalaxyAGN:
    ):

        if os.path.exists(filename):
            logger.info("Instance catalog", filename, "exists. Will not overwrite")
            logger.info(f"Instance catalog {filename} exists. Will not overwrite")
            return

        t0 = time.time()
@@ -1505,12 +1505,12 @@ class CatalogGalaxyAGN:

        # Get the selection
        select = np.ones_like(self.catalog, dtype=bool)
        logger.info("Original number of sources", select.sum())
        logger.info(f"Original number of sources {select.sum()}")

        if (maglim is not None) and (selection_band is not None):
            logger.info(f"Selecting only sources with {selection_band} < {maglim}")
            select *= util.flux_to_mag(self.get_flux_total(selection_band)) < float(maglim)
        logger.info("Culled number of sources after magnitude cut", select.sum())
        logger.info(f"Culled number of sources after magnitude cut {select.sum()}")

        # 2024018 NOTE: ra, dec had not been copied over correctly. This caused
        # proper motion to be applied in a cumulative sense i.e. effectively
@@ -1541,7 +1541,7 @@ class CatalogGalaxyAGN:
        c = self.catalog[select]
        ra = ra[select]
        dec = dec[select]
        logger.info("culled number of sources after (maglim, ra, dec) cut", select.sum())
        logger.info(f"Culled number of sources after (maglim ra dec) cut {select.sum()}")

        #####################
        # Estimate the fluxes
@@ -1636,7 +1636,7 @@ class CatalogGalaxyAGN:
                uid = c["ID"][i]
                idx = c["ID"][i] - (self.catalog.size - self.star_binary.size)
                s = self.star_binary[idx]
                logger.info(uid, idx, i, my_i, select_binary.sum(), "%.2f%%" % (my_i / select_binary.sum() * 100),)
                logger.info(f"{uid} {idx} {i} {my_i} {select_binary.sum()} {100 * my_i / select_binary.sum()}")

                # NOTE: find out which one is the "primary" based on the radius
                i1, i2 = 1, 2
@@ -2365,7 +2365,7 @@ eval_variables.sband: '{filter_name}'"""

        zvec = z[np.isfinite(z)]
        if zmin < zvec.min() or zmax > zvec.max():
            logger.warning(f"Clipping {zmin}, {zmax} to catalog range...")
            logger.warning(f"Clipping {zmin} {zmax} to catalog range...")
            zmin, zmax = np.clip([zmin, zmax], zvec.min(), zvec.max())

        return util.get_key_function(