Commit fc1be145 authored by Akke Viitanen's avatar Akke Viitanen
Browse files

Ruff autofix

parent 0c814ad8
Loading
Loading
Loading
Loading
+1 −17
Original line number Diff line number Diff line
@@ -9,24 +9,8 @@ Aird+2018 functions & data etc.
"""


import argparse
import glob
import math
import os
import random
import re
import subprocess
import sys
import time

import astropy as ap
import astropy.coordinates as c
import astropy.units as u
import fitsio
import matplotlib as mpl
import matplotlib.pyplot as plt

import numpy as np
import scipy as sp

from util import ROOT

+2 −17
Original line number Diff line number Diff line
@@ -9,24 +9,9 @@ Implements Ananna+2022
"""


import argparse
import glob
import math
import os
import random
import re
import subprocess
import sys
import time

import astropy as ap
import astropy.coordinates as c
import astropy.units as u
import fitsio
import matplotlib as mpl

import matplotlib.pyplot as plt
import numpy as np
import scipy as sp

labels = [
    r"Intrinsic ($\sigma=0.3$)",
@@ -188,7 +173,7 @@ if __name__ == "__main__":
                axes[1, j].set_xlabel(r"$\lambda{\rm Edd}$")
                axes[1, j].set_ylabel(r"$\Phi_{\lambda}$ [1/(Mpc3/h3)/dex")

            except IndexError as e:
            except IndexError:
                pass

    for ax in axes.flatten():
+2 −2
Original line number Diff line number Diff line
@@ -27,8 +27,8 @@ def get_airmass(baseline):


filenames = (
    f"data/baseline_v3.0_10yrs.fits",
    f"data/baseline_v4.0_10yrs.fits"
    "data/baseline_v3.0_10yrs.fits",
    "data/baseline_v4.0_10yrs.fits"
)
baselines = {}

+0 −1
Original line number Diff line number Diff line
import time

import matplotlib.pyplot as plt
import numpy as np
+5 −18
Original line number Diff line number Diff line
@@ -8,28 +8,21 @@
Create Galaxy+AGN mocks for the LSST Italian AGN in-kind contribution
"""

import argparse
from copy import deepcopy
from itertools import product
import glob
from multiprocessing import Pool, cpu_count
from multiprocessing import Pool
import os
import subprocess
import sys
import time
import re

from astropy import constants
from astropy.cosmology import FlatLambdaCDM
from astropy.time import Time
from astropy.wcs import WCS
from astropy.coordinates import SkyCoord
from scipy.stats import binned_statistic
import astropy.units as u
import fitsio
import matplotlib.pyplot as plt
import numpy as np
from scipy.interpolate import interp1d
import pandas as pd
import sqlite3

@@ -240,7 +233,7 @@ class CatalogGalaxyAGN:
        select = np.ones(self.catalog["Z"].size, dtype=bool)
        for key, a1, a2 in zip(keys, a1s, a2s):
            my_key = key, a1, a2
            if not my_key in self.SELECT:
            if my_key not in self.SELECT:
                if a2 is None:
                    self.SELECT[my_key] = self.catalog[key] == a1
                else:
@@ -699,7 +692,6 @@ class CatalogGalaxyAGN:
            print(f"Assigning log_lambda_SAR with {cpu_count=}...")
            with Pool(processes=cpu_count) as p:
                log_lambda_SAR = p.starmap(util.get_log_lambda_SAR, arguments)
            print(log_lambda_SAR)
            print("... done")

        return log_lambda_SAR
@@ -855,7 +847,6 @@ class CatalogGalaxyAGN:
                        print(f"Duty cycle t={t} z={z:6.2f}, m={m:6.2f} N={select.sum()} f={ret[1]/ret[0]}", end='\r', file=sys.stderr)

        elif self.type_plambda == "zou+2024":
            import zou2024
            duty_cycle = self.catalog["log_lambda_SAR"] >= 32.0
            #for t in ["star-forming", "quiescent"]:
            #    select = self._get_select(t=t)
@@ -1431,7 +1422,7 @@ class CatalogGalaxyAGN:
    def _get_lightcurve_star_binary(self, i, band="lsst-r", mjd0=0):

        # Check if the uid is a binary star
        if not i in self.catalog["ID"][self.get_is_star_binary()]:
        if i not in self.catalog["ID"][self.get_is_star_binary()]:
            return None

        # Return the lightcurve if it exists on the disk
@@ -1513,7 +1504,7 @@ class CatalogGalaxyAGN:
        if (maglim is not None) and (selection_band is not None):
            print(f"NOTE: Selecting only sources with {selection_band} < {maglim}", file=sys.stderr)
            select *= util.flux_to_mag(self.get_flux_total(selection_band)) < float(maglim)
        print(f"NOTE: culled number of sources after magnitude cut", select.sum(), file=sys.stderr)
        print("NOTE: culled number of sources after magnitude cut", select.sum(), file=sys.stderr)

        # 2024018 NOTE: ra, dec had not been copied over correctly. This caused
        # proper motion to be applied in a cumulative sense i.e. effectively
@@ -2000,7 +1991,6 @@ eval_variables.sband: '{filter_name}'"""

    def match_to_file(filename, radius_arcsec=1.0):
        """Match the catalog to an LSST Science Pipelines file"""
        from astropy.coordinates import SkyCoord
        from astropy.table import Table
        filename_fits = filename.replace(".parq", ".fits")
        Table.read(filename).write(filename_fits)
@@ -2026,10 +2016,7 @@ eval_variables.sband: '{filter_name}'"""
    ):

        from mbh import (
            get_log_mbh_continuity,
            get_log_mbh_continuity_new,
            get_log_mbh_continuity_new2,
            get_delta_log_mbh_shankar2019
            get_log_mbh_continuity_new2
        )

        # Get the selection
Loading