SUBROUTINE EXTRAPOL
: (RMEANR,YMU,SIG,NDATA,
: SN,SMU0,SR0,TOTAL,SCHI2,NU)
* -------------------------------------------
* This subroutine fits Sersic profile parame-
* ters to a surface-brightness profile by chi
* squared minimisation. It then extrapolates
* the profile to obtain a t-system total mag-
* nitude estimate.
* -------------------------------------------
* INPUT PARAMETERS (all unchanged on output):
* RMEANR(100): mean radial distance of each
* isophote /arcsec;
* YMU(100): corresponding surface bright-
* ness of each isophote /mag.arcsec**(-2);
* SIG(100): corresponding 1 sigma uncer-
* tainty on each YMU;
* NDATA: number of isophotes (<101);
* -------------------------------------------
* OUTPUT PARAMETERS:
* SN, SMU0 and SR0: best fitting Sersic
* parameters: n, mu_0 and r_0 respectively
* (see Equation 6);
* TOTAL: t-system total magnitude derived
* from the best fitting parameters;
* CHI2: chi squared value for adopted fit;
* NU: corresponding degrees of freedom.
* -------------------------------------------
* Two external routines called from Numerical
* Recipes, Press et al., Cambridge U.P. 1986:
* SUBROUTINE FIT (with the minor modifica-
* tions described in Section 3) and
* FUNCTION GAMMLN (without modification).
* -------------------------------------------
REAL RMEANR(100), YMU(100), SIG(100),
: XMEANRN(100)
INTEGER NDATA(100)
DOUBLE PRECISION DR0, DNP1, GAMMLN
PI= 3.141592654
BCHI2= 100000.0
MWT= 1
* increment n from 0.2 to 3.0
DO I= 20,300
RN= 0.01*FLOAT(I)
DO J= 1,NDATA
XMEANRN(J)= (RMEANR(J))**RN
ENDDO
CALL FIT (XMEANRN,YMU,NDATA,SIG,MWT,
: FMU0,FSLOPE,SIGMU0,SIGS,CHI2)
* retain parameters of best fit so far
IF (CHI2.LE.BCHI2) THEN
BESTN= RN
BMU0= FMU0
BSLOPE= FSLOPE
BCHI2= CHI2
ENDIF
ENDDO
SCHI2= BCHI2
NU= NDATA-2
SN= BESTN
SMU0= BMU0
SR0= (1.085736/BSLOPE)**(1.0/SN)
* evaluate total magnitude
DR0= DBLE(SR0)
DNP1= (2.0D0/DBLE(SN))
GAMP1= EXP(SNGL(GAMMLN(DNP1)))
TOTAL= -2.5*LOG10(2.0*PI*GAMP1/SN)
: +SMU0-2.5*SNGL(DLOG10(DR0**2D0))
END
* -------------------------------------------
Copyright The European Southern Observatory (ESO)