Build a SINGLE LINE of text for a ds9 circle region. The line comes to standard out. The last argument is the target name, but if a value of " " (quote-enclosed blank) is used, then no text name is output in the string (i.e. the circle marker will not have a name string).
% xyr_circles_ds9.py --help usage: xyr_circles_ds9.py [-h] [-v] arg1 arg2 arg3 arg4 arg5 positional arguments: arg1 X in pixels arg2 Y in pixels arg3 radius of circle in pixels arg4 color arg5 target name optional arguments: -h, --help show this help message and exit -v, --verbose Verbose responses The usual type of run(s): % xyr_circles_ds9.py 100.23 550.2 25.8 blue " " circle(100.23,550.2,25.8) # color=blue % xyr_circles_ds9.py 100.23 550.2 25.8 blue "Star_1" circle(100.23,550.2,25.8) # color=blue text={Star_1} To get verbose output: % xyr_circles_ds9.py -v 100.23 550.2 25.8 blue "1234" X in pixels = 100.23 Y in pixels = 550.2 Radius in pixels = 25.8 color in pixels = blue Target Name (blank_in_quotes for none) = 1234 circle(100.23,550.2,25.8) # color=blue text={1234}This is a fairly easy to use, but perhaps not teriibly efficient, script to use. A version (like make_circles.py or xymake_circles.py) that simply reads a file of region parameters may be preferable in some cases. However, for a lot of applications, this python code will be easy to understand and use.
If you are using this in a script to build a regions file that will paint many circles of the ds9 window, you will want to add the "image" or "physical" keywords at the start of the regions file so that the type of units being used will be clear.