0

I'm fairly new to python, and presently working on labeling some galaxy images. I have a set of 512x512 pix^2 images scaled to 0.2 arcsec/pix. Each one of the images have two objects to be labeled - one at the centre (256pix,256pix) at the other is at an offset (I've the projected separation between the objects as well as the ra-dec values for both the objects). The task is to encircle the objects in each of the images. Its easy for the central objects, but I'm stuck up on how to get the same thing done for the other object. The following snippet does the encircling of the central object, I need to figure out how to do that for the other one:

I have the RA-DEC values for both the objects (in degrees).
I have the separation between the objects (in kpc).

For an image 512x512 px at .2 ''/px, this iterates through all the objids in the list. For each objid I have a file with objid.png in a folder called Images_fin. This loads the correct image, and labels it with the objid.

for galaxy in range(0, len(objid)):
    imshow(im)
    a=gca()
    print a.text(20, 480, "objID:", color ='w', fontsize='10')
    print a.text(20, 490, "w1-w2:", color ='w', fontsize='10')
    print a.text(20, 500, "sep1 (in kpc):", color ='w', fontsize='10')
    print a.text(20, 510, "sep2 (in kpc):", color ='w', fontsize='10')
    print a.text(52, 480, objid[galaxy], color='w', fontsize='10')
    print a.text(52, 490, w[galaxy], color='w', fontsize='10')
    print a.text(78, 500, sep1[galaxy], color='w', fontsize='10')
    print a.text(78, 510, sep2[galaxy], color='w', fontsize='10')

    print a.hlines(y=20, xmin=480, xmax=495, linewidth=1, color = 'w')
    print a.vlines(x=480, ymin=18, ymax=22, linewidth=1, color = 'w')
    print a.vlines(x=495, ymin=18, ymax=22, linewidth=1, color = 'w')

    print a.text(485, 18, "3\"", color='w', fontsize='10')

    a.xaxis.set_visible(False)
    a.yaxis.set_visible(False)
    circle=plt.Circle((256,256),12,color='w',fill=False)
    plt.gcf().gca().add_artist(circle)

I'm pasting an example how the labeling should look like when done (This was done manually)

usernumber
  • 1,958
  • 1
  • 21
  • 58
Stp30
  • 125
  • 1
  • 8
  • Perhaps I'm not understanding RA-DEC correctly, but couldn't you figure out the horizontal pixel offset with (RA1 - RA2) * 3600 / .2 and similarly the vertical with DEC? Or is the image at an angle with respect to RA and DEC? – Amy Teegarden Jul 21 '15 at 20:28
  • 1
    I agree with the above -- if that calculation won't do it, though, try making your example simpler and possible for us to test example code against. One image, one set of RA/DEC coordinates, none of the looping or explanatory text that we don't need. – cphlewis Jul 21 '15 at 20:56

0 Answers0