Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JP-3795: Target group association fixes #8943

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions jwst/associations/lib/rules_level2_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,20 @@ def nod_background_overlap(science_item, background_item):
if exptype not in ['nrs_fixedslit', 'nrs_msaspec']:
return False

# Check for target ID - if present,
# it must match for either FS or MOS
try:
sci_target_id = str(science_item['targetid']).lower()
bkg_target_id = str(background_item['targetid']).lower()
except KeyError:
sci_target_id = None
bkg_target_id = None
if sci_target_id != bkg_target_id:
# Report overlap - different activities contain
# different sources that may overlap, even if not
# at the same primary nod position.
return True

# Get pattern number values, needed for FS or MOS
try:
numdthpt = int(science_item['numdthpt'])
Expand Down
5 changes: 5 additions & 0 deletions jwst/associations/lib/rules_level3_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,8 @@ def dms_product_name_nrsfs_sources(asn):
product_name : str
The product name
"""
target = asn._get_target()

instrument = asn._get_instrument()

opt_elem = asn._get_opt_element()
Expand All @@ -690,8 +692,10 @@ def dms_product_name_nrsfs_sources(asn):
if subarray:
subarray = '-' + subarray


product_name_format = (
'jw{program}-{acid}'
'_{target}'
'_{source_id}'
'_{instrument}'
'_{opt_elem}-{slit_name}{subarray}'
Expand All @@ -700,6 +704,7 @@ def dms_product_name_nrsfs_sources(asn):
product_name_format,
program=asn.data['program'],
acid=asn.acid.id,
target=target,
instrument=instrument,
opt_elem=opt_elem,
subarray=subarray,
Expand Down
Loading