<p>I ended up making my own small code that you can find here: 
     <a href="https://github.com/crhea93/AstronomyTools/blob/master/Astrometry/Correction.py" rel="nofollow noreferrer">https://github.com/crhea93/AstronomyTools/blob/master/Astrometry/Correction.py</a></p>

<p>Essentially, after inputting at least 3 matching target (found by eye in DS9 for example), the program will calculate the mean offset and apply it to the target image. The output is a new fits file of the target image with the proper correction.</p>

CC BY-SA 4.0
2019-09-28T01:20:32.300Z
Yes, that is one way to go if there is no rotation between images. You might want to add more sources to check if the XY shift is enough for the transformation.
Kornpob Bhirombhakdi
CC BY-SA 4.0
2019-09-17T12:27:31.310Z
2019-09-17T12:27:31.310Z
Carter Rhea
<p>I would like to re-align an image using a reference image (taken from GAIA). I am aware of the software Koords developed by the Karma team: <a href="https://www.atnf.csiro.au/computing/software/karma/" rel="nofollow noreferrer">https://www.atnf.csiro.au/computing/software/karma/</a></p>

<p>Unfortunately, the software crashes (with segmentation fault) everytime I try to add a source in either image. Is there a more up-to-date version of this tool? Or simply a different tool?</p>

<p>Update: Thank you for the responses! I will try to better explain exactly what I am trying to do :)</p>

<p>I have an X-ray image taken from Chandra and a GAIA-Aligned HST image. I know that the pointing for the X-ray image is off by ~.5 arcsec or so. I want  to re-align the X-ray image so that any X-ray point sources match their optical counter parts using the GAIA-Aligned HST image as my reference.  I hope this helps!</p>

CC BY-SA 4.0
2019-09-04T17:07:26.967Z
Can you tell us some more details about your environment? What machine are you working on? What version of the software are you using? What does the segfault say?
Bruce Becker
CC BY-SA 4.0
2019-09-04T17:58:42.573Z
Drizzlepac package in python can do that for you.
Kornpob Bhirombhakdi
CC BY-SA 4.0
2019-09-05T15:51:12.803Z
I am not entire sure how to answer the question about my environment... I am using Ubuntu 18.04. As for the software, I am using Karma-1.7.25. I downloaded both the common and amd64 gzip files and followed the instructions for installation that are written in the README file..

The software appears to work OK after reseting my computer HOWEVER I still receive a segmentation fault if I middle click AFTER doing any zooming....
Carter Rhea
CC BY-SA 4.0
2019-09-05T16:58:08.283Z
@KornpobBhirombhakdi I am familiar with drizzlepac, but I am unaware of its ability to do what I am looking for. If I am not mistaken, drizzlepac will use a source finding algorithm to find point sources in each image and then try to match them automatically. Is there a way to manually choose the point source we want for alignment, like with Koords? My concern is that I need to align an image in the X-rays with a HST image...
Carter Rhea
CC BY-SA 4.0
2019-09-05T18:48:38.720Z
@CarterRhea. I am not familiar with Koords. For drizzlepac, it can combine and generate a new image that contains the same information from a set of input images. You can choose the output image to be aligned pixel-by-pixel with respect to a reference image by using a keyword. This still can be done even with only one input image. However, with difference in the plate scale (i.e., arcsec/pix), which sounds likely to be the issue here with images from different facilities, I do not know if drizzlepac would be capable for this task

It would help if you can explain more about what you mean by
Kornpob Bhirombhakdi
CC BY-SA 4.0
2019-09-05T18:52:01.533Z
@CarterRhea. I am starting to feel not sure what you mean by "re-align" here. If you mean something like fixing the astrometry in the header, I would recommend you check out tweakreg package as well.
Kornpob Bhirombhakdi
CC BY-SA 4.0
2019-09-08T19:00:42.700Z
Thank you both very much! I have updated my question to hopefully better explain what it is that I need :)
Carter Rhea
<hubble-telescope><gaia><fits-header><chandra>
Fits file re-alignment
Carter Rhea
# Fits file re-alignment

(Asked by: username_0 on 2019-09-04)

I would like to re-align an image using a reference image (taken from GAIA). I am aware of the software Koords developed by the Karma team: <https://www.atnf.csiro.au/computing/software/karma/>

Unfortunately, the software crashes (with segmentation fault) everytime I try to add a source in either image. Is there a more up-to-date version of this tool? Or simply a different tool?

Update: Thank you for the responses! I will try to better explain exactly what I am trying to do :)

I have an X-ray image taken from Chandra and a GAIA-Aligned HST image. I know that the pointing for the X-ray image is off by ~.5 arcsec or so. I want to re-align the X-ray image so that any X-ray point sources match their optical counter parts using the GAIA-Aligned HST image as my reference. I hope this helps!

**Tags:** hubble-telescope, gaia, fits-header, chandra
> **Comments:**
> **username_1**: Can you tell us some more details about your environment? What machine are you working on? What version of the software are you using? What does the segfault say?  
> **username_2**: Drizzlepac package in python can do that for you.  
> **username_0**: I am not entire sure how to answer the question about my environment... I am using Ubuntu 18.04. As for the software, I am using Karma-1.7.25. I downloaded both the common and amd64 gzip files and followed the instructions for installation that are written in the README file..  The software appears to work OK after reseting my computer HOWEVER I still receive a segmentation fault if I middle click AFTER doing any zooming....  
> **username_0**: @KornpobBhirombhakdi I am familiar with drizzlepac, but I am unaware of its ability to do what I am looking for. If I am not mistaken, drizzlepac will use a source finding algorithm to find point sources in each image and then try to match them automatically. Is there a way to manually choose the point source we want for alignment, like with Koords? My concern is that I need to align an image in the X-rays with a HST image...  
> **username_2**: @CarterRhea. I am not familiar with Koords. For drizzlepac, it can combine and generate a new image that contains the same information from a set of input images. You can choose the output image to be aligned pixel-by-pixel with respect to a reference image by using a keyword. This still can be done even with only one input image. However, with difference in the plate scale (i.e., arcsec/pix), which sounds likely to be the issue here with images from different facilities, I do not know if drizzlepac would be capable for this task  It would help if you can explain more about what you mean by  
> **username_2**: @CarterRhea. I am starting to feel not sure what you mean by "re-align" here. If you mean something like fixing the astrometry in the header, I would recommend you check out tweakreg package as well.  
> **username_0**: Thank you both very much! I have updated my question to hopefully better explain what it is that I need :)  

---

## 1 answers

### Answer by username_0 on 2019-09-17. Score: 4

I ended up making my own small code that you can find here:
<https://github.com/crhea93/AstronomyTools/blob/master/Astrometry/Correction.py>

Essentially, after inputting at least 3 matching target (found by eye in DS9 for example), the program will calculate the mean offset and apply it to the target image. The output is a new fits file of the target image with the proper correction.

> **Comments:**
> **username_2**: Yes, that is one way to go if there is no rotation between images. You might want to add more sources to check if the XY shift is enough for the transformation.  

---

