I have an astronomical image of the entire night sky (the galactic plane in gamma rays) opened on ds9 in galactic coordinates. I would like to have ds9 draw circles over a list of coordinates that I provide, and draw these circles on top of the night sky image I already have. I know there must be a simple way of doing this, scratching my head over here....
Asked
Active
Viewed 1,249 times
0
-
In the edit menu, select region. Then in the region menu, check that your shape is a circle. Finally, click on the image where you want the circle. – Feb 14 '18 at 00:35
-
If you have a list of coordinates, you can write a little script to turn these into a region file and load that into DS9 (region -> load regions). To figure out the format, manually create a few regions and save those to a file, to see the actual file format (it can be useful to switch the WCS format from sexagesimal to degrees, depending on your input list format: wcs -> degrees). – Feb 14 '18 at 00:38
1 Answers
0
if you have a catalog of objects
import pandas as pd
from astropy.table import Table
# read catalog
candels_catalog = 'cat.csv'
df = pd.read_csv(candels_catalog)
# CSV to Astropy Table
table = Table.from_pandas(df)
# prepare .reg f=ile
reg_filename = "cat.reg"
with open(reg_filename, 'w') as regfile:
regfile.write("# Region file format: DS9 version 4.1\n")
regfile.write("global color=green dashlist=8 3 width=2 font=\"helvetica 10 normal roman\" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1\n")
regfile.write("image\n")
# over table'objects
for obj in table:
x, y = obj['X_IMAGE'], obj['Y_IMAGE']
a, b = obj['A_IMAGE'], obj['B_IMAGE']
theta = obj['THETA_IMAGE']
# write.reg(use pixel coor)
regfile.write("ellipse({},{},{},{},{})\n".format(x, y, a, b, -theta))

Mei
- 1