From a344da3e15e45d826f6036ee2bf213eb1987eb0b Mon Sep 17 00:00:00 2001 From: Tom Dwelly Date: Tue, 16 Jul 2024 06:57:40 -0600 Subject: [PATCH] Added '_3' versions of several BHM cartons. Added bhm_aqmes_wide1* cartons. --- .flake8 | 2 + CHANGELOG.md | 23 ++++ python/target_selection/cartons/bhm_aqmes.py | 21 ++- python/target_selection/cartons/bhm_csc.py | 10 ++ .../target_selection/cartons/bhm_galaxies.py | 21 ++- python/target_selection/cartons/bhm_gua.py | 5 + .../cartons/bhm_spiders_agn.py | 27 ++++ .../cartons/bhm_spiders_clusters.py | 9 ++ .../config/target_selection.yml | 121 +++++------------- 9 files changed, 136 insertions(+), 103 deletions(-) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..bf750d2c --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +max-line-length = 99 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e002cdb..759acd83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## 1.3.1 - July 16, 2024 + +## New + +* .flake8 - allow line length up to 100 characters (as it was before) +* added bhm\_aqmes\_wide1 and bhm\_aqmes\_wide1\_faint cartons + * identical to 'wide2' versions, but with a 'dark\_1x4' cadence and +1 added to priorities +* new '\_3' versions of selected BHM cartons + * these new cartons assign targets which prevously had cadence 'dark\_flexible\_4x1' a new cadence of 'dark\_flexible\_3x1' + * these new versions only output the subset of targets having cadence (targets with easier cadences are omitted) + * the '\_3' versions have target priority incremented by 1 + * new '\_3' cartons are: + * bhm\_csc\_boss\_3 + * bhm\_gua\_dark\_3 + * bhm\_spiders\_clusters\_lsdr10\_3 + * bhm\_spiders\_agn\_lsdr10\_3 + * bhm\_spiders\_agn\_hard\_3 + * bhm\_spiders\_agn\_gaiadr3\_3 + * bhm\_spiders\_agn\_tda\_3 + * bhm\_spiders\_agn\_sep\_3 + * bhm\_colr\_galaxies\_lsdr10\_3 + + ## 1.3.0 - July 10, 2024 ### ✨ Improved diff --git a/python/target_selection/cartons/bhm_aqmes.py b/python/target_selection/cartons/bhm_aqmes.py index 99a62e11..f536e7f4 100644 --- a/python/target_selection/cartons/bhm_aqmes.py +++ b/python/target_selection/cartons/bhm_aqmes.py @@ -87,8 +87,12 @@ class BhmAqmesBaseCarton(BaseCarton): cadence = None cadence_v0p5 = None - # read the AQMES field centres from a fits file and convert to a list of dicts - def get_fieldlist(self, cadence_v1=None): + def get_fieldlist(self, cadence_v0=None): + """ + read the AQMES field centres from a fits file and convert to a list of dicts + New: it is now the responsibility of the calling function to convert from a + v1 cadence into a v0 cadence name + """ stub = self.parameters.get("fieldlist", None) if stub is None or stub == "" or stub == "None": return None @@ -104,10 +108,11 @@ def get_fieldlist(self, cadence_v1=None): assert len(hdul[1].data) > 0 - # choose the correct subset of fields based on the cadence name and form a list of dicts - # we have to use the v0 cadence names though - assert cadence_v1 in cadence_map_v1_to_v0 - cadence_v0 = cadence_map_v1_to_v0[cadence_v1] + # # choose the correct subset of fields based on the cadence name + # # and then form a list of dicts + # # we have to use the v0 cadence names in the file though + # assert cadence_v1 in cadence_map_v1_to_v0 + # cadence_v0 = cadence_map_v1_to_v0[cadence_v1] try: fieldlist = [ @@ -242,7 +247,9 @@ def build_query(self, version_id, query_region=None): .distinct([c.catalogid]) # avoid duplicates - trust the catalog ) - query = self.append_spatial_query(query, self.get_fieldlist(cadence_v1)) + # query = self.append_spatial_query(query, self.get_fieldlist(cadence_v1)) + query = self.append_spatial_query(query, + self.get_fieldlist(cadence_v0)) return query diff --git a/python/target_selection/cartons/bhm_csc.py b/python/target_selection/cartons/bhm_csc.py index bd5fc3ca..c78d5b28 100644 --- a/python/target_selection/cartons/bhm_csc.py +++ b/python/target_selection/cartons/bhm_csc.py @@ -36,6 +36,7 @@ # This module provides the following BHM cartons: # bhm_csc_boss +# bhm_csc_boss_3 # bhm_csc_apogee @@ -49,6 +50,7 @@ class BhmCscBossCarton(BaseCarton): instrument = "BOSS" tile = False can_offset = True + only_faintest_cadence = False def build_query(self, version_id, query_region=None): x = BHM_CSC_v3.alias() @@ -239,6 +241,9 @@ def build_query(self, version_id, query_region=None): .distinct([fn.coalesce(c2g3.catalogid, c2ls.catalogid, c2ps.catalogid)]) ) + if self.only_faintest_cadence: + query = query.where(cadence == cadence3) + if query_region: query = query.where( peewee.fn.q3c_radial_query( @@ -249,6 +254,11 @@ def build_query(self, version_id, query_region=None): return query +class BhmCscBoss3Carton(BhmCscBossCarton): + name = "bhm_csc_boss_3" + only_faintest_cadence = True + + # ####### class BhmCscApogeeCarton(BaseCarton): """ diff --git a/python/target_selection/cartons/bhm_galaxies.py b/python/target_selection/cartons/bhm_galaxies.py index ffc26d81..32c692af 100644 --- a/python/target_selection/cartons/bhm_galaxies.py +++ b/python/target_selection/cartons/bhm_galaxies.py @@ -21,10 +21,11 @@ """ Details: Start here https://wiki.sdss.org/display/OPS/Defining+target+selection+and+cadence+algorithms + see particularly: https://wiki.sdss.org/display/BHM/BHM+Cartons+of+Last+Resort This module provides the following BHM cartons: bhm_colr_galaxies_lsdr10 - see particularly: https://wiki.sdss.org/display/BHM/BHM+Cartons+of+Last+Resort +bhm_colr_galaxies_lsdr10_3 """ @@ -50,6 +51,7 @@ class BhmColrGalaxiesLsdr10Carton(BaseCarton): # cadence = 'dark_1x1' instrument = "BOSS" can_offset = False + only_faintest_cadence = False def build_query(self, version_id, query_region=None): c = Catalog.alias() @@ -154,13 +156,16 @@ def build_query(self, version_id, query_region=None): opt_prov = peewee.Case(None, ((valid, "sdss_fiber2mag_from_lsdr10"),), "undefined") + cadence1 = self.parameters["cadence1"] + cadence2 = self.parameters["cadence2"] + cadence3 = self.parameters["cadence3"] cadence = peewee.Case( None, ( - (ls.fiberflux_r > fiberflux_r_min_for_cadence1, self.parameters["cadence1"]), - (ls.fiberflux_r > fiberflux_r_min_for_cadence2, self.parameters["cadence2"]), + (ls.fiberflux_r > fiberflux_r_min_for_cadence1, cadence1), + (ls.fiberflux_r > fiberflux_r_min_for_cadence2, cadence2), ), - self.parameters["cadence3"], + cadence3, ) # compute the abs(Galactic latitude): @@ -234,6 +239,9 @@ def build_query(self, version_id, query_region=None): .distinct(c.catalogid) ) + if self.only_faintest_cadence: + query = query.where(cadence == cadence3) + # query_region[0] is ra of center of the region, degrees # query_region[1] is dec of center of the region, degrees # query_region[2] is radius of the region, degrees @@ -245,3 +253,8 @@ def build_query(self, version_id, query_region=None): ) return query + + +class BhmColrGalaxiesLsdr103Carton(BhmColrGalaxiesLsdr10Carton): + name = "bhm_colr_galaxies_lsdr10_3" + only_faintest_cadence = True diff --git a/python/target_selection/cartons/bhm_gua.py b/python/target_selection/cartons/bhm_gua.py index fc59db68..7c1eeef6 100644 --- a/python/target_selection/cartons/bhm_gua.py +++ b/python/target_selection/cartons/bhm_gua.py @@ -31,6 +31,7 @@ # # This module provides the following BHM cartons: # bhm_gua_dark +# bhm_gua_dark_3 # bhm_gua_bright # # Updated by TD on 27/01/2021 to add v0.5 improvements @@ -296,6 +297,10 @@ class BhmGuaDarkCarton(BhmGuaBaseCarton): name = "bhm_gua_dark" +class BhmGuaDark3Carton(BhmGuaBaseCarton): + name = "bhm_gua_dark_3" + + class BhmGuaBrightCarton(BhmGuaBaseCarton): """ ------ bhm_gua_bright ------ diff --git a/python/target_selection/cartons/bhm_spiders_agn.py b/python/target_selection/cartons/bhm_spiders_agn.py index 2656ff8f..bb6883c8 100644 --- a/python/target_selection/cartons/bhm_spiders_agn.py +++ b/python/target_selection/cartons/bhm_spiders_agn.py @@ -622,6 +622,7 @@ class BhmSpidersAgnGaiadr3Carton(BaseCarton): tile = False instrument = "BOSS" can_offset = True + only_faintest_cadence = False def build_query(self, version_id, query_region=None): c = Catalog.alias() @@ -932,6 +933,9 @@ def build_query(self, version_id, query_region=None): .distinct([g3.source_id]) # avoid duplicates - we trust the gaia ids ) + if self.only_faintest_cadence: + query = query.where(cadence == cadence3) + if query_region: query = query.where( peewee.fn.q3c_radial_query( @@ -959,12 +963,25 @@ class BhmSpidersAgnGaiadr3BothCarton(BhmSpidersAgnGaiadr3Carton): name = "bhm_spiders_agn_gaiadr3_both" +# ################################################################################## # we can get away with just inheriting the selection code from # the gaia dr3 hemisphere match and adjusting the parameters only class BhmSpidersAgnSepCarton(BhmSpidersAgnGaiadr3Carton): name = "bhm_spiders_agn_sep" +# ################################################################################## +class BhmSpidersAgnGaiadr33CartonCarton(BhmSpidersAgnGaiadr3Carton): + name = "bhm_spiders_agn_gaiadr3_3" + only_faintest_cadence = True + + +# ################################################################################## +class BhmSpidersAgnSep3Carton(BhmSpidersAgnGaiadr3Carton): + name = "bhm_spiders_agn_sep_3" + only_faintest_cadence = True + + class BhmSpidersAgnTdaCarton(BaseCarton): name = "bhm_spiders_agn_tda" category = "science" @@ -973,6 +990,7 @@ class BhmSpidersAgnTdaCarton(BaseCarton): tile = False instrument = "BOSS" can_offset = True + only_faintest_cadence = False def build_query(self, version_id, query_region=None): c = Catalog.alias() @@ -1240,6 +1258,9 @@ def build_query(self, version_id, query_region=None): .distinct([ls.ls_id]) # avoid duplicates - we trust the legacy survey entries ) + if self.only_faintest_cadence: + query = query.where(cadence == cadence3) + if query_region: query = query.where( peewee.fn.q3c_radial_query( @@ -1248,3 +1269,9 @@ def build_query(self, version_id, query_region=None): ) return query + + +# ################################################################################## +class BhmSpidersAgnTda3Carton(BhmSpidersAgnTdaCarton): + name = "bhm_spiders_agn_tda_3" + only_faintest_cadence = True diff --git a/python/target_selection/cartons/bhm_spiders_clusters.py b/python/target_selection/cartons/bhm_spiders_clusters.py index 136b6797..a0a3313f 100644 --- a/python/target_selection/cartons/bhm_spiders_clusters.py +++ b/python/target_selection/cartons/bhm_spiders_clusters.py @@ -54,6 +54,7 @@ # # This file provides the following BHM cartons in v1.0: # # bhm_spiders_clusters_lsdr10 +# bhm_spiders_clusters_lsdr10_3 # # ############################################ # ############################################ @@ -83,6 +84,7 @@ class BhmSpidersClustersLsdr10Carton(BaseCarton): instrument = "BOSS" inertial = True can_offset = True + only_faintest_cadence = False def build_query(self, version_id, query_region=None): c = Catalog.alias() @@ -395,6 +397,9 @@ def build_query(self, version_id, query_region=None): .distinct([ls.ls_id]) ) + if self.only_faintest_cadence: + query = query.where(cadence == cadence3) + if query_region: query = query.where( peewee.fn.q3c_radial_query( @@ -408,3 +413,7 @@ def build_query(self, version_id, query_region=None): # # END BhmSpidersClustersLsdr10Carton # ################################################################################## + +class BhmSpidersClustersLsdr103Carton(BhmSpidersClustersLsdr10Carton): + name = "bhm_spiders_clusters_lsdr10_3" + only_faintest_cadence = True diff --git a/python/target_selection/config/target_selection.yml b/python/target_selection/config/target_selection.yml index e5a36956..26d510fe 100644 --- a/python/target_selection/config/target_selection.yml +++ b/python/target_selection/config/target_selection.yml @@ -1,80 +1,17 @@ -'1.2.23': - xmatch_plan: 1.0.0 - cartons: - - bhm_spiders_agn_hard_3 - open_fiber_path: /uufs/chpc.utah.edu/common/home/sdss50/sdsswork/target/open_fiber/postv1/draft2/ - schema: sandbox - magnitudes: - h: [catalog_to_twomass_psc, twomass_psc, twomass_psc.h_m] - j: [catalog_to_twomass_psc, twomass_psc, twomass_psc.j_m] - k: [catalog_to_twomass_psc, twomass_psc, twomass_psc.k_m] - bp: [catalog_to_gaia_dr3_source, gaia_dr3_source, gaia_dr3_source.phot_bp_mean_mag] - rp: [catalog_to_gaia_dr3_source, gaia_dr3_source, gaia_dr3_source.phot_rp_mean_mag] - gaia_g: [catalog_to_gaia_dr3_source, gaia_dr3_source, gaia_dr3_source.phot_g_mean_mag] - database_options: - work_mem: '5GB' - parameters: - bhm_spiders_agn_hard_3: - value: 1.0 - ero_version: 'eRASS_s1_3B_221031_poscorr' - xmatch_method: 'XPS/NWAY' - xmatch_version1: 'JBJWMS_24Nov22' - xmatch_version2: '' - opt_cat1: 'lsdr10' - opt_cat2: '' - fibermag_r_min: 13.5 - fibermag_r_max: 22.5 - fibermag_i_min: 13.5 - fibermag_i_max: 22.3 - fibermag_z_min: 13.5 - fibermag_z_max: 21.5 - fibermag_r_min_for_core: 16.5 - fibermag_r_max_for_core: 22.0 - fibermag_i_min_for_core: 16.5 - fibermag_i_max_for_core: 21.8 - fibermag_z_min_for_core: 16.5 - fibermag_z_max_for_core: 21.0 - fibermag_r_for_cadence1: 16.5 - fibermag_r_for_cadence2: 19.0 - fibermag_i_for_cadence1: 16.3 - fibermag_i_for_cadence2: 18.7 - gaia_g_max_for_cadence1: 16.0 - gaia_rp_max_for_cadence1: 16.0 - gaia_g_mag_limit: 13.5 - gaia_rp_mag_limit: 13.5 - cadence1: 'bright_flexible_2x1' - cadence2: 'dark_flexible_2x1' - cadence3: 'dark_1x3' - det_like_min: 12.0 - det_like_for_priority: 12.0 - min_det_like_for_core: 12.0 - min_ero_flux_for_core: 0.0 - min_gal_lat_for_core: 10.0 - min_dec_for_core: -75.0 - p_any_min: 0.01 - spec_sn_thresh: 1.60 - spec_z_err_thresh: 0.002 - priority_floor: 1511 - dpriority_not_hard: 1 - dpriority_match_flags: 2 - dpriority_det_like: 4 - dpriority_has_spec: 200 - dpriority_non_core: 2000 - -'1.2.22': +'1.3.1': xmatch_plan: 1.0.0 cartons: - bhm_aqmes_wide1 - bhm_aqmes_wide1_faint - - bhm_csc_boss - - bhm_gua_dark - - bhm_spiders_clusters_lsdr10 - - bhm_spiders_agn_lsdr10 - - bhm_spiders_agn_hard - - bhm_spiders_agn_gaiadr3 - - bhm_spiders_agn_tda - - bhm_spiders_agn_sep - - bhm_colr_galaxies_lsdr10 + - bhm_csc_boss_3 + - bhm_gua_dark_3 + - bhm_spiders_clusters_lsdr10_3 + - bhm_spiders_agn_lsdr10_3 + - bhm_spiders_agn_hard_3 + - bhm_spiders_agn_gaiadr3_3 + - bhm_spiders_agn_tda_3 + - bhm_spiders_agn_sep_3 + - bhm_colr_galaxies_lsdr10_3 open_fiber_path: /uufs/chpc.utah.edu/common/home/sdss50/sdsswork/target/open_fiber/postv1/draft2/ schema: sandbox magnitudes: @@ -101,7 +38,7 @@ mag_i_min: 19.1 mag_i_max: 21.0 cadence: 'dark_1x4' - bhm_csc_boss: + bhm_csc_boss_3: g_psf_mag_min: 14.0 r_psf_mag_min: 14.0 i_psf_mag_min: 14.0 @@ -129,13 +66,13 @@ cadence1: 'bright_1x1' cadence2: 'dark_flexible_2x1' cadence3: 'dark_flexible_3x1' - priority_floor_dark: 1920 + priority_floor_dark: 1921 priority_floor_bright: 2920 dpriority_has_spec: 10 value: 1.0 spec_sn_thresh: 1.60 spec_z_err_thresh: 0.002 - bhm_gua_dark: + bhm_gua_dark_3: mag_g_min: 16.5 mag_g_max: 21.2 mag_rp_min: 16.5 @@ -143,10 +80,10 @@ prob_rf_min: 0.80 spec_sn_thresh: 2.0 spec_z_err_thresh: 0.01 - priority: 3400 + priority: 3401 value: 0.5 cadence: 'dark_flexible_3x1' - bhm_spiders_clusters_lsdr10: + bhm_spiders_clusters_lsdr10_3: value_bcg: 5.0 value_member: 1.0 ero_version: 'eRASS4_020' @@ -176,11 +113,11 @@ spec_join_radius: 1.0 spec_sn_thresh: 2.00 spec_z_err_thresh: 0.01 - priority_floor_bcg: 1501 - priority_floor_member: 1630 + priority_floor_bcg: 1502 + priority_floor_member: 1631 priority_levels: 31 dpriority_non_core: 2000 - bhm_spiders_agn_lsdr10: + bhm_spiders_agn_lsdr10_3: value: 1.0 ero_version: 'eRASS_s3_1B_221007_poscorr_v007' xmatch_method: 'XPS/NWAY' @@ -220,13 +157,13 @@ p_any_min: 0.1 spec_sn_thresh: 1.60 spec_z_err_thresh: 0.002 - priority_floor: 1520 + priority_floor: 1521 dpriority_not_hard: 1 dpriority_match_flags: 2 dpriority_det_like: 4 dpriority_has_spec: 200 dpriority_non_core: 2000 - bhm_spiders_agn_hard: + bhm_spiders_agn_hard_3: value: 1.0 ero_version: 'eRASS_s1_3B_221031_poscorr' xmatch_method: 'XPS/NWAY' @@ -266,13 +203,13 @@ p_any_min: 0.01 spec_sn_thresh: 1.60 spec_z_err_thresh: 0.002 - priority_floor: 1510 + priority_floor: 1511 dpriority_not_hard: 1 dpriority_match_flags: 2 dpriority_det_like: 4 dpriority_has_spec: 200 dpriority_non_core: 2000 - bhm_spiders_agn_gaiadr3: + bhm_spiders_agn_gaiadr3_3: value: 1.0 ero_version: 'eRASS_s3_1B_221007_poscorr_v007' xmatch_method1: 'XPS/NWAY' @@ -300,14 +237,14 @@ p_any_min: 0.1 spec_sn_thresh: 1.60 spec_z_err_thresh: 0.002 - priority_floor: 1540 + priority_floor: 1541 dpriority_not_hard: 1 dpriority_match_flags: 2 dpriority_det_like: 4 dpriority_has_spec: 200 in_plane_lat_cut: 15.0 dpriority_non_core: 2000 - bhm_spiders_agn_tda: + bhm_spiders_agn_tda_3: value: 0.0 ero_version: 'eRASS_s3_1B_220829_poscorr_v006' xmatch_method: 'XPS/NWAY_EROTDA' @@ -328,8 +265,8 @@ cadence1: 'bright_flexible_2x1' cadence2: 'dark_flexible_2x1' cadence3: 'dark_flexible_3x1' - priority_floor: 1690 - bhm_spiders_agn_sep: + priority_floor: 1691 + bhm_spiders_agn_sep_3: value: 1.0 ero_version: 'eRASS_s5_V29C' xmatch_method1: 'XPS/NWAY' @@ -357,15 +294,15 @@ p_any_min: 0.1 spec_sn_thresh: 1.60 spec_z_err_thresh: 0.002 - priority_floor: 1500 + priority_floor: 1501 dpriority_not_hard: 1 dpriority_match_flags: 2 dpriority_det_like: 4 dpriority_has_spec: 200 in_plane_lat_cut: 15.0 dpriority_non_core: 2000 - bhm_colr_galaxies_lsdr10: - priority: 7100 + bhm_colr_galaxies_lsdr10_3: + priority: 7101 value: 0.0 cadence1: 'bright_1x1' cadence2: 'dark_1x1'