I am following this paper to extract the u,g,r,i,z image frames from the SDSS image fits files. I have the fits files downloaded (using the bulk data download option from SDSS) and tried to run the SWARP tool to get the resampled image as output, which I will access through astropy. I am still unclear on the exact parameters that will make up the entire SWARP command. So far I have:

swarp frame-i.fits[0] frame-r.fits[0] frame-g.fits[0] frame-u.fits[0] frame-z.fits[0] -SUBTRACT_BACK N -RESAMPLE Y -RESAMPLING_TYPE LANCZOS3 -IMAGE_SIZE 64,64 -IMAGEOUT_NAME attempt.fits

This is written with the description of it in the paper, which is:

Description of command from the aforementioned paper

With the command that has been run, I am getting quite noisy images as output that do not relay any sort of information. What am I doing wrong in this process?


1 Answer 1


What they did was the following: for each individual filter, they assembled overlapping frames into a combined, single-filter image. E.g., they combined several g-band images into a single g-band image, combined several r-band images into a single r-band image, etc. (So they ran SWarp five times, once for each filter.) They then put each combined single-filter image into a separate layer to create a five-layer "datacube"; this is their "64x64x5 pixel datacube".

What you are telling SWarp to do is something different: combine five individual-filter images into a single "$u+g+r+i+z$" image. (People do sometimes do this sort of thing, though with SDSS images they would normally just use the g, r, and i images, since the u and z images are so low-S/N that they mainly just add noise to the result. And in any case this isn't what the paper you're interested in was doing.)

  • $\begingroup$ Thanks for the clarification. I understand that the command that I've entered will not give me what I want. However, I'm new to this and have been using SWARP in many different combinations. I've also tried swarp frame-z.fits[0] -SUBTRACT_BACK N -RESAMPLE Y -RESAMPLING_TYPE LANCZOS3 -IMAGE_SIZE 64,64. It does not give the expected result when extracted through astropy, please view here. Would you know why? Thanks once again. $\endgroup$
    – Hiba Jamal
    Oct 26, 2020 at 10:53
  • 1
    $\begingroup$ The following Python code snippet should work with SDSS images. It computes the same rotation angle as the "north" task from the IRAF STSDAS package, which is the angle of the image +y axis in degrees CCW from N. (If you display the image in SAOImage DS9, the inset "panner" display near the top helpfully shows both x-y and N-E axes on top of the image, which may make it easier to understand the rotation.) $\endgroup$ Nov 11, 2020 at 11:42
  • 1
    $\begingroup$ hdr = astropy.io.fits.getheader("/path/to/image.fits") $\endgroup$ Nov 11, 2020 at 11:42
  • 1
    $\begingroup$ cd1_1,cd1_2,cd2_1,cd2_2 = hdr['CD1_1'],hdr['CD1_2'],hdr['CD2_1'],hdr['CD2_2'] $\endgroup$ Nov 11, 2020 at 11:45
  • 1
    $\begingroup$ rot = math.degrees(math.atan2(math.radians(cd2_1), math.radians(cd1_1))) $\endgroup$ Nov 11, 2020 at 11:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .