Commit fbefddec authored by No Author's avatar No Author
Browse files

This commit was manufactured by cvs2svn to create tag 'rel-6-5beta'.

parent 7ffbb3e0
\rm test.tab
~/newbin/biglens/lenstool_tab tab.in test.tab
1.0e0 1.03e0 1.0e-2 1.0e-1 1.0e0 1.01
\ No newline at end of file
#include<math.h>
#include<fonction.h>
#include<constant.h>
#include<dimension.h>
#include<structure.h>
/****************************************************************/
/* nom: e_mass */
/* auteur: Eric Jullo */
/* date: 12/07/06 */
/* place: ESO Chile */
/****************************************************************
* Return the mass of 1 clump inside a given radius in Msol.
*
* Sum the surface mass given by e_grad2() over an ellitical area.
* In case of elliptical clump, <radius> is the half major axis.
*
* Parameters:
* - icl : number of the clump
* - radius : max radius in arcsec. (-1 for total mass)
*/
double e_mass(int icl, double radius)
{
extern struct pot lens[];
extern struct g_cosmo C;
struct point pi; // sampling point
struct ellipse ampli; // amplification matrix at that point
struct matrix grad2; // second derivate of the projected lens potential
double mass; // total mass
double conv; //
double x, y; // sampling point coordinates
double xmin, xmax; // sampling area
double ymin, ymax;
double dlsds; // DLS/DS ratio for the lens
double dl; // luminosity distance to the lens
double a, b, c; // amplification matrix diagonalisation coefs
dlsds = lens[icl].dlsds;
dl=distcosmo1(lens[icl].z);
// all the distances are in arcsec
xmax = radius/sqrt(1+lens[icl].emass) + lens[icl].C.x;
ymax = radius/sqrt(1-lens[icl].emass) + lens[icl].C.y;
xmin = -xmax; ymin = -ymax;
mass = 0;
for( x = xmin; x < xmax; x += 0.05 )
for( y = ymin; y < ymax; y += 0.05 )
{
pi.x = x; pi.y = y;
grad2 = e_grad2_pot(&pi, icl);
grad2.a *= dlsds;
grad2.b *= dlsds;
grad2.c *= dlsds;
a = 1. - grad2.a;
b = 1. - grad2.c;
c = - grad2.b;
ampli = formeli(a,b,c);
mass += 1.-(ampli.a+ampli.b)/2.; // the convergence k
}
conv=MCRIT12/C.h*0.05*0.05/dlsds*dl;
mass *= conv;
return mass;
}
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<fonction.h>
#include<constant.h>
#include<dimension.h>
#include<structure.h>
/****************************************************************/
/* nom: f_shape_abs */
/* auteur: Jean-Paul Kneib */
/* date: 23/04/04 */
/* place: Toulouse */
/* lecture de fichiers ellipses, source ou image
*
* Read a data file of elliptical regions defined in absolute coordinates
* Input format :
* char* n, double Cx, double Cy, double a, double b, double theta, double z, flaot mag
*
* Cx,Cy,a,b and theta must be in degree.
*
* If the first character of the line is a # then the line is ignored.
*
* Parameters :
* - istart : number of objects already counted and to increment
* - liste : list of galaxie structure to fill with the data
* - name : name of the file to read
*
*/
void f_shape_abs(int *istart,struct galaxie *liste,char *name)
{
extern struct g_mode M;
FILE *IN;
int i, k=0;
char line[128];
i=(*istart);
NPRINTF(stderr,"READ_ABS: %s:",name);
IN=fopen(name,"r");
while( IN!=NULL && !feof(IN) && !ferror(IN) )
{
flire(IN,line);
if( sscanf(line,"%s%lf%lf%lf%lf%lf%lf%lf",
liste[i].n,&liste[i].C.x,&liste[i].C.y,
&liste[i].E.a,&liste[i].E.b,
&liste[i].E.theta,&liste[i].z,&liste[i].mag) == 8 )
{
if( liste[i].n[0] != '#' )
{
liste[i].C.x -=M.ref_ra;
liste[i].C.x *=-3600*cos(M.ref_dec*DTR);
liste[i].C.y -=M.ref_dec;
liste[i].C.y *=3600;
liste[i].E.theta*=DTR;
if ((liste[i].E.a==0.)||(liste[i].E.b==0.))
liste[i].c='s';
else
liste[i].c='g';
i++;k++;
}
}
}
if( IN==NULL || ferror(IN) || k == 0 )
{
fprintf( stderr, "ERROR: Error reading the %s file\n", name);
exit(-1);
}
fclose(IN);
NPRINTF(stderr,"%d\n",k);
(*istart)=i;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment