Skip to content

Commit

Permalink
Tag1.3.5 (#469)
Browse files Browse the repository at this point in the history
* edits for tag1.3.5

* edits for tag1.3.5

* edit mwm_halo_gaia_dr3.py

* edits for tag1.3.5
  • Loading branch information
astronomygupta authored Jul 25, 2024
1 parent 7b595d7 commit aa169dc
Show file tree
Hide file tree
Showing 4 changed files with 229 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.3.5 - July 24, 2024

## New

* add cartons to target_selection plan 1.2.6

## 1.3.4 - July 23, 2024

## New
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sdss-target-selection"
version = "1.3.5.a0"
version = "1.3.5"
description = "Code to perform target selection for BHM/MWM using catalogdb"
authors = ["José Sánchez-Gallego <[email protected]>"]
license = "BSD 3-Clause"
Expand Down
199 changes: 198 additions & 1 deletion python/target_selection/cartons/mwm_halo_gaia_dr3.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def build_query(self, version_id, query_region=None):


class MWM_halo_distant_rrl_boss_triple_Carton(MWM_halo_distant_rrl_boss_single_Carton):
"""mwm_halo_distant_rrl_boss_triple
"""
mwm_halo_distant_rrl_boss_triple
Shorthand name: mwm_halo_distant_rrl_boss_triple
Metadata:
Priority: 3049
Expand Down Expand Up @@ -1229,6 +1230,56 @@ class MWM_halo_local_high_apogee_triple_Carton(MWM_halo_local_high_apogee_single
priority = 2979
can_offset = True

def build_query(self, version_id, query_region=None):
query = super().build_query(version_id, query_region)
return query

def post_process(self, model):
cursor = self.database.execute_sql(
"update sandbox.temp_mwm_halo_local_high_apogee_triple " + "set selected = false;"
)

cursor = self.database.execute_sql(
"select catalogid, vtan, "
+ "parallax_over_error, phot_g_mean_mag, parallax from "
+ " sandbox.temp_mwm_halo_local_high_apogee_triple ;"
)

output = cursor.fetchall()

for i in range(len(output)):
current_catalogid = output[i][0]
# current_vtan = output[i][1]
current_parallax_over_error = output[i][2]
current_phot_g_mean_mag = output[i][3]
current_parallax = output[i][4]

# The 'where' clause in the query in build_query() ensures
# that current_phot_g_mean_mag and current_parallax are not null.
current_m_g = current_phot_g_mean_mag - (10 - 5 * math.log10(current_parallax))

is_m_g_3to5 = (3 < current_m_g) and (current_m_g < 5)
is_parallax_over_error_5to10 = (5 < current_parallax_over_error) and (
current_parallax_over_error < 10
)

# Below we do not check for vtan > 150 since
# the query in base class build_query() has vtan > 150
#
# We do not check for parallax_over_error > 5 since
# the query in base class build_query() has parallax_over_error > 5

if (is_m_g_3to5 and is_parallax_over_error_5to10) or (
current_parallax_over_error >= 10
):
self.database.execute_sql(
" update sandbox.temp_mwm_halo_local_high_apogee_triple "
+ " set selected = true "
+ " where catalogid = "
+ str(current_catalogid)
+ ";"
)


class MWM_halo_local_high_boss_single_Carton(MWM_halo_local_Base_Carton):
"""
Expand Down Expand Up @@ -1324,6 +1375,56 @@ class MWM_halo_local_high_boss_triple_Carton(MWM_halo_local_high_boss_single_Car
priority = 2979
can_offset = True

def build_query(self, version_id, query_region=None):
query = super().build_query(version_id, query_region)
return query

def post_process(self, model):
cursor = self.database.execute_sql(
"update sandbox.temp_mwm_halo_local_high_boss_triple " + "set selected = false;"
)

cursor = self.database.execute_sql(
"select catalogid, vtan, "
+ "parallax_over_error, phot_g_mean_mag, parallax from "
+ " sandbox.temp_mwm_halo_local_high_boss_triple ;"
)

output = cursor.fetchall()

for i in range(len(output)):
current_catalogid = output[i][0]
# current_vtan = output[i][1]
current_parallax_over_error = output[i][2]
current_phot_g_mean_mag = output[i][3]
current_parallax = output[i][4]

# The 'where' clause in the query in build_query() ensures
# that current_phot_g_mean_mag and current_parallax are not null.
current_m_g = current_phot_g_mean_mag - (10 - 5 * math.log10(current_parallax))

is_m_g_3to5 = (3 < current_m_g) and (current_m_g < 5)
is_parallax_over_error_5to10 = (5 < current_parallax_over_error) and (
current_parallax_over_error < 10
)

# Below we do not check for vtan > 150 since
# the query in base class build_query() has vtan > 150
#
# We do not check for parallax_over_error > 5 since
# the query in base class build_query() has parallax_over_error > 5

if (is_m_g_3to5 and is_parallax_over_error_5to10) or (
current_parallax_over_error >= 10
):
self.database.execute_sql(
" update sandbox.temp_mwm_halo_local_high_boss_triple "
+ " set selected = true "
+ " where catalogid = "
+ str(current_catalogid)
+ ";"
)


class MWM_halo_local_low_apogee_single_Carton(MWM_halo_local_Base_Carton):
"""
Expand Down Expand Up @@ -1415,6 +1516,54 @@ class MWM_halo_local_low_apogee_triple_Carton(MWM_halo_local_low_apogee_single_C
priority = 6499
can_offset = True

def build_query(self, version_id, query_region=None):
query = super().build_query(version_id, query_region)
return query

def post_process(self, model):
cursor = self.database.execute_sql(
"update sandbox.temp_mwm_halo_local_low_apogee_triple " + "set selected = false;"
)

cursor = self.database.execute_sql(
"select catalogid, vtan, "
+ "parallax_over_error, phot_g_mean_mag, parallax from "
+ " sandbox.temp_mwm_halo_local_low_apogee_triple ;"
)

output = cursor.fetchall()

for i in range(len(output)):
current_catalogid = output[i][0]
# current_vtan = output[i][1]
current_parallax_over_error = output[i][2]
current_phot_g_mean_mag = output[i][3]
current_parallax = output[i][4]

# The 'where' clause in the query in build_query() ensures
# that current_phot_g_mean_mag and current_parallax are not null.
current_m_g = current_phot_g_mean_mag - (10 - 5 * math.log10(current_parallax))

is_m_g_3to5 = (3 < current_m_g) and (current_m_g < 5)
is_parallax_over_error_5to10 = (5 < current_parallax_over_error) and (
current_parallax_over_error < 10
)

# Below we do not check for vtan > 150 since
# the query in base class build_query() has vtan > 150
#
# We do not check for parallax_over_error > 5 since
# the query in base class build_query() has parallax_over_error > 5

if (not is_m_g_3to5) and is_parallax_over_error_5to10:
self.database.execute_sql(
" update sandbox.temp_mwm_halo_local_low_apogee_triple "
+ " set selected = true "
+ " where catalogid = "
+ str(current_catalogid)
+ ";"
)


class MWM_halo_local_low_boss_single_Carton(MWM_halo_local_Base_Carton):
"""
Expand Down Expand Up @@ -1506,6 +1655,54 @@ class MWM_halo_local_low_boss_triple_Carton(MWM_halo_local_low_boss_single_Carto
priority = 6499
can_offset = True

def build_query(self, version_id, query_region=None):
query = super().build_query(version_id, query_region)
return query

def post_process(self, model):
cursor = self.database.execute_sql(
"update sandbox.temp_mwm_halo_local_low_boss_triple " + "set selected = false;"
)

cursor = self.database.execute_sql(
"select catalogid, vtan, "
+ "parallax_over_error, phot_g_mean_mag, parallax from "
+ " sandbox.temp_mwm_halo_local_low_boss_triple ;"
)

output = cursor.fetchall()

for i in range(len(output)):
current_catalogid = output[i][0]
# current_vtan = output[i][1]
current_parallax_over_error = output[i][2]
current_phot_g_mean_mag = output[i][3]
current_parallax = output[i][4]

# The 'where' clause in the query in build_query() ensures
# that current_phot_g_mean_mag and current_parallax are not null.
current_m_g = current_phot_g_mean_mag - (10 - 5 * math.log10(current_parallax))

is_m_g_3to5 = (3 < current_m_g) and (current_m_g < 5)
is_parallax_over_error_5to10 = (5 < current_parallax_over_error) and (
current_parallax_over_error < 10
)

# Below we do not check for vtan > 150 since
# the query in base class build_query() has vtan > 150
#
# We do not check for parallax_over_error > 5 since
# the query in base class build_query() has parallax_over_error > 5

if (not is_m_g_3to5) and is_parallax_over_error_5to10:
self.database.execute_sql(
" update sandbox.temp_mwm_halo_local_low_boss_triple "
+ " set selected = true "
+ " where catalogid = "
+ str(current_catalogid)
+ ";"
)


class MWM_halo_local_high_apogee_Carton(MWM_halo_local_Base_Carton):
"""
Expand Down
24 changes: 24 additions & 0 deletions python/target_selection/config/target_selection.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
'1.2.6':
xmatch_plan: 1.0.0
cartons:
- mwm_halo_distant_rrl_boss_triple
- mwm_halo_vmp_xp_boss_triple
- mwm_halo_mp_xp_boss_triple
- mwm_halo_nmp_xp_boss_triple
- mwm_halo_vmp_xp_apogee_triple
- mwm_halo_mp_xp_apogee_triple
- mwm_halo_nmp_xp_apogee_triple
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: '200MB'
enable_bitmapscan: false
enable_seqscan: false

'1.2.5':
xmatch_plan: 1.0.0
cartons:
Expand Down

0 comments on commit aa169dc

Please sign in to comment.