the availability of efficient imagers , operating with good imaging quality over a large range of wavelengths , has opened a new era in astronomy .multi - wavelength imaging surveys have been executed or planned , and are providing major breakthroughs in many fields of modern astronomy .these surveys often collect images of different quality and depth , typically resulting from the combined effort of ground and space based facilities . in this context , the difficulties originating in the analysis of these often inhomogeneous imaging databases have hampered the proper exploitation of these data sets , especially in the field of faint , high redshift galaxies .  on the one side , images at varying wavelengthsmay provide a surprisingly different glimpse of the universe , with objects fading or emerging from the background . on the other side ,the image resolution is usually not constant over the wavelengths , due to different instrument characteristics .a typical case is the combination of high resolution hst images with lower resolution images obtained by ground based telescopes or by the spitzer space telescope . in the latter case ,the blending among the objects in the lower resolution images often prevents a full exploitation of the multicolour informations contained in the data .the difficulties involved in the analysis of this kind of data has led to the development of several techniques .the first emphasis was based on refinements of the usual detection algorithms .the algorithm here discussed , that is designed to work especially for faint galaxies , allows instead to accurately measure colours in relatively crowded fields , making full use of the spatial and morphological information contained in the highest quality images .this approach has already been proposed and used in previous works : here , we discuss a specific implementation of the software code , named convphot , that we developed and make publicly available to analyse data with inhomogeneous image quality .although we focus in the following on multi - wavelength observations , i.e. the case where different images of the same portion of sky are available in different bands , the approach followed here can be adopted also for variability studies , where images in the same band but taken at different epochs are used . in this case, the highest quality image can be used to identify the objects , and the magnitude variations of all the objects can be measured with no systematic effects .the plan of the paper is the following : in sect .2 , we outline the technique adopted ; in sect .3 , we discuss more exhaustively the algorithm , of which we provide more details .we also describe the problematics involving the determination of the isophotal area and the optimisations we adopted . in sect .4 we comment on possible issues of convphot , taking into account the cases of blended sources in the _ detection _ image . in sect .5 we describe the systematics that may be cause of inappropriate results from the algorithm . in sect . 6 , we discuss the validation tests that we performed on simulated as well as on real images , discussing in particular the usage of this software and the future prospects for improving convphot .a brief summary and conclusions of the paper are given in sect .the technique that we discuss here has been described and adopted for the first time by the stony - brook group to optimise the analysis of the , and images of the hubble deep field north ( hdf - n ) .the method is described in fernandez soto et al . ( 1999 , hereafter fsly99 ) and the catalog obtained has been used in several scientific analysis of the hdf - n , both by the stony - brook group , as well as by other groups , including our own . the same method has been adopted by , to deal with the similar problems existing in the hdfs data set and , recently , to derive a photometric catalog of the goods fields in the 24 micron band of mips ( psf is 5 arcseconds ) using the 3.6 micron band of irac ( 1.6 arcsec of resolution ) to deblend the mips sources .although in both these cases the method has been applied to the combination between hst and ground based , near ir data , the procedure is much more general and can be applied to any combination of data sets , provided that the following assumptions are satisfied : + _ 1 . _a high resolution image ( hereafter named _ `` detection image '' _ ) is available , that is used to detect objects and isolate their area ; this image should be deep enough to allow all the sources in the _`` measure image '' _ to be detected .ideally , such image should be well sampled and allow a proper resolution for most sources .colours ( or temporal variations ) are to be measured in a lower resolution image ( hereafter named _`` measure image '' _ ) ; + _ 3 . _the psf is accurately estimated in both images , and a convolution kernel has been obtained to smooth the _`` detection image '' _ to the psf of the _ `` measure image''_.  conceptually , the method is quite straightforward , and can be better understood by looking at fig .[ conv ] . in the upper panel ,we plot the case of two objects that are clearly detected in the _`` detection image '' _ , but severely blended in the _`` measure '' _ one .the technique described here can remind that adopted by dophot , a software for psf fitting in crowded stellar fields .there are otherwise some differences , since convphot is thought especially for galaxies or extended objects in general , and the minimisation of the model image to the measure image is done simultaneously , reducing the possibility of wrong fits in severely blended objects , an usual fact when the fit is carried out into different steps .indeed , the convphot software needs a model of the convolution kernel in input , while in dophot the psf is fitted analytically .the procedure followed by convphot consists of the following steps : + _ a ) _ object identification is done relying the parameters and area obtained by a sextractor run on the _ `` detection image '' _ : in practice , we use the `` segmentation '' image produced by sextractor , that is obtained from the isophotal area .we extract small images centered around each object , on which all the subsequent operations will be performed . such small images ( dynamically stored in the computer s memory )are named `` thumbnails '' in the following .details are described in section 3.1 , including the treatment of border effects .+ _ b ) _ since the isophotal area is typically an underestimate of the actual object size , such that a fraction of the object flux is lost in the tails outside the contour of the last isophote , we have developed a specific software ( named dilate ) to expand the sextractor area of an amount proportional to the object size .this procedure is described in section 3.2 + _c ) _ another required input is a convolution kernel that converts the detection image to the same resolution of the _ `` measure '' _ image .although this is not provided within convphot , a short description of the requirements and possible methods is given in section 3.3 ._ d ) _ the background of each object ( both in the _ `` detection '' _ and in the _`` measure '' _ images ) is computed , as described in section 3.4 ;  _ e ) _ each object , along with its segmentation image , is ( individually ) smoothed , and then normalised to unit total flux : we refer to it as the `` model profiles '' of the objects , as it represents the expected shape of the object in the _`` measure '' _ image ( section 3.5 ) .f ) _ finally , the intensity of all `` model '' objects are simultaneously adjusted in order to match the intensity of the objects in the _`` measure '' _ image .this global minimisation provides the final normalisation ( i.e. intensity ) of each object in the `` model '' image , and hence the fundamental output of convphot .this is described in section 3.6  in this scaling procedure there are as many free parameters ( that we named , the fitted flux of the -th galaxy ) as the number of objects in the detection image , that are typically thousands .the free parameters are computed with a minimisation over all the pixels of the images , and all objects are fitted simultaneously to take into account the effects of blending between nearby objects .conceptually , this approach is somewhat similar to the line fitting of complex absorption metal systems in high redshift quasars .although in practical cases the number of free parameters can be quite large , the resulting linear system is very sparse ( fsly99 ) , since non null terms represent only the rare overlapping / blended sources , and the minimisation can be performed in a quite efficient way by using standard numerical techniques .minimisation over the object areas.,width=453 ]  as can be appreciated from the example plotted in fig .[ conv ] , the main advantage of the method is that it relies on the accurate spatial and morphological information contained in the `` detection '' image to measure colours in relatively crowded fields , even in the case that the colours of blended objects are markedly different .still , the method relies on a few assumptions that must be well understood and taken into account .first of all , it is assumed that the objects have no measurable proper motion .this is not a particular concern in small , deep extragalactic fields like hdf or goods , but might be important in other applications .a more general concern is that morphology and positions of the objects should not change significantly between the two bandwidths .also , the depth and central bandpass of the _ `` detection '' _ image must ensure that most of the objects detected in the _`` measure '' _ image are contained in the input catalog .finally , the objects should be well separated on the detection image , although they may be blended in the measure image .  in practice , it is unlikely that all these conditions are satisfied in real cases . in the case of the match between acs and ground based images , for instance, very red objects may be detected in the band with no counterpart in the optical images , and some morphological change is expected due to the increasing contribution of the bulge in the near ir bands .this mis - match may be particularly significant for high redshift sources , where the knots of star formation in the uv rest frame are redshifted to the optical wavelengths used as model images . also , in the case that the pixel - size of the _ `` measure '' _ image ( i.e. isaac or vimos ) is much larger than that of the _ `` input '' _ one ( acs for example ) , the actual limitations due to intrinsic inaccuracy in image aligning may lead to systematic errors .we will show below that these effects may be minimised or corrected with reasonable accuracy : at this purpose , we have included in the code several options and fine tuning parameters to minimise the systematics involved .in this paragraph , we illustrate in detail the algorithm adopted for the convphot software .particular emphasis is given to resolve critical issues in this profile matching algorithm , such as a correct estimation of the background , an unbiased reproduction of the object profile and a fast and robust minimisation technique .we analyse in detail these critical points .as mentioned above , convphot relies on the output of the popular sextractor code to detect and deblend the objects and to define the object position and main morphological parameters in the _ detection _ image . in the following, we shall also use the sextractor naming convention to specify several image characteristics .we remind that a `` segmentation '' image is an image where background is set to 0 and all the pixels assigned to a given objects are filled with the catalog number of the object .the user must first obtain a reliable sextractor catalog of the _ detection _ image prior to running convphot . in practice , the required output from sextractor consists of the segmentation image and of a catalog with the center and boundary coordinates of the objects in pixel units and the value of the background , as shown in tab .[ inputcat ] .in addition to this , the user must provide the _ detection _ image and the _ measure _ with its map_rms , i.e. an image containing the absolute r.m.s . of the _ measure _image , in the same units .it is important to remind that the _ measure _ image may be shifted and/or have a different size with respect to the _ detection _ one : it is only required that the images are aligned ( i.e. have been rebinned to the same pixel size and be astrometrically registered ; for problems related to the rebinning of the _ measure _ image see sect .this offsetting option may be useful when dealing with the follow up of large mosaics ( i.e. goods , cosmos ) .[ offset ] shows the case of a _ measure _ image having a different size and shifted respect to the _ detection _ one . in this case , the relative offset ( in pixels ) between the two images must be provided by the input parameters cphxoff and cphyoff .the _ measure _ image and its rms must have the same size .as shown in fig . [ offset ] , convphot works on objects whose segmentation lies in the overlapping region between the detection and the measure image . in the _ detection _image , objects which partly lie inside the overlap region are flagged as _ bound_ and will be processed only if the fraction between the flux inside the overlap region and the total flux in the _ detection _ image is equal or larger than a user - defined parameter .  [ cols="^,^,^,^,^,^,^,^,^",options="header " , ]   number is the identification number of the source in the segmentation image created by sextractor , x , y , xmin , xmax , ymin , ymax are the center and boundary coordinates of the objects ( in sextractor they are indicated as x_image , y_image , xmin_image , xmax_image , ymin_image , ymax_image , respectively ) .back_d is the value of the background for the detection image , while back_m is the background for the measure image .it is possible to provide every object with its local background estimate , for example that produced by sextractor .this example is taken from the goods - music catalog produced using the band provided by acs in the goods south field .the `` object segmentation '' defines the area ( i.e. the set of pixels ) over which each object is distributed .this area , which is different in the _ measure _ and in the _ detection _ image because of the typical different image quality ( psf ) , is used to extract the object profile in the _ detection _ image and to define the fitting region in the _ measure _ one .  to establish the area of each object in the _ detection _ image , convphot relies on the `` segmentation '' image produced by sextractor . in this image ,each pixel contained within the isophotal area of an object is filled with the relevant object i d , and can be used to reconstruct the shape of the object itself .this estimate , however , is not very robust since the size of the isophotal area depends on the isophotal threshold adopted in the _ detection _ image , and in any case misses a significant fraction of the flux of faint objects .this effect is particularly dramatic as the galaxy becomes either very faint or very large , as in space based images like those provided by hst ( wfpc2 , acs ) , with resulting low surface brightness of the external pixels . to overcome this problem ,we have developed and distributed a dedicated software ( named dilate ) , that expand the segmentation produced by sextractor , though preventing merging between neighbouring objects and preserving the original shape of the segmentation .the segmentation of each object is individually smoothed with an adaptive kernel which preserves its shape and is then renormalised to the original number value .this software allows to fix the dilate factor for the magnification of the segmentation , that is defined as the ratio between the output and input isophotal area .while this procedure is useful for relatively bright objects , of which the increase of size is doubled for an , it provides too small an enlargement for the faintest objects , that are often detected over very few pixels ( this is particularly true in the case of faint small galaxies observed with hst , as in the case of the goods data ) . at this purpose , we allow to define a minimum area for the segmentation , such that objects smaller than this area ( even after dilation ) are forced to have this area .a minimum value for the area of extended segmentation is useful , for instance , in the acs images , where extended but low surface brightness objects are detected by sextractor only due to the bright nucleus and their isophotal area is limited only to the brighter knots .these values should be tuned accurately , because too small values for or may cause a distortion of the profile for the detection image , which alters the photometry in the measure image , while too large values for or are not useful since enhance the noise in the model profile .typical values for are 3 - 4 , in order to double the area of the original segmentation image . the parameter is set in order to match 2 - 3 times the typical size of galaxies in the field : for deep imaging surveys with hst , faint galaxies have an half light radius of arcsec , which translates to a minimum area of around 800 pixels , if the pixel scale of acs ( 0.03 arcsec ) is used .moreover , convphot also compute the so - called `` detection magnitude '' , that is the magnitude of the object in the _ detection _image for the dilated segmentation .this quantity should be compared with the total detection magnitude of the input catalog in order to correct the model magnitude for the fraction of flux missed by the limited segmentation .in addition , the possibility of restricting the fit to the central region of the objects ( as described in sect 3.5 ) further suppresses the effects of tails in the fit itself .a key process within convphot is the smoothing of the `` _ detection _ '' high resolution image to the psf of the lower resolution `` _ measure _ '' one .the original feature of the method is that this step is not performed on the global image , but rather on each individual object , after it has been extracted from the `` _ detection _ ''image , in order to prevent the confusion to to blending in low resolution images .such a smoothing is performed by applying a convolution kernel , that is the filter required to transform the psf of the detection image into the psf of the `` _ measure _ '' image .filtering is performed on the thumbnails of the extracted objects , as well as on the corresponding segmentation and auxiliary images , whenever required .the derivation of the convolution kernel is not done by convphot and must be provided by the users .several techniques have been developed to derive an accurate convolution kernel , in particular those by and , and we advice to use such sophisticated techniques whenever possible .  in the case of the goods music sample , where we had to obtain more than 70 independent kernels ( one for each original image of the j , h and k mosaics ) , we have adopted a simpler method , based on analysis in the the fourier space .such method can be implemented and automatized with standard astronomical tools for image analysis .we summarise here the basic recipe to compute it .first of all , we derive the psf of the detection and measure image , and respectively , e.g. by summing up several stars in the field , in order to gain in signal to noise ratio .these two psfs must be normalised , in order to have total flux equal to unity .the convolution kernel k is , by definition ,   the derivation of the exact shape of the convolution kernel is done in the fourier space : taking , and , the fourier transform of the kernel is given by : an optimal wiener filter ( low passband filter ) , which suppresses the high frequency fluctuations , must be applied in the fourier domain to remove the effects of noise .the aim of this filtering is to remove the large frequency fluctuations due to noise in the two psfs or with scales less than the pixel scales of the input images . in order to check for the validity of the used filter ,a residual is computed from the two psfs and this must be consistent with the rms of the coadded psfs .  finally , must be anti - transformed back to the pixel space and the resulting kernel must be normalised to unity , in order to preserve the flux of the objects .the estimation of an accurate background is essential to determine the magnitude of faint sources . at this purpose ,we have decided to adhere as much as possible to the sextractor algorithms to compute the background of each object , and implemented several options to deal with this task .in particular , both for the _ detection _ and the _ measure _ image , the user can select one of these three options : + _ a ) _ use as input a background subtracted image , therefore relying on other applications ( such as sextractor itself ) to compute the background .this option saves computing time and can be adopted when the background is quite homogeneous .b ) _ use the background value computed for each object by sextractor , as stored in the input catalog ( see tab .[ inputcat ] ) .c ) _ compute the background within convphot : in this case , the background is computed in a `` rectangular annulus '' around the object , of size set by the user .nearby objects are masked out using the dilated ( see section 3.2 ) segmentation map ( fig . [ background ] ) .  as a background estimator , in the option c ) , we follow the sextractor approach : first , the program compute the mean and median of the background pixels with an iterative method , until it reaches a convergence at 3 , then compute the mode as and recompute the rms of the background using the mode .if this rms is changed by more than 20% from the previous clipped - rms , the mean is taken as best estimate for the background , otherwise convphot uses the mode .a detailed explanation of this approach can be found in bertin & arnouts ( 1996 ) .the overall process is described in fig.[background ] .the process is essential in rejecting pixels of possible sources not detected in the detection image but bright in the measure frame . at this purpose ,the number of pixels used to compute the background should be larger than a user supplied value , the size of the `` rectangular annulus '' . thus , the background estimation made by convphot is time consuming since the thumbnails must be much larger than the typical size of the segmentation for the objects .convphot creates a _ model profile _ of each object , whose segmentation lies inside the overlap region , to measure the colour of the object itself . in the procedure ,depicted in fig .[ thumbnail ] , the ( dilated ) segmentation of the object is extracted from the _ segmentation _ image and stored in a thumbnail . the value of the pixels relative to the given object are set to 1 while the pixels of other objects and of the background are masked setting them to 0 . using this masked segmentation , that defines the isophotal area ,the object is extracted from the _ detection _ image and its background , provided by the input catalog or estimated by convphot itself as described above , is subtracted producing the _ object profile _ which is stored in a new thumbnail and smoothed to the seeing of the _ measure _ image with the psf matching kernel . if the object is flagged as _ bound _ the total flux is computed and the thumbnail is resized extracting only the pixels inside the overlap region ( fig .[ offset ] ) .then , the thumbnail isoarea and total flux are computed from the _ detection _ image . for a bound object, convphot estimates the fraction of total flux inside the overlap region and if this value is less than ( by default 0.4 ) , it rejects the object .finally , the thumbnail is normalised to unit flux obtaining the _ model profile _ of the object . the total flux will be used later to obtain self consistent colours .  for the reasons described below, it may be useful to perform the fitting procedure only on the central part of the profile : at this purpose , we have introduced the threshold parameter , such that only the pixels above the relative threshold are used , where is the _ model profile _ maximum .finally , convphot uses the isophotal area of the _ ( selected ) model profile _ to extract the same object from the _ measure _ image subtracting its local background and producing a _ measure _ thumbnail with the corresponding rms thumbnail .we now describe the minimisation process , making explicit use of the same notation adopted in fsly99 .given the _ model profiles _( the _ selected model profiles _ if the threshold has been used ) of each object , the minimisation procedure aims at obtaining the scaling factors ( i.e. the fitted flux of the object in the measure image assuming as object profile the model image ) of each object that best reproduce the _ measure _image .the best fit solution will be found by minimising the , that reads : ^ 2\ ] ] where is the sum of all profiles , is the background ( in the _ measure _ image ) fitted for each objects , is the r.m.s . of the _ measure _ image and and over all the pixels .fit solution is found by solving the linear system :    whose hessian matrix is    and right hand term is :   } { \sigma(m , n)^2}.\ ] ]  since the products of the model profiles are non zero only within the area provided by the ( dilated ) segmentation map , most of the terms are actually null ( non null terms will correspond to overlapping objects ) , such that the matrix is very sparse .the solution of linear systems is performed by an lu decomposition using the _ gnu scientific library ( gsl ) _ and its _ lapack _ routines ( anderson et al .1999 ) , such that the solution can be obtained even for a large number of free parameters ( that is , of detected objects ) that typically occur in deep hst exposures ( i.e. udf , goods or cosmos surveys ) .  finally , the statistical uncertainties on the fitted parameters are the diagonal terms of the inverse of the hessian matrix , which depend on the rms of the measure image and on the model profile . in a sense , this fitting procedure is equivalent to derive a profile - weighted flux and error , relying on the model image .     convphot produces in output several quantities , including parameters for each object as well as several type of images .the most important output quantities are the best fit solutions of the minimisation procedure , i.e. the parameters and their relative errors . since the model for each object is normalised to unit flux , the resulting total magnitude in the _ measure _ image is simply , where is the zero - point of the _ measure _ image itself . based on our tests ,we have concluded that this total magnitude is a reliable measure of the actual total flux of the objects , somewhat less prone to systematic effects than the kron magnitudes computed by sextractor .however , these total magnitudes can be hardly compared with the sextractor magnitudes of the _ detection _ image , so that reliable colours can not be directly obtained . a robust colour estimation , indeed ,should be carried out on a _ same _ area of the object and possibly be extended to a large region of the source , in order not to be biased by red nuclei ( typical of bulges or elliptical galaxies ) or by strong colour gradients , especially in the rest frame uv wavelengths .at this purpose , we use the total flux measured by convphot itself in the _ detection _ image as a good estimate for the flux of the detected object , and used it to normalise the object profile .the resulting flux ratio is therefore , where and are the zero - points of the _ detection _ and _ measure _ image , respectively .this flux ratio , or the equivalent colour , is the fundamental output of convphot .these useful quantities are saved in the convphot output files , as well as the background estimations , the area used during the fitting procedure , the goodness of the fit and the residuals left in the _ measure _ image .in addition , convphot produces useful output images , such as the model image with each object scaled to the fitted flux . in particular, we produce a `` residual '' image , containing the fit residuals , i.e. the quantity .this image is useful to judge the quality of the fit and the background estimation .since large residuals could typically occur in the center of bright objects , this image is not very useful to perform an automated search of objects that are detected only in the _ measure _ image but are not present in the detection image ( called `` dropout '' ) . at this purpose, convphot also produces a `` drop '' image , where all the pixels within the ( dilated ) segmentation are set equal to zero .the example in fig .[ dropimage ] is taken from the k band image of the goods south field , where a galaxy remains in the `` drop '' image after the fitting of objects selected in the band of acs .the convphot algorithm is ideally suited for photometry of blended objects on the _ measure _ image , but requires that the same objects in the _ detection _image should be well defined and their profiles are not distorted by noise . in the practical case , even in the goods - acs images , there are galaxies blended in the acs images or faint objects , brighter than the detection limit but still affected by noise in their shape / profile . to overcome the risk of bad modelling for these sources , we introduce in convphot an option to carry out the fitting procedure only on the central part of the profile : the fit is restricted only to the pixels where the detection image is above a given relative threshold .this ensures that the fit is carried out only where the signal to noise of the model ( _ detection _ image ) is high and avoids the contamination from nearby sources , which can not be perfectly modelled in the detection image .the effects of source blending on the _ detection _ image is investigated by means of simulations .fig.[blend_normal1 ] and fig.[blend_normal2 ] reproduce two elliptical galaxies ( with half light radius of 0.3 arcsec and ellipticity 0.5 ) with different angular separations ( between 0.5 and 2.0 arcsec ) and show the difference between the input colour and the output of convphot , .the characteristics of the _ detection _ image reproduces the band of acs for the goods south field ( fwhm=0.12 arcsec , pixel scale=0.03 arcsec ) , while the _ measure _ image fits the isaac band ( fwhm=0.5 arcsec and pixel scale of 0.03 arcsec to match the acs frame ) .the rms is chosen equal to the typical value of goods band images ( the is 0.0014 adu ) , both for the _ detection _ and the _ measure _ images and is added to the synthetic frames with the iraf task mknoise .the two galaxies are relatively bright in the band ( magnitude 21 and 24 in the ab photometric system ) , and have colours typical of local ellipticals ( and 2 ) .we simulate 10 pairs of galaxies for each angular separation in order to have enough statistics in the output quantities .the colour of the brighter source is recovered within few millimag even if the two sources started to be blended in the detection image .the magnitude of the fainter galaxy , however , is affected by light coming from the bright neighbour , which produce a difference in colour at small angular separations ( ) .fig.[blend_eros1 ] and fig.[blend_eros2 ] , indeed , describe the effects of blending in an extreme case , where the fainter galaxy in the detection image has a colour equal to 5 , typical of an extremely red object ( ero ) , which reproduces the typical colours of ellipticals at intermediate redshifts . in this critical situation , the difference between the simulated and convphot colour is 0.15 - 0.2 at a separation of 0.5 arcsec , and the fitting procedure left visible residuals . it is important to remark that the fit remains accurate as long as the two objects are separated in the _ detection _ image ( i.e. for distances larger than 1.0 arcsec ) , although they are already blended in the _ measure _ image .as the sources become deeply blended in the_detection _ image , with distance less than 1.0 arcsec , a non - negligible contamination starts to appear .not surprisingly , such contamination is larger for the bluer and fainter ( in ks ) galaxy . fortunately , this situation is not common even in large and deep areas like the goods survey , and even for faint objects in the detection image the magnitude in the measure imageis recovered with acceptable accuracy .we have to stress that in this case the parameters of the dilate and convphot softwares ( dilation factor , minimum area , threshold , background annulus ) are not optimised for this special case but are the standard values used for all the simulations in this paper .arcsec are simulated as a function of the angular separations in order to study the combined effect of blending and colours .one object is a relatively bright , blue galaxy ( , ) , the second is a fainter , slightly redder galaxy ( , ) .the detection image has the pixelscale and noise properties of the acs goods images ( seeing=0.12 , pixel scale=0.03 arcsec ) , while the _ measure _ image reproduces the typical properties of a ks band image of the goods data set , with a fwhm seeing of 0.5 arcsec . for each separation we computed 10 different realization of the galaxy pairs .in the upper panel , bi - dimensional images of the galaxies with a separation of 0.5 arcseconds ( two leftmost images ) and 2.0 arcseconds ( two rightmost images ) are shown . in both cases ,the first ( left ) thumbnail is the band , while the second is the ks band . in the lower panels we plot the difference between the input and derived colours ( ) for faint and bright sources as a function of the angular separation .even when the sources are deeply blended , the error on the estimated colour for the fainter galaxy remains acceptable ( mags ) ., title="fig:",width=226 ]  arcsec are simulated as a function of the angular separations in order to study the combined effect of blending and colours .one object is a relatively bright , blue galaxy ( , ) , the second is a fainter , slightly redder galaxy ( , ) .the detection image has the pixelscale and noise properties of the acs goods images ( seeing=0.12 , pixel scale=0.03 arcsec ) , while the _ measure _ image reproduces the typical properties of a ks band image of the goods data set , with a fwhm seeing of 0.5 arcsec . for each separationwe computed 10 different realization of the galaxy pairs . in the upper panel ,bi - dimensional images of the galaxies with a separation of 0.5 arcseconds ( two leftmost images ) and 2.0 arcseconds ( two rightmost images ) are shown .in both cases , the first ( left ) thumbnail is the band , while the second is the ks band . in the lower panels we plot the difference between the input and derived colours ( ) for faint and bright sources as a function of the angular separation .even when the sources are deeply blended , the error on the estimated colour for the fainter galaxy remains acceptable ( mags ) ., title="fig:",width=226 ]  arcsec are simulated as a function of the angular separations in order to study the combined effect of blending and colours .one object is a relatively bright , blue galaxy ( , ) , the second is a fainter , slightly redder galaxy ( , ) .the detection image has the pixelscale and noise properties of the acs goods images ( seeing=0.12 , pixel scale=0.03 arcsec ) , while the _ measure _ image reproduces the typical properties of a ks band image of the goods data set , with a fwhm seeing of 0.5 arcsec . for each separation we computed 10 different realization of the galaxy pairs .in the upper panel , bi - dimensional images of the galaxies with a separation of 0.5 arcseconds ( two leftmost images ) and 2.0 arcseconds ( two rightmost images ) are shown . in both cases ,the first ( left ) thumbnail is the band , while the second is the ks band . in the lower panels we plot the difference between the input and derived colours ( ) for faint and bright sources as a function of the angular separation .even when the sources are deeply blended , the error on the estimated colour for the fainter galaxy remains acceptable ( mags ) . , title="fig:",width=453 ]  , two elliptical galaxies with arcsec are simulated as a function of the angular separations in order to study the combined effect of blending and colours . at variance with fig.[blend_normal1 ] , colours are so extreme here that the object that is fainter in the _ detection _ image is indeed brighter in the _ measure _ one . specifically , one is a relatively faint , blue galaxy ( , ) , the second is a fainter but much redder galaxy ( , ) , in order to simulate an extremely red object . _the detection _image has the pixelscale and noise properties of the acs goods images ( seeing=0.12 , pixel scale=0.03 arcsec ) , while the _ measure _ image reproduces the typical properties of a ks band image of the goods data set , with a fwhm seeing of 0.5 arcsec .for each separation we computed 10 different realization of the galaxy pairs .in the upper panel , bi - dimensional images of the galaxies with a separation of 0.5 arcseconds ( two leftmost images ) and 2.0 arcseconds ( two rightmost images ) are shown . in both cases , the first ( left ) thumbnail is the band , while the second is the ks band . in the lower panels we plotthe difference between the input and derived colours ( ) for faint and bright sources as a function of the angular separation .it is shown that the fit remains accurate as long as the two objects are separated in the _ detection _ image ( i.e. for distances larger than 1.0 arcsec ) , although they are already blended in the _ measure _ image .as the sources become deeply blended in the_detection _ image , with distance less than 1.0 arcsec , a non - negligible contamination starts to appear .not surprisingly , such contamination is larger for the bluer and fainter ( in ks ) galaxy . , title="fig:",width=226 ] , two elliptical galaxies with arcsec are simulated as a function of the angular separations in order to study the combined effect of blending and colours . at variance with fig.[blend_normal1 ] , colours are so extreme here that the object that is fainter in the _ detection _ image is indeed brighter in the _ measure _ one .specifically , one is a relatively faint , blue galaxy ( , ) , the second is a fainter but much redder galaxy ( , ) , in order to simulate an extremely red object . _the detection _image has the pixelscale and noise properties of the acs goods images ( seeing=0.12 , pixel scale=0.03 arcsec ) , while the _ measure _ image reproduces the typical properties of a ks band image of the goods data set , with a fwhm seeing of 0.5 arcsec . for each separation we computed 10 different realization of the galaxy pairs .in the upper panel , bi - dimensional images of the galaxies with a separation of 0.5 arcseconds ( two leftmost images ) and 2.0 arcseconds ( two rightmost images ) are shown . in both cases , the first ( left ) thumbnail is the band , while the second is the ks band . in the lower panels we plot the difference between the input and derived colours ( ) for faint and bright sources as a function of the angular separation .it is shown that the fit remains accurate as long as the two objects are separated in the _ detection _ image ( i.e. for distances larger than 1.0 arcsec ) , although they are already blended in the _ measure _ image . as the sources become deeply blended in the_detection _ image , with distance less than 1.0 arcsec ,a non - negligible contamination starts to appear .not surprisingly , such contamination is larger for the bluer and fainter ( in ks ) galaxy ., title="fig:",width=226 ] , two elliptical galaxies with arcsec are simulated as a function of the angular separations in order to study the combined effect of blending and colours . at variance with fig.[blend_normal1 ] , colours are so extreme here that the object that is fainter in the _ detection _ image is indeed brighter in the _ measure _ one .specifically , one is a relatively faint , blue galaxy ( , ) , the second is a fainter but much redder galaxy ( , ) , in order to simulate an extremely red object . _ the detection _image has the pixelscale and noise properties of the acs goods images ( seeing=0.12 , pixel scale=0.03 arcsec ) , while the _ measure _ image reproduces the typical properties of a ks band image of the goods data set , with a fwhm seeing of 0.5 arcsec . for each separation we computed 10 different realization of the galaxy pairs .in the upper panel , bi - dimensional images of the galaxies with a separation of 0.5 arcseconds ( two leftmost images ) and 2.0 arcseconds ( two rightmost images ) are shown . in both cases ,the first ( left ) thumbnail is the band , while the second is the ks band . in the lower panels we plot the difference between the input and derived colours ( ) for faint and bright sources as a function of the angular separation .it is shown that the fit remains accurate as long as the two objects are separated in the _ detection _ image ( i.e. for distances larger than 1.0 arcsec ) , although they are already blended in the _ measure _ image . as the sources become deeply blended in the_detection _ image , with distance less than 1.0 arcsec ,a non - negligible contamination starts to appear .not surprisingly , such contamination is larger for the bluer and fainter ( in ks ) galaxy ., title="fig:",width=453 ]we briefly describe here the systematics that may affect such psf matching procedure and the approaches that we have developed within convphot to minimise them .  _ alignment errors _ + the fitting procedure is extremely sensitive to alignment errors . in the simple case that the object has a 2d gaussian shape of standard deviation ( ) , it is easy to show that the resulting flux is _ systematically underestimated _ by a factor , where is the offset in pixel of the center position .when ground based images are combined to hst images with excellent sampling , this effect is non - negligible . in the case of the goods acs data , for instance , the acs pixel - size is 0.03 , that is often smaller than the residuals of the alignment of ir ground based images . for an alignment error of 1 pixel ( in the _ detection _ image ) , a figure that can be quite typical or even optimal when combining ground based and hst images , the resulting flux underestimate may be of about 3% .  as a first way out , we have included in convphot an option to re - center any object before minimisation . in this case , the center of each object are internally computed in the model as well as in the measure image , and the measure is re - centered to the model image before minimisation . since the center determination may be noisy for faint objects , the user can set a limit on the s / n of the objects ( in each image ) to execute this operation only on bright sources .we remark that such option must be adopted with great care , after tests and simulations on the specific data . in the case of the goods music catalog , for instance , we have adopted the recentering option for sources with both in the _ model _ and in the _ measure _ image for the wfi u bands , while we decide not to use this option for u - vimos , isaac and irac data .  _ variable fwhm or object profile _ + another source of uncertainty may result from a variation of the object profile from the _ detection _ to the _ measure _ image .this can be due to either a physical change of the object profile ( as due , for instance , to a more prominent bulge in the ir ) or to an incorrect estimate of the psf transformation kernel . in this case , assuming that the profile of an isolated objects in the model image and in the measure image are both gaussian with same center and different , the resulting flux is incorrectly estimated by a factor . in this case, the resulting flux can be therefore either under- or over - estimated , depending on the sign of the error in the psf estimate .an error of 10% in the object psf will result in a 5% error in the output flux .the small systematic effects that have been described above , or others resulting from different sources , can be efficiently corrected by taking into account the flux in the residual image . at this purpose, we have included in the code an option to compute the total residual flux contained in the segmentation area of the original frame .this correction is computed in a small region in order not to be affected by nearby objects , which would drastically contaminate the corrections computed in the residual image , especially for faint objects severely blended with bright sources in the _ measure _ image . in fig .[ centering ] we show the efficiency of using the residuals to correct possible biases due to centering problems .   but with a distance of 2 arcsec ( upper panel ) .the and images are shifted of 1 pixel .the position is given in pixel units and the pixel scale is 0.03 arcsec .the lower panel shows the difference between input and measured colours without correction ( solid histogram ) and taking into account the correction provided by convphot ( dashed line ) ., width=453 ]  _ objects with low signal to noise ratio _ + a well known drawback of our procedure occurs when the objects have a low s / n in the detection image , since this would result in a noisy determination of the profile , and hence of the final colour , even for objects that have a high s / n in the _ measure _ image . during the development of convphot, we indeed considered the possibility of using some parametric fit as input shape of the objects .after some test ( which revealed also that the task is computationally heavy ) , we realized that it was not a viable solution , for two reasons :  * \1 ) a large fraction of faint galaxies have intrinsically irregular morphologies , such that errors in their fitting produces at least the same level of uncertainty or worse than using their observed profile , albeit noisy ; * \2 ) for faint objects , the psf - match smoothing significantly reduces the noise , such that the leading error term is anyway the global uncertainty on the total flux , that is also present at the same level in the parametric fitting of the shape .  for these reasons , we did not insert such technique in convphot .we have performed several validation tests on the convphot code , during the debugging phase and to estimate the efficiency in the correction for systematics .a first , obvious set of simulations has involved the use of synthetic images , obtained with the iraf artdata package , where we have simulated either single or pairs of galaxies of various luminosities , morphologies and resolutions , by which we have verified that the code is computationally correct .examples of this simulations are those reproduced in fig.[blend_normal1 ] and fig.[blend_eros1 ] and will not be presented here .we have done more accurate tests to validate convphot when dealing with the complexity of real data .first of all , we checked the reliability of convphot simulating the typical case of an hst deep image as _ detection _ and a ground based image as _ measure _ , using three cutouts of the real acs images of the goods - south field . as_ detection _image , we have used the original band ( f850lp , 0.12 arcsec fwhm ) , with its relative segmentation map and sextractor photometry derived by the goods - music database . as _ measure _ images , we have smoothed the ( f435w ) and band ( f775w ) , with a 0.5 arcseconds kernel .we have run convphot only on sources that are fully inside the _ measure _ images ( ) , expanding the thumbnails of 128 pixels in order to have enough pixels to compute the background with convphot , and with threshold 0.0 and 0.5 ( with the latter choice we fit only the central part of the objects ) .  as a figure of merit , we compare in fig .[ bz_iz ] the and colours obtained by convphot with the aperture colour obtained by sextractor on the original , high resolution images , that are those used in .  at first glance, this plot shows that our software is not biased in the colour determination for bright as well as for faint sources .looking into the details , the residuals of the colours show a different behaviour for bright ( ) and faint galaxies .the residuals of the bright sub - sample have larger dispersion both in the b band and in the 0.5 threshold cases : an investigation by eye of these bright sources with large scatter in the colour residuals indicates that the main reason is the morphological change of source profile for nearby bright galaxies , as for example that in fig .the profiles of nearby and bright galaxies differ largely when observed in the near uv and in the near ir , since in the uv the star forming regions are clearly visible , and their spatial distribution is significantly different than the regions occupied by old / evolved stars , which emit mainly in the near ir . in this case , if the galaxy profile in the band is used to derive the magnitude of the source , it will result in a slightly poorer fit , especially when the wavelength different is large ( b vs z bands ) or when the fit is restricted to the small central bulge ( threshold=0.5 ) .  for faint sources , however , the difference between the and is not significant , while an higher threshold is useful to enhance the quality of the fit and the accuracy of the magnitude estimation .   and colours as a function of the band magnitude of the objects detected on the goods - south survey .two different values of the threshold are used ( 0.0 and 0.5 ) and they affect in dissimilar way the bright and faint objects .the small scatter in the input and convphot colours shows that the convphot colour determination is not biased and is compatible with aperture photometry ., width=453 ]     simulations , however , can not reproduce the complexity of real objects and data . to obtain a more stringent and independent test we have made use of the band fors image of the k20-cdfs ( seeing=0.55 arcsec and pixel scale=0.2 arcsec ) .we have already analysed the k20 data set in a previous paper ( cimatti et al 2001 ) , applying a standard technique based on aperture photometry obtained with sextractor . here, we have used convphot to obtain a new estimate of the colour in the fors image of the k20 , and compared them with the previously published catalog .to this aim , we have used the goods acs z - band image as _ detection _ , with a typical fwhm of 0.12 arcsec and pixel scale of 0.03 arcsec .the results of this test are shown in fig.[fors ] , which are not corrected for the small offset in the average colour ( ) due to the small difference in the filter response curve .once allowing for this offset , the plot shows that convphot is not biased in the colour estimate in respect to standard aperture photometry .colour as a function of the magnitude of the objects detected on the k20 survey ( upper panel ) .the histogram of this colour ( lower panel ) shows that the convphot colour determination is not biased and is compatible with aperture photometry ., width=453 ]   we have also made extensive tests in a case when convphot is pushed to its very limits , i.e. when the resolutions , pixel scales and wavelengths of the two images are very different .such a situation is very challenging both conceptually and technically , since the present version of convphot works on _ detection _ and _ measure _ images after aligning and rebinning them to the same pixelscale and reference frame ( a discussion on future possible improvements is given in the following ) . at this purpose , we have taken the extreme case of applying convphot to a combination of hst acs and spitzer mips images which have pixel scales of 0.03 and 1.2 arcsec / pixel , respectively .such data set is again taken from the public data of the goods survey , where we take again the acs band as _ detection _ image and the mips image at as _measure_.  in principle , we should align and resample the original mips images , with a typical psf of 5.2 arcsec , at the same scale of the acs ones .this would result in a minimum size of the resulting thumbnail of pixels , that would make impracticable the use of convphot even with fast workstations . to circumvent this problem , we rebinned the acs _ detection _ image by a factor ( 0.24 arcsec / pixel ) , resulting in a severely undersampled image ( the fwhm of the acs goods image is 0.12 arcsec ) , reducing significantly the image size .we also rebinned of the same amount ( with a specific code ) the input segmentation image .finally , we aligned and rebinned the mips data to such a rebinned acs image .the advantage of this procedure is that the requirements of memory and cpu time are significantly reduced , although we loose some information when introducing a undersampling of the original image .  before applying it to the real data, we performed a simulation by smoothing the rebinned acs image to the same psf of the mips data , and used convphot to estimate the colour between the original and the mips smoothed one .[ zmipssim ] shows the comparison between the input and the convphot magnitudes , indicating that this software can be used even when dealing with such extreme cases .this plot shows also that the thresholding option for convphot can be useful to reduce the scatter of the magnitude estimation .band of acs and the 24 micron band of mips as _ detection _ and _ measure _ images , respectively .the y axis shows the difference between the input magnitudes and those derived by convphot as a function of the magnitude on the simulated objects .the simulated image is derived by smoothing the original band , so that the expected colour should be zero .the histogram of the colours ( right panels ) shows the result for different value of the threshold in convphot .arrows indicate upper limit in the convphot magnitude ., width=453 ]  we finally obtained a mips catalog of all sources in the goods music sample , after rebinning the original acs z - band detection and segmentation images by a factor of 8 , computing the appropriate kernel and run convphot over the entire goods field .we have used a threshold of 0.3 and an factor of 0.2 , on the indications of the simulations described in the previous section .  to check the reliability of our magnitude estimation in the real mips image, we compare the convphot magnitude estimate with those derived by sextractor .these are computed on circular apertures of 6 and 6.6 arcsec radius , and then corrected applying an appropriate correction factor given in the mips instrument manual , in this case 0.58 and 0.54 magnitudes , respectively .the corrected aperture magnitudes are an unbiased estimate of the true source luminosity only if the object is isolated .obviously , given the large fwhm of the mips 24 micron point response function ( or psf ) , the effect of crowding on the aperture magnitude is severe for faint sources , typically at .[ mipsreal ] shows the comparison between the corrected aperture magnitudes and those derived by convphot for the entire goods - south field , indicating that even in the real case our algorithm retrieve the correct fluxes . if a comparison is made with the photometric catalog released by the goods team , who used a similar technique starting from the irac 3.6 micron as _ detection _image , we find a good agreement for relatively bright objects .this indicates that our background estimation is correct and the convphot result is robust .after the comparisons both with simulations and real data , we are thus confident that the convphot algorithm is stable even in this extreme case , both due to the wavelength and psf differences between the _ detection _ and _ measure _ images .a final remark is necessary about the use of undersampled image .we have made a test using undersampled images ( obtained by rebinning the usual goods band image by a factor 8) , and simulated a ground based image with seeing of 0.5 arcsec . in this case , we found evidence that the convphot magnitudes are significantly biased , with a typical underestimate of the fitted flux by 0.2 magnitudes .we therefore conclude that - not surprisingly - the use of undersampled images as _ detection _ images should be avoided when the difference in resolution and pixelscale is less extreme than the mips case described above ..  this is just an example of how much the use of this software however is delicate .we therefore strongly recommend the interested user to make a set of realistic simulations to check the effect of the multiple parameters on the correct magnitude estimation .the present version of convphot has several limitations , which are described here and will be solved in future versions of this software .we summarise the most important in this brief list , and defer to future version of the code their implementation .  * a major limitation results from the fact that all the thumbnails of the processed sources are stored in the computer memory .this allows to carry out the computation faster but limits the size of the images on which convphot operates . *the _ measure _ image and its rms must be rebinned to the _ detection _ image reference frame . in this casethe alignment between sources can be done accurately using dedicated routines ( i.e. swarp , iraf ) and the advantage of dealing with small pixel scales is to carry out a fine tuning of the source centering in convphot .a draw back is that it increases the thumbnail dimensions and consequently reduce the number of sources to be stored in the computer memory .a possible way out would be to avoid at all any rebin , and work directly in astrometric coordinates .* if two sources are blended in the _ detection _ image their profiles in the model image will be different from the real case. a modelling of the object profile for blended sources is definitely needed , but its implementation is not easy , especially for irregular sources . *the convolution with the input kernel is performed in pixel space , which is computationally an heavy process .a convolution in the fourier space would allow a much faster computation . *the kernel derivation is left to the user and it is fixed for all the sources in an image .it is not foreseen for the moment the possibility of compute the smoothing kernel internally or using a psf which varies according to the position of the objects . *the recentering option is very simple , since it takes the maximum of a source in the _ detection _ and _ measure _ image and compute the relative shifts .this is not accurate for the case of crowded fields or large psf images , in which a mis - identification of two close sources turns out in a wrong magnitude estimation .* the option to correct the fitted flux with a statistic of the residual image in the original segmentation is not satisfactory when dealing with large kernel , and more simulations are necessary to find a proper solution for these cases .we have described in this paper a new , public software for accurate multiband photometry of images of different resolution and depth , that we have named convphot .the code is based on an algorithm that has been originally proposed by fsly99 and applied in some previous analysis of deep extragalactic imaging data .the code performs a `` psf - matched '' photometry on two images with different psf , by first extracting all objects from the first ( detection ) image , smoothing each of them to the psf of the second ( measure ) image , and obtaining the flux of each object on the measure image by a global minimisation over the whole image .we provide here for the first time a public version of such a code , of which we discuss the basic algorithm , the possible systematic effects involved and the results of a set of simulations and validation tests that we have performed on real as well as simulated images .to maximise the usability of the code , we explicitly use the outputs of the popular sextractor code as inputs to our procedure .  this code has been extensively used and tested to obtain the goods music sample , based on the public release of the goods south data , as we have described in grazian et al .in such a context , we used convphot to obtain colours for more than 18000 sources originally detected in a wide , high resolution mosaic of hst - acs images .it has proven to be reliable enough to flawlessly process around 70 frames at different wavelengths and image quality and depth , ranging from vlt vimos images in the u band ( with typical psf of 1 ) to vlt isaac images in j , h and k ( with typical psf of 0.5 ) , as well as spitzer - irac images ( with typical psf of 2 ) .we believe that the number of options in the code make it flexible enough for a wider use .convphot is written in c language under the gnu public license and is publicly released worldwide .this software is described in detail in a web site where the source code can be retrieved , together with the user manual : http://lbc.oa-roma.inaf.it/convphot .we warmly thank the referee , m. strauss , for his useful suggestions and comments , that largely improved the quality and amount of information in this paper .it is a pleasure for us to warmly thank giulia rodighiero for her patience during the software testing / usage and for very useful comments to improve this paper , the convphot software and its user manual .anderson , e. , bai , z. , bischof , c. , blackford , l. s. , demmel , j. , dongarra , j. , du croz , j. , greenbaum , a. , hammarling , s. , mckenney , a. , sorensen , d. , 1999 , _lapack users guide ( third edition ) _ , society for industrial and applied mathematics    cimatti , a. 2001 deep fields , proceedings of the eso / ecf / stsci workshop held at garching , germany , 9 - 12 october 2000 .stefano cristiani , alvio renzini , robert e. williams ( eds . ) .springer , 2001 , p. 81

Abstract: we describe in this paper a new , public software for accurate `` psf - matched '' multiband photometry for images of different resolution and depth , that we have named convphot , of which we analyse performances and limitations . it is designed to work when a high resolution image is available to identify and extract the objects , and colours or variations in luminosity are to be measured in another image of lower resolution but comparable depth . to maximise the usability of this software , we explicitly use the outputs of the popular sextractor code , that is used to extract all objects from the high resolution `` detection '' image . the technique adopted by the code is essentially to convolve each object to the psf of the lower resolution `` measure '' image , and to obtain the flux of each object by a global minimisation on such measure image . we remark that no a priori assumption is done on the shape of the objects . in this paper we provide a full description of the algorithm , a discussion of the possible systematic effects involved and the results of a set of simulations and validation tests that we have performed on real as well as simulated images . the source code of convphot , written in c language under the gnu public license , is released worldwide .   methods : data analysis techniques : image processing techniques : photometric