diff --git a/python/target_selection/cartons/bhm_galaxies.py b/python/target_selection/cartons/bhm_galaxies.py index 72b75e7b..800594dd 100644 --- a/python/target_selection/cartons/bhm_galaxies.py +++ b/python/target_selection/cartons/bhm_galaxies.py @@ -205,10 +205,12 @@ def build_query(self, version_id, query_region=None): ls.flux_r.alias("ls10_flux_r"), # extra ls.flux_i.alias("ls10_flux_i"), # extra ls.flux_z.alias("ls10_flux_z"), # extra + ls.fiberflux_z.alias("ls10_fiberflux_z"), # extra ls.ebv.alias("ls10_ebv"), # extra + ls.mw_transmission_z.alias("ls10_mw_transmission_z"), # extra + ls.shape_r.alias("ls10_shape_r"), # extra ls.maskbits.alias("ls10_maskbits"), # extra ls.fitbits.alias("ls10_fitbits"), # extra - ls.mw_transmission_z.alias("ls10_mw_transmission_z"), # extra gal_lat.alias("abs_gal_lat"), # extra ) .join(c2ls) @@ -235,6 +237,8 @@ def build_query(self, version_id, query_region=None): (ls.maskbits.bin_and(maskbits_mask) == 0), # avoid bad ls data # (ls.fitbits.bin_and(fitbits_mask) == 0), # avoid bad ls fits ) + # .where(c.catalogid.between(63050396500000000, # debug + # 63050396550000000)) # debug .distinct(c.catalogid) ) @@ -258,17 +262,24 @@ def post_process(self, model, **kwargs): dered_flux_z_min = AB2nMgy(self.parameters["dered_mag_z_max"]) dered_fiberflux_z_min = AB2nMgy(self.parameters["dered_fibermag_z_max"]) - data = pandas.read_sql(f"SELECT catalogid,abs_gal_lat,flux_z,fiberflux_z from {self.path}", - self.database) - valid = ( - numpy.where(data["abs_gal_lat"] > self.parameters["min_gal_lat"], - True, False) & - numpy.where(data["flux_z"] > dered_flux_z_min * data["mw_transmission_z"], - True, False) & - numpy.where(data["fiberflux_z"] > dered_fiberflux_z_min * data["mw_transmission_z"], - True, False) + data = pandas.read_sql( + ( + "SELECT catalogid,abs_gal_lat,ls10_flux_z," + "ls10_fiberflux_z,ls10_mw_transmission_z " + f"from {self.path}" + ), + self.database) + + valid = numpy.where( + (data["abs_gal_lat"] > self.parameters["min_gal_lat"]) & + (data["ls10_flux_z"] > dered_flux_z_min * data["ls10_mw_transmission_z"]) & + (data["ls10_fiberflux_z"] > dered_fiberflux_z_min * data["ls10_mw_transmission_z"]), + True, False, ) + print("During post-processing we down-selected " + f"{numpy.count_nonzero(valid)}/{len(data)} rows") + data = data[valid] valid_cids = data.catalogid.values diff --git a/python/target_selection/config/target_selection.yml b/python/target_selection/config/target_selection.yml index 65d81f90..ba024bda 100644 --- a/python/target_selection/config/target_selection.yml +++ b/python/target_selection/config/target_selection.yml @@ -13,7 +13,6 @@ gaia_g: [catalog_to_gaia_dr3_source, gaia_dr3_source, gaia_dr3_source.phot_g_mean_mag] database_options: work_mem: '2000MB' - enable_bitmapscan: false parameters: bhm_colr_galaxies_lsdr10_d3: priority: 7101