I wanted to get the sky value estimates from SDSS fits headers (fpC). There were 939 of them. It was amusing to see how many SDSS images of large galaxies didn't have the sky estimated -- should probably look at why that was the case.
I remember writing something similar before, but it was easier to quickly script it.
#a rough excerpt from ellipse_photometry module.
#loops through filenames, extracts fits header keyword values.
sky = np.empty((939, 2))
for i in range(0, 939):
try:
fileName = GalaxyParameters.getSDSSUrl(listFile, dataDir, i)
head = pyfits.open(fileName)[0].header
sky[i:, 0] = i+1
sky[i:, 1] = head['SKY']
print head['SKY']
except IOError as e:
sky[i:, 0] = i+1
sky[i:, 1] = 0
pass
except KeyError as err:
sky[i:, 0] = i+1
sky[i:, 1] = -1
pass
np.savetxt('SDSS_skies.txt', sky, fmt = ['%i', '%10.5f'])
No comments:
Post a Comment