Skip to content

Commit

Permalink
adding in a telescope key into the extra info dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessica Pilling committed Aug 14, 2023
1 parent b6b2d83 commit 9424a42
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
17 changes: 10 additions & 7 deletions xga/generate/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,26 @@ def execute_cmd(cmd: str, p_type: str, p_path: list, extra_info: dict, src: str)
if p_type == "image":
# Maybe let the user decide not to raise errors detected in stderr
# ASSUMPTION1 - tscope attribute in BaseProduct
# TODO add in tscope parameter in extra_info
prod = Image(p_path[0], extra_info["obs_id"], extra_info["instrument"], out, err, cmd, extra_info["lo_en"],
extra_info["hi_en"])
prod = Image(p_path[0], extra_info["tscope"], extra_info["obs_id"], extra_info["instrument"], out, err, cmd,
extra_info["lo_en"], extra_info["hi_en"])
if "psf_corr" in extra_info and extra_info["psf_corr"]:
prod.psf_corrected = True
prod.psf_bins = extra_info["psf_bins"]
prod.psf_model = extra_info["psf_model"]
prod.psf_iterations = extra_info["psf_iter"]
prod.psf_algorithm = extra_info["psf_algo"]
elif p_type == "expmap":
prod = ExpMap(p_path[0], extra_info["obs_id"], extra_info["instrument"], out, err, cmd,
# ASSUMPTION1 - tscope attribute in BaseProduct
prod = ExpMap(p_path[0], extra_info["tscope"], extra_info["obs_id"], extra_info["instrument"], out, err, cmd,
extra_info["lo_en"], extra_info["hi_en"])
elif p_type == "ccf" and "NullSource" not in src:
# ccf files may not be destined to spend life as product objects, but that doesn't mean
# I can't take momentarily advantage of the error parsing I built into the product classes
prod = BaseProduct(p_path[0], "", "", out, err, cmd)
# ASSUMPTION1 - tscope attribute in BaseProduct
prod = BaseProduct(p_path[0], "", "", "", out, err, cmd)
elif (p_type == "spectrum" or p_type == "annular spectrum set components") and "NullSource" not in src:
prod = Spectrum(p_path[0], extra_info["rmf_path"], extra_info["arf_path"], extra_info["b_spec_path"],
# ASSUMPTION1 - tscope attribute in BaseProduct
prod = Spectrum(p_path[0], extra_info["tscope"], extra_info["rmf_path"], extra_info["arf_path"], extra_info["b_spec_path"],
extra_info['central_coord'], extra_info["inner_radius"], extra_info["outer_radius"],
extra_info["obs_id"], extra_info["instrument"], extra_info["grouped"], extra_info["min_counts"],
extra_info["min_sn"], extra_info["over_sample"], out, err, cmd, extra_info["from_region"],
Expand All @@ -54,7 +56,8 @@ def execute_cmd(cmd: str, p_type: str, p_path: list, extra_info: dict, src: str)
extra_info["x_bounds"], extra_info["y_bounds"], extra_info["obs_id"],
extra_info["instrument"], out, err, cmd)
elif p_type == "cross arfs":
prod = BaseProduct(p_path[0], extra_info['obs_id'], extra_info['inst'], out, err, cmd, extra_info)
# ASSUMPTION1 - tscope attribute in BaseProduct
prod = BaseProduct(p_path[0], extra_info["tscope"], extra_info['obs_id'], extra_info['inst'], out, err, cmd, extra_info)
elif "NullSource" in src:
prod = None
else:
Expand Down
3 changes: 3 additions & 0 deletions xga/generate/esass/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def wrapper(*args, **kwargs):
# This is the output from whatever function this is a decorator for
cmd_list, to_stack, to_execute, cores, p_type, paths, extra_info, disable = esass_func(*args, **kwargs)

# Appending a telescope key into the extra_info dictionary
extra_info['tscope'] = 'erosita'

src_lookup = {}
all_run = [] # Combined command list for all sources
all_type = [] # Combined expected type list for all sources
Expand Down

0 comments on commit 9424a42

Please sign in to comment.