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

doc: example region extraction in X-ray fits fails #4591

Closed
Xarthisius opened this issue Jul 21, 2023 · 0 comments · Fixed by #4674
Closed

doc: example region extraction in X-ray fits fails #4591

Xarthisius opened this issue Jul 21, 2023 · 0 comments · Fixed by #4674
Milestone

Comments

@Xarthisius
Copy link
Member

Bug report

Bug summary

See: https://yt-project.org/doc/cookbook/fits_xray_images.html

Code for reproduction

from yt.frontends.fits.misc import ds9_region
import yt

ds = yt.load(
    "xray_fits/A2052_merged_0.3-2_match-core_tmap_bgecorr.fits",
    auxiliary_files=["xray_fits/A2052_core_tmap_b1_m2000_.fits"],
)

exposure_time = ds.quan(ds.primary_header["exposure"], "s")
reg_file = [
    "# Region file format: DS9 version 4.1\n",
    "global color=green dashlist=8 3 width=3 include=1 source=1 fk5\n",
    'circle(15:16:44.817,+7:01:19.62,34.6256")',
]
f = open("circle.reg", "w")
f.writelines(reg_file)
f.close()
circle_reg = ds9_region(
    ds, "circle.reg", field_parameters={"exposure_time": exposure_time}
)

Actual outcome

WARNING: A coordinate frame was not found for region: "circle(15:16:44.817,+7:01:19.62,34.6256")", skipping. [regions.io.ds9.read]
Traceback (most recent call last):
  File "/home/xarth/yt/xray_fits/ala.py", line 18, in <module>
    circle_reg = ds9_region(
  File "/home/xarth/codes/xarthisius/yt/yt/frontends/fits/misc.py", line 172, in ds9_region
    r = method(reg, format="ds9").regions[0]
IndexError: list index out of range

Expected outcome

No error.

Xarthisius added a commit to Xarthisius/yt that referenced this issue Sep 25, 2023
@neutrinoceros neutrinoceros added this to the 4.3.0 milestone Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants