Galphot is a surface photometry tool, which fits ellipses to isophotes in galaxy profiles. It was written by Marijn Franx and is available for download from his http://www.strw.leidenuniv.nl/ franx/galphot/website. The version on his website only works by using IRAF; for Astro-WISE a number of changes were done to make it work outside of IRAF.
The main classes in the Galphot object model for Astro-WISE (i.e. those classes that are stored in the database, and must be queried on to get results) are these:
Each GalPhotModel is identified by a unique number (GPID). This also connects the GalPhotEllipses to the GalPhotModel they belong to.
GalPhotModels are made based on SourceLists, so in order to run Galphot within Astro-WISE one first has to make a SourceList and determine which source one wants to model with Galphot. This source is then identified with the identifier combination SLID, SID, which uniquely defines one source in a SourceList.
First we must decide which source to run galphot on. This means either making a new SourceList (running Sextractor) or querying existing SourceLists. How to make SourceLists is described in the SourceList /portal/howtos/man_howto_sourcelists/man_howto_sourcelists.shtmlHOW-TO For now we assume you know which SourceList you have made, and now want to find the SIDs of suitable galaxies.
# Query for SourceList with identifier 57424 sl = (SourceList.SLID == 57424)[0] # This will be the output dictionary d = {'SID':[], 'MAG_ISO':[], 'A':[], 'B':[], 'E_WCS':[]} # Do a query to find bright galaxy-like objects r = sl.sources.sql_query(d, '"MAG_ISO"<20.0 AND "E_WCS"<0.5')
At this point ``d'' contains the list of identifiers, magnitudes and A, B of the sources in the SourceList that matched the query. The list ``d['SID']'' can be given as the ``sids'' argument to the GalPhotTask (see the next section).
Here is how to create a GalPhotModel for the sourcelist with ID 57424 and source with ID 71 within it:
task = GalPhotTask(instrument='WFI', slid=57424, sids=[71], commit=1) task.execute()or equivalently using the DPU:
dpu.run('GalPhot', i='WFI', slid=57424, sids=[71], C=1)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Galphot can be configured with the Pars class as conventional in Astro-WISE :
p = Pars(GalPhotModel) p.show()this results in a list of configurable parameters (see table ), now set one of them:
p.GalPhotModel.process_params.r1 = 10.0Feed the configuration to the task using the ``get()'' method of Pars:
task = GalPhotTask(instrument='WFI', slid=57424, sids=[71], pars=p.get(), commit=1) task.execute()The process parameter dictionary can also be specified by hand directly:
d = {'GalPhotModel.process_params.r1': 10.0, 'GalPhotModel.process_params.r2': 20.0} task = GalPhotTask(instrument='WFI', slid=57424, sids=[71], pars=d, commit=1) task.execute()
The following pixels/sources may be masked:
The GalPhotTask can be given a list of mask file filenames. This only works when working locally; no files are uploaded to the DPU. See below.
This is controlled with the process parameters ``mask_type'' and ``mask_scale''. See below.
The automatic masking process is controlled by the following process parameters:
A mask file (".del" file, in galphot convention) can be created by the user. This text file contains lines of either 3 or 4 numbers, describing circles and rectangles respectively. Example:
25 28 10 # Describes a circle at position (25,28) with radius 10 pixels. 20 30 35 45 # Describes the rectangle [20:30, 35:45]Note that the pixel coordinates are in the coordinate frame of the original image, rather than the cutout region. If such a file is created it can be specified when running the task:
task = GalPhotTask(instrument='WFI', slid=155211, sids=[17044], mask_files=['masks.txt'], commit=0)If a mask file is specified, one must be given for each SID specified in the ``sids'' list.
It is possible to use an existing GalPhotModel as input, i.e. as an ``intable'', in the Galphot configuration. This is done by specifying the existing GalPhotModel's GPID in the ``gpid_in'' option of the task:
task = GalPhotTask(instrument='WFI', slid=57424, sids=[71], gpid_in=6721, commit=1) task.execute()or equivalently in the dpu call:
dpu.run('GalPhot', i='WFI', slid=57424, sids=[71], gpid_in=6721, C=1)
The GalPhotList class is intended as a simple way to group GalPhotModels (and GalPhotEllipses). The way to use this class is to create it first, and only then run Galphot. I.e. first create and commit a GalPhotList, and then specify its GalPhotList identifier GPLID when running the GalPhot task on the DPU or locally:
# Create the GalPhotList object l = GalPhotList() l.name = 'test-run-1' l.make() l.commit() # [schmidt] 16:27:12 - Set GalPhotList identifier GPLID to 100231 # Refer to the GalPhotList object by specifying its GPLID, as reported # after committing the GalPhotList (see above). dpu.run('GalPhot', i='WFI', slid=75637, sids=range(10,20), gplid=100231, C=1)Now it is easy to query on the group of GalPhotModels you called "test-run-1" and inspect their residual images:
query = GalPhotModel.GPLID == 100211 for model in query: model.get_residual()This will create all residual images, which can then be inspected with a FITS viewer.
When you have made a GalPhotModel, the ellipse parameters are stored in the database as a list of GalPhotEllipse objects, and the residual image is stored on a dataserver. How does one get to this information?
# Query for GalPhotModel based on its GPID q = GalPhotModel.GPID == 20 model = q[0] # Query for GalPhotModel based on SLID/SID q = (GalPhotModel.SLID == 57424) & (GalPhotModel.SID == 71) model = q.max('GPID') # Find all GalPhotEllipses (radii) for the source defined by SLID=57424 and # SID=71, for which the fitted intensity is larger than 50000 (ADU) q = (GalPhotEllipse.SLID == 57424) & (GalPhotEllipse.SID == 71) &\ (GalPhotEllipse.i > 50000) GPIDs = [ellipse.GPID for ellipse in q] gpids = [] for gpid in GPIDs: if not gpid in gpids: gpids.append(gpid) models = [] for gpid in gpids: m = (GalPhotModel.GPID == gpid)[0] models.append(m) # Now we can have a look at the residual images: for m in models: m.retrieve() m.display() # And plot ellipse parameters against eachother: for m in models: x = [ellipse.i for ellipse in m.ellipses] y = [ellipse.r for ellipse in m.ellipses] pylab.scatter(x,y)
parameter | description | unit | |
r, dr | The root of the product of the major and minor axis of the ellipse | pixel | |
i, di | Intensity at the ellipse | counts/pixel2
|
|
s, ds | The slope of the intensity, the derivative of i wrt r | None | |
x, dx | Central x position in the region | pixel | |
x_orig | Central x position in the original image | pixel | |
y, dy | Central y position in the region | pixel | |
y_orig | Central y position in the original image | pixel | |
eps, deps | The ellipticity of the ellipse, 1-b/a | None | |
pos, dpos | The position angle of the ellipse, measured with respect to the | None | |
axis y=0, counter clockwise | |||
c1, c2, ..., c6 | The cos(n*theta) term of the residuals along the ellipse | None | |
dc1, dc2, ..., dc6 | Errors in c1, c2, ..., c6 | None | |
s1, s2, ..., s6 | The sin(n*theta) term of the residuals along the ellipse | None | |
ds1, ds2, ..., ds6 | Errors in ds1, ds2, ..., ds6 | None | |
f1, f2, f3, f4 | Flag? | None |
Downloads the model image and returns it as a BaseFrame object.
Creates the residual image and returns it as a BaseFrame object.
Extracts and downloads the region in the science image for which the model was derived, and returns it as a BaseFrame object.
Extracts and downloads the region in the weight image for which the model was derived and returns it as a BaseFrame object.
Display a list of all ellipse parameters.
Returns a list of dictionaries of all ellipse parameters. I.e. each item of the list is a dictionary which contains the description of one ellipse. See table for a description of the parameters.