Skip to content

Commit

Permalink
Fix post-processing steps, remoce debug criteria.
Browse files Browse the repository at this point in the history
  • Loading branch information
tdwelly committed Aug 12, 2024
1 parent c26ff6d commit e5f45c6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
31 changes: 21 additions & 10 deletions python/target_selection/cartons/bhm_galaxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
)

Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion python/target_selection/config/target_selection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e5f45c6

Please sign in to comment.