In this notebook I will import the SDSS image of NGC 450 in the g band and investigate some properties of the object.
TODO: 3D visualisation of flux counts. Compare to Gaussian and Sersic profiles for Galfit value of n. Visualise Galfit fits for one vs two Sersic profiles.
In [41]:
from regphot import git_version
print("This notebook was run with regphot version: \n{}".format(git_version()))
In [42]:
#Import relevant modules
import matplotlib.pyplot as plt
%matplotlib inline
from astropy.io import fits
from astropy.wcs import WCS
from astropy.nddata import Cutout2D
import numpy as np
import aplpy
from regphot import galfit
Import the whole SDSS frame
In [43]:
full = fits.open('frame-g-004858-1-0480.fits')
wcs = WCS('frame-g-004858-1-0480.fits')
apfig = aplpy.FITSFigure(full)
apfig.show_grayscale()
apfig.add_scalebar(0.05, "0.05 degrees", color='white', corner='top right')
apfig.set_theme('publication')
apfig.tick_labels.set_xformat('hh:mm:ss.ssss') #ddd.dddddd')
apfig.tick_labels.set_yformat('dd:mm:ss.ss') #ddd.dddddd')
apfig.ticks.show()
#apfig.ticks.set_xspacing(0.05)
apfig.tick_labels.show()
#apfig.add_grid()
In [54]:
print(len(full[0].data))
y=full[0].data[1210]
x=np.arange(0,len(y),1)
plt.plot(x, y)
plt.xlim([1500,len(y)])
plt.savefig('1dsimple.pdf')
In [45]:
full[0].header
Out[45]:
In [55]:
# from http://stackoverflow.com/questions/7878398/how-to-extract-an-arbitrary-line-of-values-from-a-numpy-array
#-- Extract the line...
# Make a line with "num" points...
x0, y0 = 1650, 1000 # These are in _pixel_ coordinates!!
x1, y1 = 1940, 1440
length = int(np.hypot(x1-x0, y1-y0))
x, y = np.linspace(x0, x1, length), np.linspace(y0, y1, length)
# Extract the values along the line (why seemingly wrong way round?)
zi = full[0].data[y.astype(np.int), x.astype(np.int)]
#-- Plot...
fig = plt.plot(zi)
#plt.show()
plt.savefig('1dblended.pdf')
Show line used to generate 1D flux graph
In [56]:
apfig = aplpy.FITSFigure(full)
apfig.show_grayscale()
apfig.add_scalebar(0.05, "0.05 degrees", color='white', corner='top right')
apfig.set_theme('publication')
apfig.tick_labels.set_xformat('hh:mm:ss.ssss') #ddd.dddddd')
apfig.tick_labels.set_yformat('dd:mm:ss.ss') #ddd.dddddd')
apfig.ticks.show()
#apfig.ticks.set_xspacing(0.05)
apfig.tick_labels.show()
#apfig.add_grid()
ra0, dec0 = wcs.all_pix2world(x0, y0, 0) #, 1500 # These are in _pixel_ coordinates!!
ra1, dec1 = wcs.all_pix2world(x1,y1, 0 )#, 2045
iline = np.array([[ra0, ra1],[dec0,dec1]])
apfig.show_lines([iline], color = 'r')
apfig.savefig('lineonmap.pdf')
In [ ]: