Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96786088
o_print_res.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Dec 30, 20:30
Size
37 KB
Mime Type
text/x-c
Expires
Wed, Jan 1, 20:30 (2 d)
Engine
blob
Format
Raw Data
Handle
23226452
Attached To
R1448 Lenstool-HPC
o_print_res.c
View Options
#include<stdio.h>
#include<string.h>
#include<time.h>
#include<math.h>
#include<float.h>
#include<fonction.h>
#include<constant.h>
#include<dimension.h>
#include<structure.h>
#include<lt.h>
/****************************************************************/
/* nom: o_print_res */
/* auteur: Jean-Paul Kneib */
/* date: 10/02/92 */
/* place: Toulouse */
/* */
/* Modified : */
/* EJ (01/09/05)--reference in best.par, index of the objects
*
****************************************************************/
static
void
writePotentiel
(
FILE
*
best
,
long
int
i
,
int
flag
);
static
void
writeLimit
(
FILE
*
best
,
long
int
i
);
void
o_print_res
(
double
chi0
,
double
evidence
)
{
extern
struct
g_mode
M
;
extern
struct
g_grille
G
;
extern
struct
g_image
I
;
extern
struct
g_frame
F
;
extern
struct
g_cline
CL
;
extern
struct
g_source
S
;
extern
struct
g_large
L
;
extern
struct
g_observ
O
;
extern
struct
g_cosmo
C
;
extern
struct
vfield
vf
;
extern
struct
g_dyn
Dy
;
//I added this TV
extern
struct
g_pot
P
[
NPOTFILE
];
extern
struct
pot
lens
[
NLMAX
],
lmin
[],
lmax
[],
prec
[];
extern
struct
pot
lmin_s
[
NLMAX
],
lmax_s
[],
prec_s
[];
extern
struct
galaxie
smin
[
NFMAX
],
smax
[
NFMAX
];
extern
struct
z_lim
zlim
[];
extern
struct
z_lim
zalim
;
extern
struct
z_lim
zlim_s
[];
extern
struct
cline
cl
[];
extern
struct
galaxie
multi
[
NFMAX
][
NIMAX
];
extern
struct
galaxie
source
[
NFMAX
];
extern
struct
galaxie
arclet
[
NAMAX
];
extern
struct
g_cosmo
clmin
,
clmax
;
extern
struct
vfield
vfmin
,
vfmax
;
extern
int
cblock
[
NPAMAX
];
extern
int
vfblock
[
NPAMAX
];
extern
int
block
[][
NPAMAX
];
extern
int
block_s
[][
NPAMAX
];
extern
int
sblock
[
NFMAX
][
NPAMAX
];
extern
int
nwarn
;
extern
struct
sigposStr
sigposAs
;
extern
double
z_dlsds
;
extern
double
chip
,
chix
,
chiy
,
chis
,
chil
,
chi_vel
,
chi_mass
;
//I added chi_vel and chi_mass TV
extern
double
**
map_p
,
**
map_axx
,
**
map_ayy
;
extern
struct
g_pixel
ps
,
imFrame
;
int
i
,
j
;
FILE
*
best
,
*
besto
;
char
limages
[
ZMBOUND
][
IDSIZE
];
time_t
rawtime
;
NPRINTF
(
stderr
,
"
\n
*********************************************************
\n
"
);
NPRINTF
(
stderr
,
"Chi2:%.3lf
\t
p:%.3lf s:%.3lf l:%.3lf
\n
"
,
chi0
,
chip
,
chis
,
chil
);
if
(
M
.
inverse
==
3
)
NPRINTF
(
stderr
,
"log(Evidence) : %.3lf
\n
"
,
evidence
);
if
(
lens
[
0
].
type
!=
10
)
{
for
(
i
=
0
;
i
<
G
.
no_lens
;
i
++
)
{
NPRINTF
(
stderr
,
"%s : c (%.3lf,%.3lf) e (%.3lf,%.3lf) epot %.3lf
\n
"
,
lens
[
i
].
n
,
lens
[
i
].
C
.
x
,
lens
[
i
].
C
.
y
,
lens
[
i
].
emass
,
lens
[
i
].
theta
*
RTD
,
lens
[
i
].
epot
);
if
(
lens
[
i
].
type
==
12
)
{
NPRINTF
(
stderr
,
"c %.2lf rhos %.2leMsol/Mpc3 M200 %.3leMsol
\n
"
,
lens
[
i
].
beta
,
lens
[
i
].
pmass
,
lens
[
i
].
masse
);
NPRINTF
(
stderr
,
"rs %.2lf
\"
(%.2lfkpc) s0 %.2lfkm/s alpha %.3lf
\n
"
,
lens
[
i
].
rc
,
lens
[
i
].
rckpc
,
lens
[
i
].
sigma
,
lens
[
i
].
alpha
);
if
(
lens
[
i
].
rcut
!=
DBL_MAX
)
NPRINTF
(
stderr
,
"R200 %.2lf
\"
(%.2lfkpc)
\n
"
,
lens
[
i
].
rcut
,
lens
[
i
].
rcutkpc
);
}
else
if
(
lens
[
i
].
type
==
13
)
{
NPRINTF
(
stderr
,
"re %.2lf(%.2lfkpc) sigma_e %.2le Msol/kpc^2 n %.3lf
\n
"
,
lens
[
i
].
rc
,
lens
[
i
].
rckpc
,
lens
[
i
].
sigma
,
lens
[
i
].
alpha
);
}
else
if
(
lens
[
i
].
type
==
16
)
{
NPRINTF
(
stderr
,
"rs %.2lf
\"
(%.2lfkpc) s0 %.2lfkm/s
\n
"
,
lens
[
i
].
rc
,
lens
[
i
].
rckpc
,
lens
[
i
].
sigma
);
}
else
{
NPRINTF
(
stderr
,
"rc %.2lf(%.2lfkpc) s0 %.2lfkm/s alpha %.3lf
\n
"
,
lens
[
i
].
rc
,
lens
[
i
].
rckpc
,
lens
[
i
].
sigma
,
lens
[
i
].
alpha
);
if
(
lens
[
i
].
rcut
!=
DBL_MAX
)
NPRINTF
(
stderr
,
"rcut %.2lf(%.2lfkpc)
\n
"
,
lens
[
i
].
rcut
,
lens
[
i
].
rcutkpc
);
}
if
(
lens
[
i
].
type
==
6
||
lens
[
i
].
type
==
89
)
NPRINTF
(
stderr
,
"beta %.3lf
\n
"
,
lens
[
i
].
beta
);
if
(
lens
[
i
].
type
==
7
)
NPRINTF
(
stderr
,
"masse %.3lf 10^12 Msol
\n
"
,
lens
[
i
].
masse
);
}
}
else
/* spline mapping */
{
sp_set
(
map_p
,
G
.
nx
,
G
.
ny
,
map_axx
,
map_ayy
);
NPRINTF
(
stderr
,
"WRITE: absolute potential map -> pot.best
\n
"
);
wr_pot
(
"pot.best"
,
map_p
);
NPRINTF
(
stderr
,
"WRITE: absolute mass map -> mass.best
\n
"
);
wr_mass
(
"mass.best"
,
map_axx
,
map_ayy
);
}
// Print the optimized redshifts
for
(
i
=
0
;
i
<
I
.
nzlim
;
i
++
)
{
splitzmlimit
(
zlim
[
i
].
n
,
limages
);
j
=
0
;
while
(
indexCmp
(
multi
[
j
][
0
].
n
,
limages
[
0
]
)
)
j
++
;
z_dlsds
=
multi
[
j
][
0
].
dr
;
multi
[
j
][
0
].
z
=
zero
(
0.1
,
100.
,
fz_dlsds
);
NPRINTF
(
stderr
,
"#%s z:%.3lf dlsds:%.3lf
\n
"
,
zlim
[
i
].
n
,
multi
[
j
][
0
].
z
,
multi
[
j
][
0
].
dr
);
}
NPRINTF
(
stderr
,
"***********************************************************
\n
"
);
/* ecriture des resultats dans best.par */
best
=
fopen
(
"best.par"
,
"w"
);
time
(
&
rawtime
);
fprintf
(
best
,
"#%s
\n
"
,
asctime
(
localtime
(
&
rawtime
)
)
);
if
(
I
.
forme
>=
0
)
fprintf
(
best
,
"#Source plane optimization
\n
"
);
else
fprintf
(
best
,
"#Image plane optimization
\n
"
);
fprintf
(
best
,
"#Chi2tot(dof=%d): %.4lf
\n
"
,
getNConstraints
()
-
getNParameters
(),
chi0
);
fprintf
(
best
,
"#Chi2pos: %.3lf
\n
"
,
chip
);
fprintf
(
best
,
"#Chi2_vel: %.3lf
\n
"
,
chi_vel
);
//THIS IS MINE
fprintf
(
best
,
"#Chi2_mass: %.3lf
\n
"
,
chi_mass
);
//THIS IS MINE
fprintf
(
best
,
"#Chi2formex: %.3lf
\n
"
,
chix
);
fprintf
(
best
,
"#Chi2formey: %.3lf
\n
"
,
chiy
);
fprintf
(
best
,
"#Chi2l: %.3lf
\n
"
,
chil
);
if
(
M
.
inverse
==
3
)
fprintf
(
best
,
"#log(Evidence) : %.3lf
\n
"
,
evidence
);
// REDSHIFTS
for
(
i
=
0
;
i
<
I
.
nzlim
;
i
++
)
{
splitzmlimit
(
zlim
[
i
].
n
,
limages
);
j
=
0
;
while
(
indexCmp
(
multi
[
j
][
0
].
n
,
limages
[
0
]
)
)
j
++
;
fprintf
(
best
,
"#%s z:%.3lf dlsds:%.3lf
\n
"
,
zlim
[
i
].
n
,
multi
[
j
][
0
].
z
,
multi
[
j
][
0
].
dr
);
};
fprintf
(
best
,
"#n_Warning: %d
\n
"
,
nwarn
);
// RUNMODE
fprintf
(
best
,
"runmode
\n
"
);
fprintf
(
best
,
"
\t
reference %d %lf %lf
\n
"
,
M
.
iref
,
M
.
ref_ra
,
M
.
ref_dec
);
fprintf
(
best
,
"
\t
image %d %s
\n
"
,
M
.
image
,
M
.
imafile
);
fprintf
(
best
,
"
\t
source %d %s
\n
"
,
M
.
source
,
M
.
sourfile
);
if
(
M
.
study
)
fprintf
(
best
,
"
\t
study %d %s
\n
"
,
M
.
study
,
M
.
studyfile
);
if
(
M
.
seeing
)
fprintf
(
best
,
"
\t
imseeing %.3lf
\n
"
,
M
.
seeing
);
if
(
M
.
imass
)
fprintf
(
best
,
"
\t
mass %d %d %.3lf %s
\n
"
,
M
.
imass
,
M
.
nmass
,
M
.
zmass
,
M
.
massfile
);
if
(
M
.
iampli
)
fprintf
(
best
,
"
\t
ampli %d %d %.3lf %s
\n
"
,
M
.
iampli
,
M
.
nampli
,
M
.
zampli
,
M
.
amplifile
);
if
(
M
.
ishear
)
fprintf
(
best
,
"
\t
shear %d %d %.3lf %s
\n
"
,
M
.
ishear
,
M
.
nshear
,
M
.
zshear
,
M
.
shearfile
);
if
(
M
.
ishearf
)
fprintf
(
best
,
"
\t
shearfield %d %.3lf %s %d
\n
"
,
M
.
ishearf
,
M
.
zshearf
,
M
.
shearffile
,
M
.
nshearf
);
if
(
M
.
grille
)
fprintf
(
best
,
"
\t
grille %d %d %lf
\n
"
,
M
.
grille
,
M
.
ngrille
,
M
.
zgrille
);
if
(
M
.
pixel
)
fprintf
(
best
,
"
\t
pixel %d %d %s
\n
"
,
M
.
pixel
,
M
.
npixel
,
M
.
pixelfile
);
fprintf
(
best
,
"
\t
end
\n
"
);
// GRILLE
fprintf
(
best
,
"grille
\n
"
);
fprintf
(
best
,
"
\t
nombre %d
\n
"
,
G
.
ngrid
);
fprintf
(
best
,
"
\t
polaire %d
\n
"
,
0
);
fprintf
(
best
,
"
\t
nlentille %ld
\n
"
,
G
.
nlens
);
if
(
strcmp
(
CL
.
algorithm
,
"MARCHINGSQUARES"
)
)
fprintf
(
best
,
"
\t
nlens_crit %ld
\n
"
,
G
.
nlens_crit
);
if
(
sigposAs
.
bk
!=
0
)
{
for
(
i
=
0
;
i
<
I
.
n_mult
;
i
++
)
for
(
j
=
0
;
j
<
I
.
mult
[
i
];
j
++
)
fprintf
(
best
,
"
\t
sigposAs %s %lf
\n
"
,
multi
[
i
][
0
].
n
,
I
.
sig2pos
[
i
][
j
]);
}
fprintf
(
best
,
"
\t
end
\n
"
);
// SOURCE
if
(
M
.
image
!=
0
||
M
.
source
!=
0
)
{
fprintf
(
best
,
"source
\n
"
);
fprintf
(
best
,
"
\t
z_source %.3lf
\n
"
,
S
.
zs
);
fprintf
(
best
,
"
\t
end
\n
"
);
};
// IMAGE
if
(
I
.
nzlim
!=
0
||
I
.
zarclet
>
0
)
{
fprintf
(
best
,
"image
\n
"
);
for
(
i
=
0
;
i
<
I
.
nzlim
;
i
++
)
{
splitzmlimit
(
zlim
[
i
].
n
,
limages
);
j
=
0
;
while
(
indexCmp
(
multi
[
j
][
0
].
n
,
limages
[
0
]
)
)
j
++
;
fprintf
(
best
,
"
\t
z_m_limit %d %s %d %.3lf %.3lf %.4lf
\n
"
,
1
,
zlim
[
i
].
n
,
0
,
multi
[
j
][
0
].
z
,
0.
,
0.
);
}
if
(
I
.
zarclet
>
0
)
fprintf
(
best
,
"
\t
z_arclet %lf
\n
"
,
I
.
zarclet
);
fprintf
(
best
,
"
\t
end
\n
"
);
}
// CLEANLENS
if
(
M
.
iclean
!=
0
)
{
fprintf
(
best
,
"cleanlens
\n
"
);
fprintf
(
best
,
"
\t
cleanset %d %f
\n
"
,
M
.
iclean
,
M
.
zclean
);
if
(
strcmp
(
imFrame
.
pixfile
,
""
))
fprintf
(
best
,
"
\t
imframe %d %s
\n
"
,
imFrame
.
format
,
imFrame
.
pixfile
);
if
(
strcmp
(
ps
.
pixfile
,
""
))
fprintf
(
best
,
"
\t
sframe %s
\n
"
,
ps
.
pixfile
);
if
(
strcmp
(
M
.
centerfile
,
""
))
fprintf
(
best
,
"
\t
c_image %s
\n
"
,
M
.
centerfile
);
if
(
imFrame
.
ncont
>
0
)
{
fprintf
(
best
,
"
\t
ncont %d %s
\n
"
,
imFrame
.
ncont
,
imFrame
.
outfile
);
for
(
i
=
0
;
i
<
imFrame
.
ncont
;
i
++
)
fprintf
(
best
,
"
\t
contour
\t
%d %s
\n
"
,
i
+
1
,
imFrame
.
contfile
[
i
]);
}
if
(
imFrame
.
column
!=
1
)
fprintf
(
best
,
"
\t
column %d
\n
"
,
imFrame
.
column
);
fprintf
(
best
,
"
\t
echant
\t
%d
\n
"
,
imFrame
.
ech
);
fprintf
(
best
,
"
\t
s_echant
\t
%d
\n
"
,
ps
.
ech
);
fprintf
(
best
,
"
\t
s_n
\t
%d
\n
"
,
ps
.
nx
);
if
(
imFrame
.
header
!=
0
)
fprintf
(
best
,
"
\t
header
\t
%d
\n
"
,
imFrame
.
header
);
fprintf
(
best
,
"
\t
pixelx
\t
%lf
\n
"
,
imFrame
.
pixelx
);
fprintf
(
best
,
"
\t
pixely
\t
%lf
\n
"
,
imFrame
.
pixely
);
fprintf
(
best
,
"
\t
xmin
\t
%lf
\n
"
,
imFrame
.
xmin
);
fprintf
(
best
,
"
\t
ymin
\t
%lf
\n
"
,
imFrame
.
ymin
);
fprintf
(
best
,
"
\t
s_xmin
\t
%lf
\n
"
,
ps
.
xmin
);
fprintf
(
best
,
"
\t
s_ymin
\t
%lf
\n
"
,
ps
.
ymin
);
fprintf
(
best
,
"
\t
s_xmax
\t
%lf
\n
"
,
ps
.
xmax
);
fprintf
(
best
,
"
\t
s_ymax
\t
%lf
\n
"
,
ps
.
ymax
);
fprintf
(
best
,
"
\t
end
\n
"
);
}
// Write all the potentials with arcsec and kpc values
for
(
i
=
0
;
i
<
G
.
nlens
;
i
++
)
writePotentiel
(
best
,
i
,
3
);
// CLINE
fprintf
(
best
,
"cline
\n
"
);
fprintf
(
best
,
"
\t
nplan %d"
,
CL
.
nplan
);
for
(
i
=
0
;
i
<
CL
.
nplan
;
i
++
)
fprintf
(
best
,
" %.3lf "
,
CL
.
cz
[
i
]);
fprintf
(
best
,
"
\n
"
);
fprintf
(
best
,
"
\t
dmax %.3lf
\n
"
,
CL
.
dmax
);
fprintf
(
best
,
"
\t
algorithm %s
\n
"
,
CL
.
algorithm
);
if
(
!
strcmp
(
CL
.
algorithm
,
"MARCHINGSQUARES"
)
)
{
fprintf
(
best
,
"
\t
limitHigh %.1lf
\n
"
,
CL
.
limitHigh
);
fprintf
(
best
,
"
\t
limitLow %.3lf
\n
"
,
CL
.
cpas
);
}
else
fprintf
(
best
,
"
\t
pas %.3lf
\n
"
,
CL
.
cpas
);
fprintf
(
best
,
"
\t
end
\n
"
);
//DYNFILE
if
(
Dy
.
dyntype
!=
0
)
{
fprintf
(
best
,
"dynfile
\n
"
);
fprintf
(
best
,
"
\t
dyntype %d
\n
"
,
Dy
.
dyntype
);
fprintf
(
best
,
"
\t
dynnumber %d
\n
"
,
Dy
.
dynnumber
);
fprintf
(
best
,
"
\t
velocity %lf
\n
"
,
Dy
.
dynvel
);
fprintf
(
best
,
"
\t
e_velocity %lf
\n
"
,
Dy
.
dynevel
);
fprintf
(
best
,
"
\t
independent mass %.3le
\n
"
,
Dy
.
indmass
);
fprintf
(
best
,
"
\t
independent e_mass %.3le
\n
"
,
Dy
.
indemass
);
fprintf
(
best
,
"
\t
reference radius kpc %lf
\n
"
,
Dy
.
refradius
);
fprintf
(
best
,
"
\t
end
\n
"
);
}
// GRANDE
fprintf
(
best
,
"grande
\n
"
);
fprintf
(
best
,
"
\t
iso %d %d %.3lf %.3lf %.3lf
\n
"
,
L
.
iso
,
L
.
nmaxiso
,
L
.
scale
,
L
.
zonex
,
L
.
zoney
);
fprintf
(
best
,
"
\t
name best
\n
"
);
fprintf
(
best
,
"
\t
profil %d %d
\n
"
,
L
.
profil
,
L
.
pt
);
fprintf
(
best
,
"
\t
contour %d %d
\n
"
,
L
.
ncourbe
,
L
.
pt
);
fprintf
(
best
,
"
\t
large_dist %.3lf
\n
"
,
L
.
dlarge
);
fprintf
(
best
,
"
\t
end
\n
"
);
// OBSERVATION
if
(
M
.
pixel
||
M
.
iclean
)
{
fprintf
(
best
,
"observation
\n
"
);
if
(
O
.
setseeing
==
1
)
fprintf
(
best
,
"
\t
seeing %d %lf
\n
"
,
O
.
setseeing
,
O
.
seeing
);
else
if
(
O
.
setseeing
==
2
)
fprintf
(
best
,
"
\t
seeing_e %d %lf %lf %lf
\n
"
,
O
.
setseeing
,
O
.
seeing_a
,
O
.
seeing_b
,
O
.
seeing_angle
);
else
if
(
O
.
setseeing
==
3
)
fprintf
(
best
,
"
\t
psf %d %s
\n
"
,
O
.
setseeing
,
O
.
psffile
);
fprintf
(
best
,
"
\t
binning %d %d
\n
"
,
O
.
setbin
,
O
.
bin
);
fprintf
(
best
,
"
\t
bruit %d
\n
"
,
O
.
bruit
);
fprintf
(
best
,
"
\t
SKY %.3lf
\n
"
,
O
.
SKY
);
if
(
O
.
gain
>
0
)
fprintf
(
best
,
"
\t
dispersion %.3lf
\n
"
,
sqrt
(
O
.
SKY
/
O
.
gain
));
fprintf
(
best
,
"
\t
idum %d
\n
"
,
O
.
idum
);
fprintf
(
best
,
"
\t
end
\n
"
);
};
// VELOCITY FIELD
if
(
M
.
cube
||
(
M
.
iclean
==
3
))
{
fprintf
(
best
,
"vfield
\n
"
);
fprintf
(
best
,
"
\t
profile %d
\n
"
,
vf
.
profile
);
fprintf
(
best
,
"
\t
x_centre %.3lf
\n
"
,
vf
.
C
.
x
);
fprintf
(
best
,
"
\t
y_centre %.3lf
\n
"
,
vf
.
C
.
x
);
fprintf
(
best
,
"
\t
vt %.3lf
\n
"
,
vf
.
vt
);
fprintf
(
best
,
"
\t
rt %.3lf
\n
"
,
vf
.
rt
);
fprintf
(
best
,
"
\t
i %.3lf
\n
"
,
vf
.
i
);
fprintf
(
best
,
"
\t
theta %.3lf
\n
"
,
vf
.
theta
);
fprintf
(
best
,
"
\t
lcent %.3lf
\n
"
,
vf
.
lcent
);
fprintf
(
best
,
"
\t
sigma %.3lf
\n
"
,
vf
.
sigma
);
fprintf
(
best
,
"
\t
end
\n
"
);
}
// COSMOLOGY
fprintf
(
best
,
"cosmologie
\n
"
);
fprintf
(
best
,
"
\t
model %d
\n
"
,
C
.
model
);
fprintf
(
best
,
"
\t
H0 %.3lf
\n
"
,
C
.
H0
);
fprintf
(
best
,
"
\t
omegaM %.3lf
\n
"
,
C
.
omegaM
);
fprintf
(
best
,
"
\t
omegaX %.3lf
\n
"
,
C
.
omegaX
);
if
(
C
.
kcourb
==
0.
)
fprintf
(
best
,
"
\t
omegaK 0.
\n
"
);
fprintf
(
best
,
"
\t
wX %.3lf
\n
"
,
C
.
wX
);
fprintf
(
best
,
"
\t
wa %.3lf
\n
"
,
C
.
wa
);
fprintf
(
best
,
"
\t
end
\n
"
);
// CHAMP
fprintf
(
best
,
"champ
\n
"
);
fprintf
(
best
,
"
\t
xmin %.3lf
\n
"
,
F
.
xmin
);
fprintf
(
best
,
"
\t
xmax %.3lf
\n
"
,
F
.
xmax
);
fprintf
(
best
,
"
\t
ymin %.3lf
\n
"
,
F
.
ymin
);
fprintf
(
best
,
"
\t
ymax %.3lf
\n
"
,
F
.
ymax
);
if
(
F
.
lmin
>
0
)
{
fprintf
(
best
,
"
\t
lmin %.3lf
\n
"
,
F
.
lmin
);
fprintf
(
best
,
"
\t
lmax %.3lf
\n
"
,
F
.
lmax
);
}
fprintf
(
best
,
"
\t
end
\n
"
);
fprintf
(
best
,
"fini
\n
"
);
fclose
(
best
);
/******************************************************************
* Write the bestopt.par file
******************************************************************/
if
(
M
.
inverse
<
3
)
{
for
(
i
=
0
;
i
<
G
.
no_lens
;
i
++
)
{
lmin
[
i
]
=
lmin_s
[
i
];
lmax
[
i
]
=
lmax_s
[
i
];
prec
[
i
]
=
prec_s
[
i
];
for
(
j
=
0
;
j
<
NPAMAX
;
j
++
)
block
[
i
][
j
]
=
block_s
[
i
][
j
];
};
for
(
i
=
0
;
i
<
I
.
nzlim
;
i
++
)
zlim_s
[
i
]
=
zlim
[
i
];
}
besto
=
fopen
(
"bestopt.par"
,
"w"
);
fprintf
(
besto
,
"#Chi2tot: %.3lf
\n
"
,
chi0
);
fprintf
(
besto
,
"#Chi2pos: %.3lf
\n
"
,
chip
);
fprintf
(
besto
,
"#Chi2_vel: %.3lf
\n
"
,
chi_vel
);
//THIS IS MINE TV
fprintf
(
besto
,
"#Chi2_mass: %.3lf
\n
"
,
chi_mass
);
//THIS IS MINE TV
fprintf
(
besto
,
"#Chi2formex: %.3lf
\n
"
,
chix
);
fprintf
(
besto
,
"#Chi2formey: %.3lf
\n
"
,
chiy
);
fprintf
(
besto
,
"#Chi2l: %.3lf
\n
"
,
chil
);
if
(
M
.
inverse
==
3
)
fprintf
(
besto
,
"#log(Evidence) : %.3lf
\n
"
,
evidence
);
// RUNMODE
fprintf
(
besto
,
"runmode
\n
"
);
fprintf
(
besto
,
"
\t
reference %d %lf %lf
\n
"
,
M
.
iref
,
M
.
ref_ra
,
M
.
ref_dec
);
fprintf
(
besto
,
"
\t
image %d %s
\n
"
,
M
.
image
,
M
.
imafile
);
if
(
strcmp
(
M
.
sourfile
,
"source.best"
)
)
fprintf
(
besto
,
"
\t
source %d %s
\n
"
,
M
.
source
,
M
.
sourfile
);
if
(
M
.
study
)
fprintf
(
besto
,
"
\t
study %d %s
\n
"
,
M
.
study
,
M
.
studyfile
);
if
(
M
.
seeing
)
fprintf
(
besto
,
"
\t
imseeing %.3lf
\n
"
,
M
.
seeing
);
if
(
M
.
inverse
<
3
)
fprintf
(
besto
,
"
\t
inverse %d %d
\n
"
,
M
.
inverse
,
M
.
itmax
);
else
fprintf
(
besto
,
"
\t
inverse %d %lf %d
\n
"
,
M
.
inverse
,
M
.
rate
,
M
.
itmax
);
if
(
M
.
imass
)
fprintf
(
besto
,
"
\t
mass %d %d %.3lf %s
\n
"
,
M
.
imass
,
M
.
nmass
,
M
.
zmass
,
M
.
massfile
);
if
(
M
.
iampli
)
fprintf
(
besto
,
"
\t
ampli %d %d %.3lf %s
\n
"
,
M
.
iampli
,
M
.
nampli
,
M
.
zampli
,
M
.
amplifile
);
if
(
M
.
ishear
)
fprintf
(
besto
,
"
\t
shear %d %d %.3lf %s
\n
"
,
M
.
ishear
,
M
.
nshear
,
M
.
zshear
,
M
.
shearfile
);
if
(
M
.
ishearf
)
fprintf
(
besto
,
"
\t
shearfield %d %.3lf %s %d
\n
"
,
M
.
ishearf
,
M
.
zshearf
,
M
.
shearffile
,
M
.
nshearf
);
if
(
M
.
grille
)
fprintf
(
besto
,
"
\t
grille %d %d %lf
\n
"
,
M
.
grille
,
M
.
ngrille
,
M
.
zgrille
);
if
(
M
.
pixel
)
fprintf
(
besto
,
"
\t
pixel %d %d %s
\n
"
,
M
.
pixel
,
M
.
npixel
,
M
.
pixelfile
);
fprintf
(
besto
,
"
\t
end
\n
"
);
// IMAGE
fprintf
(
besto
,
"image
\n
"
);
fprintf
(
besto
,
"
\t
multfile %d %s
\n
"
,
I
.
n_mult
,
I
.
multfile
);
fprintf
(
besto
,
"
\t
forme %d
\n
"
,
I
.
forme
);
if
(
I
.
stat
>
0
)
fprintf
(
besto
,
"
\t
arcletstat %d %d %s
\n
"
,
I
.
stat
,
I
.
statmode
,
I
.
arclet
);
if
(
I
.
srcfit
>
0
)
fprintf
(
besto
,
"
\t
sourcefit %d %s %s
\n
"
,
I
.
srcfit
,
I
.
srcfitFile
,
I
.
srcfitMethod
);
if
(
I
.
npcl
>
0
)
for
(
i
=
0
;
i
<
I
.
npcl
;
i
++
)
fprintf
(
besto
,
"
\t
critic %d %.3lf %.3lf %.3lf %.3lf %.3lf
\n
"
,
cl
[
i
].
n
,
cl
[
i
].
C
.
x
,
cl
[
i
].
C
.
y
,
cl
[
i
].
phi
/
DTR
,
cl
[
i
].
dl
,
cl
[
i
].
z
);
if
(
I
.
nzlim
>
0
)
for
(
i
=
0
;
i
<
I
.
nzlim
;
i
++
)
fprintf
(
besto
,
"
\t
z_m_limit %d %s %d %.3lf %.3lf %.4lf
\n
"
,
i
+
1
,
zlim
[
i
].
n
,
zlim
[
i
].
bk
,
zlim
[
i
].
min
,
zlim
[
i
].
max
,
zlim
[
i
].
dderr
);
if
(
I
.
zarclet
>
0
)
fprintf
(
besto
,
"
\t
z_arclet %lf
\n
"
,
I
.
zarclet
);
if
(
zalim
.
bk
>
0
)
fprintf
(
besto
,
"
\t
z_a_limit %d %lf %lf
\n
"
,
zalim
.
bk
,
zalim
.
min
,
zalim
.
max
);
if
(
I
.
mult_abs
>
0
)
fprintf
(
besto
,
"
\t
mult_wcs %d
\n
"
,
I
.
mult_abs
);
if
(
sigposAs
.
bk
==
0
)
fprintf
(
besto
,
"
\t
sigposArcsec %lf
\n
"
,
sigposAs
.
min
);
else
fprintf
(
besto
,
"
\t
sigposArcsec %d %lf %lf
\n
"
,
sigposAs
.
bk
,
sigposAs
.
min
,
sigposAs
.
max
);
fprintf
(
besto
,
"
\t
end
\n
"
);
// GRILLE
fprintf
(
besto
,
"grille
\n
"
);
fprintf
(
besto
,
"
\t
nombre %d
\n
"
,
G
.
ngrid
);
fprintf
(
besto
,
"
\t
polaire %d
\n
"
,
0
);
fprintf
(
besto
,
"
\t
nlentille %ld
\n
"
,
G
.
nlens
);
if
(
strcmp
(
CL
.
algorithm
,
"MARCHINGSQUARES"
)
)
fprintf
(
besto
,
"
\t
nlens_crit %ld
\n
"
,
G
.
nlens_crit
);
fprintf
(
besto
,
"
\t
nlens_opt %ld
\n
"
,
G
.
no_lens
);
fprintf
(
besto
,
"
\t
end
\n
"
);
// SOURCE
if
(
M
.
image
!=
0
||
M
.
source
!=
0
)
{
fprintf
(
besto
,
"source
\n
"
);
fprintf
(
besto
,
"
\t
z_source %.3lf
\n
"
,
S
.
zs
);
fprintf
(
besto
,
"
\t
end
\n
"
);
};
// CLEANLENS
if
(
M
.
iclean
!=
0
)
{
fprintf
(
besto
,
"cleanlens
\n
"
);
fprintf
(
besto
,
"
\t
cleanset %d %f
\n
"
,
M
.
iclean
,
M
.
zclean
);
if
(
strcmp
(
imFrame
.
pixfile
,
""
))
fprintf
(
besto
,
"
\t
imFrame %d %s
\n
"
,
imFrame
.
format
,
imFrame
.
pixfile
);
if
(
strcmp
(
ps
.
pixfile
,
""
))
fprintf
(
besto
,
"
\t
sframe %s
\n
"
,
ps
.
pixfile
);
if
(
strcmp
(
M
.
centerfile
,
""
))
fprintf
(
besto
,
"
\t
c_image %s
\n
"
,
M
.
centerfile
);
if
(
imFrame
.
ncont
>
0
)
{
fprintf
(
besto
,
"
\t
ncont %d %s
\n
"
,
imFrame
.
ncont
,
imFrame
.
outfile
);
for
(
i
=
0
;
i
<
imFrame
.
ncont
;
i
++
)
fprintf
(
besto
,
"
\t
contour
\t
%d %s
\n
"
,
i
+
1
,
imFrame
.
contfile
[
i
]);
}
if
(
imFrame
.
column
!=
1
)
fprintf
(
besto
,
"
\t
column %d
\n
"
,
imFrame
.
column
);
fprintf
(
besto
,
"
\t
echant
\t
%d
\n
"
,
imFrame
.
ech
);
fprintf
(
besto
,
"
\t
s_echant
\t
%d
\n
"
,
ps
.
ech
);
fprintf
(
besto
,
"
\t
s_n
\t
%d
\n
"
,
ps
.
nx
);
if
(
imFrame
.
header
!=
0
)
fprintf
(
besto
,
"
\t
header
\t
%d
\n
"
,
imFrame
.
header
);
fprintf
(
besto
,
"
\t
pixelx
\t
%lf
\n
"
,
imFrame
.
pixelx
);
fprintf
(
besto
,
"
\t
pixely
\t
%lf
\n
"
,
imFrame
.
pixely
);
fprintf
(
besto
,
"
\t
xmin
\t
%lf
\n
"
,
imFrame
.
xmin
);
fprintf
(
besto
,
"
\t
ymin
\t
%lf
\n
"
,
imFrame
.
ymin
);
fprintf
(
besto
,
"
\t
s_xmin
\t
%lf
\n
"
,
ps
.
xmin
);
fprintf
(
besto
,
"
\t
s_ymin
\t
%lf
\n
"
,
ps
.
ymin
);
fprintf
(
besto
,
"
\t
s_xmax
\t
%lf
\n
"
,
ps
.
xmax
);
fprintf
(
besto
,
"
\t
s_ymax
\t
%lf
\n
"
,
ps
.
ymax
);
fprintf
(
besto
,
"
\t
end
\n
"
);
}
if
(
M
.
iclean
==
2
)
for
(
i
=
0
;
i
<
S
.
ns
;
i
++
)
{
// SHAPE MODEL
fprintf
(
besto
,
"shapemodel
\n
"
);
fprintf
(
besto
,
"
\t
id %s
\n
"
,
source
[
i
].
n
);
fprintf
(
besto
,
"
\t
s_center_x %.3lf
\n
"
,
source
[
i
].
C
.
x
);
fprintf
(
besto
,
"
\t
s_center_y %.3lf
\n
"
,
source
[
i
].
C
.
y
);
fprintf
(
besto
,
"
\t
s_angle %.3lf
\n
"
,
source
[
i
].
E
.
theta
*
RTD
);
fprintf
(
besto
,
"
\t
s_sigx %.3lf
\n
"
,
source
[
i
].
E
.
a
);
fprintf
(
besto
,
"
\t
s_sigy %.3lf
\n
"
,
source
[
i
].
E
.
b
);
fprintf
(
besto
,
"
\t
mag %.3lf
\n
"
,
source
[
i
].
mag
);
fprintf
(
besto
,
"
\t
end
\n
"
);
// SHAPE LIMITS
fprintf
(
besto
,
"shapelimit
\n
"
);
if
(
sblock
[
i
][
SCX
]
)
fprintf
(
besto
,
"
\t
s_center_x %d %.3lf %.3lf
\n
"
,
sblock
[
i
][
SCX
],
smin
[
i
].
C
.
x
,
smax
[
i
].
C
.
x
);
if
(
sblock
[
i
][
SCY
]
)
fprintf
(
besto
,
"
\t
s_center_y %d %.3lf %.3lf
\n
"
,
sblock
[
i
][
SCY
],
smin
[
i
].
C
.
y
,
smax
[
i
].
C
.
y
);
if
(
sblock
[
i
][
STHETA
]
)
fprintf
(
besto
,
"
\t
s_angle %d %.3lf %.3lf
\n
"
,
sblock
[
i
][
STHETA
],
smin
[
i
].
E
.
theta
*
RTD
,
smax
[
i
].
E
.
theta
*
RTD
);
if
(
sblock
[
i
][
SA
]
)
fprintf
(
besto
,
"
\t
s_sigx %d %.3lf %.3lf
\n
"
,
sblock
[
i
][
SA
],
smin
[
i
].
E
.
a
,
smax
[
i
].
E
.
a
);
if
(
sblock
[
i
][
SB
]
)
fprintf
(
besto
,
"
\t
s_sigy %d %.3lf %.3lf
\n
"
,
sblock
[
i
][
SB
],
smin
[
i
].
E
.
b
,
smax
[
i
].
E
.
b
);
if
(
sblock
[
i
][
SFLUX
]
)
fprintf
(
besto
,
"
\t
mag %d %.3lf %.3lf
\n
"
,
sblock
[
i
][
SFLUX
],
smin
[
i
].
mag
,
smax
[
i
].
mag
);
fprintf
(
besto
,
"
\t
end
\n
"
);
}
// Write the optimized potentials and limits
for
(
i
=
0
;
i
<
G
.
nplens
[
0
]
;
i
++
)
{
writePotentiel
(
besto
,
i
,
2
);
writeLimit
(
besto
,
i
);
}
// POTFILE
for
(
i
=
0
;
i
<
G
.
npot
;
i
++
)
if
(
P
[
i
].
ftype
!=
0
)
{
fprintf
(
besto
,
"potfile%d
\n
"
,
i
);
fprintf
(
besto
,
"
\t
filein %d %s
\n
"
,
P
[
i
].
ftype
,
P
[
i
].
potfile
);
fprintf
(
besto
,
"
\t
zlens %lf
\n
"
,
P
[
i
].
zlens
);
fprintf
(
besto
,
"
\t
type %d
\n
"
,
P
[
i
].
type
);
if
(
P
[
i
].
corekpc
!=
-
1
)
fprintf
(
besto
,
"
\t
corekpc %lf
\n
"
,
P
[
i
].
corekpc
);
else
fprintf
(
besto
,
"
\t
core %lf
\n
"
,
P
[
i
].
core
);
fprintf
(
besto
,
"
\t
mag0 %lf
\n
"
,
P
[
i
].
mag0
);
fprintf
(
besto
,
"
\t
sigma %d %lf %lf
\n
"
,
P
[
i
].
isigma
,
P
[
i
].
sigma1
,
P
[
i
].
sigma2
);
if
(
P
[
i
].
cutkpc1
!=
DBL_MAX
)
fprintf
(
besto
,
"
\t
cutkpc %d %lf %lf
\n
"
,
P
[
i
].
ircut
,
P
[
i
].
cutkpc1
,
P
[
i
].
cutkpc2
);
else
fprintf
(
besto
,
"
\t
cut %d %lf %lf
\n
"
,
P
[
i
].
ircut
,
P
[
i
].
cut1
,
P
[
i
].
cut2
);
if
(
P
[
i
].
ftype
==
62
)
{
fprintf
(
besto
,
"
\t
m200slope %d %lf %lf
\n
"
,
P
[
i
].
islope
,
P
[
i
].
slope1
,
P
[
i
].
slope2
);
fprintf
(
besto
,
"
\t
c200slope %d %lf %lf
\n
"
,
P
[
i
].
ivdslope
,
P
[
i
].
vdslope1
,
P
[
i
].
vdslope2
);
fprintf
(
besto
,
"
\t
m200 %d %lf %lf
\n
"
,
P
[
i
].
ia
,
P
[
i
].
a1
,
P
[
i
].
a2
);
fprintf
(
besto
,
"
\t
c200 %d %lf %lf
\n
"
,
P
[
i
].
ib
,
P
[
i
].
b1
,
P
[
i
].
b2
);
}
else
{
fprintf
(
besto
,
"
\t
slope %d %lf %lf
\n
"
,
P
[
i
].
islope
,
P
[
i
].
slope1
,
P
[
i
].
slope2
);
fprintf
(
besto
,
"
\t
vdslope %d %lf %lf
\n
"
,
P
[
i
].
ivdslope
,
P
[
i
].
vdslope1
,
P
[
i
].
vdslope2
);
fprintf
(
besto
,
"
\t
vdscatter %d %lf %lf
\n
"
,
P
[
i
].
ivdscat
,
P
[
i
].
vdscat1
,
P
[
i
].
vdscat2
);
fprintf
(
besto
,
"
\t
rcutscatter %d %lf %lf
\n
"
,
P
[
i
].
ircutscat
,
P
[
i
].
rcutscat1
,
P
[
i
].
rcutscat2
);
}
fprintf
(
besto
,
"
\t
end
\n
"
);
}
// Write the grid potentials
for
(
i
=
G
.
nmsgrid
;
i
<
G
.
nlens
;
i
++
)
{
writePotentiel
(
besto
,
i
,
2
);
// writeLimit(besto, i);
}
// CLINE
fprintf
(
besto
,
"cline
\n
"
);
fprintf
(
besto
,
"
\t
nplan %d"
,
CL
.
nplan
);
for
(
i
=
0
;
i
<
CL
.
nplan
;
i
++
)
fprintf
(
besto
,
" %.3lf "
,
CL
.
cz
[
i
]);
fprintf
(
besto
,
"
\n
"
);
fprintf
(
besto
,
"
\t
dmax %.3lf
\n
"
,
CL
.
dmax
);
fprintf
(
besto
,
"
\t
algorithm %s
\n
"
,
CL
.
algorithm
);
if
(
!
strcmp
(
CL
.
algorithm
,
"MARCHINGSQUARES"
)
)
{
fprintf
(
besto
,
"
\t
limitHigh %.1lf
\n
"
,
CL
.
limitHigh
);
fprintf
(
besto
,
"
\t
limitLow %.3lf
\n
"
,
CL
.
cpas
);
}
else
fprintf
(
besto
,
"
\t
pas %.3lf
\n
"
,
CL
.
cpas
);
fprintf
(
besto
,
"
\t
end
\n
"
);
//DYNFILE
if
(
Dy
.
dyntype
!=
0
)
{
fprintf
(
besto
,
"dynfile
\n
"
);
fprintf
(
besto
,
"
\t
dyntype %d
\n
"
,
Dy
.
dyntype
);
fprintf
(
besto
,
"
\t
dynnumber %d
\n
"
,
Dy
.
dynnumber
);
fprintf
(
besto
,
"
\t
velocity %lf
\n
"
,
Dy
.
dynvel
);
fprintf
(
besto
,
"
\t
e_velocity %lf
\n
"
,
Dy
.
dynevel
);
fprintf
(
besto
,
"
\t
independent mass %.3le
\n
"
,
Dy
.
indmass
);
fprintf
(
besto
,
"
\t
independent e_mass %.3le
\n
"
,
Dy
.
indemass
);
fprintf
(
besto
,
"
\t
reference radius kpc %lf
\n
"
,
Dy
.
refradius
);
fprintf
(
besto
,
"
\t
end
\n
"
);
}
// GRANDE
fprintf
(
besto
,
"grande
\n
"
);
fprintf
(
besto
,
"
\t
iso %d %d %.3lf %.3lf %.3lf
\n
"
,
L
.
iso
,
L
.
nmaxiso
,
L
.
scale
,
L
.
zonex
,
L
.
zoney
);
fprintf
(
besto
,
"
\t
name best
\n
"
);
fprintf
(
besto
,
"
\t
profil %d %d
\n
"
,
L
.
profil
,
L
.
pt
);
fprintf
(
besto
,
"
\t
contour %d %d
\n
"
,
L
.
ncourbe
,
L
.
pt
);
fprintf
(
besto
,
"
\t
large_dist %.3lf
\n
"
,
L
.
dlarge
);
fprintf
(
besto
,
"
\t
end
\n
"
);
// OBSERVATIONS
if
(
M
.
pixel
||
M
.
iclean
)
{
fprintf
(
besto
,
"observation
\n
"
);
if
(
O
.
setseeing
==
1
)
fprintf
(
besto
,
"
\t
seeing %d %lf
\n
"
,
O
.
setseeing
,
O
.
seeing
);
else
if
(
O
.
setseeing
==
2
)
fprintf
(
besto
,
"
\t
seeing_e %d %lf %lf %lf
\n
"
,
O
.
setseeing
,
O
.
seeing_a
,
O
.
seeing_b
,
O
.
seeing_angle
);
else
if
(
O
.
setseeing
==
3
)
fprintf
(
besto
,
"
\t
psf %d %s
\n
"
,
O
.
setseeing
,
O
.
psffile
);
fprintf
(
besto
,
"
\t
binning %d %d
\n
"
,
O
.
setbin
,
O
.
bin
);
fprintf
(
besto
,
"
\t
bruit %d
\n
"
,
O
.
bruit
);
fprintf
(
besto
,
"
\t
SKY %.3lf
\n
"
,
O
.
SKY
);
if
(
O
.
gain
>
0
)
fprintf
(
besto
,
"
\t
dispersion %.3lf
\n
"
,
sqrt
(
O
.
SKY
/
O
.
gain
));
fprintf
(
besto
,
"
\t
idum %d
\n
"
,
O
.
idum
);
fprintf
(
besto
,
"
\t
end
\n
"
);
};
// VELOCITY FIELD
if
(
M
.
cube
||
(
M
.
iclean
==
3
))
{
fprintf
(
besto
,
"vfield
\n
"
);
fprintf
(
besto
,
"
\t
profile %d
\n
"
,
vf
.
profile
);
fprintf
(
besto
,
"
\t
x_centre %.3lf
\n
"
,
vf
.
C
.
x
);
fprintf
(
besto
,
"
\t
y_centre %.3lf
\n
"
,
vf
.
C
.
x
);
fprintf
(
besto
,
"
\t
vt %.3lf
\n
"
,
vf
.
vt
);
fprintf
(
besto
,
"
\t
rt %.3lf
\n
"
,
vf
.
rt
);
fprintf
(
besto
,
"
\t
i %.3lf
\n
"
,
vf
.
i
*
RTD
);
fprintf
(
besto
,
"
\t
theta %.3lf
\n
"
,
vf
.
theta
*
RTD
);
fprintf
(
besto
,
"
\t
lcent %.3lf
\n
"
,
vf
.
lcent
);
fprintf
(
besto
,
"
\t
sigma %.3lf
\n
"
,
vf
.
sigma
);
fprintf
(
besto
,
"
\t
end
\n
"
);
// VELOCITY FIELD LIMITS
fprintf
(
besto
,
"vfieldlimit
\n
"
);
fprintf
(
besto
,
"
\t
x_centre %d %.3lf %.3lf
\n
"
,
vfblock
[
VFCX
],
vfmin
.
C
.
x
,
vfmax
.
C
.
x
);
fprintf
(
besto
,
"
\t
y_centre %d %.3lf %.3lf
\n
"
,
vfblock
[
VFCY
],
vfmin
.
C
.
y
,
vfmax
.
C
.
y
);
fprintf
(
besto
,
"
\t
vt %d %.3lf %.3lf
\n
"
,
vfblock
[
VFVT
],
vfmin
.
vt
,
vfmax
.
vt
);
fprintf
(
besto
,
"
\t
rt %d %.3lf %.3lf
\n
"
,
vfblock
[
VFRT
],
vfmin
.
rt
,
vfmax
.
rt
);
fprintf
(
besto
,
"
\t
i %d %.3lf %.3lf
\n
"
,
vfblock
[
VFI
],
vfmin
.
i
*
RTD
,
vfmax
.
i
*
RTD
);
fprintf
(
besto
,
"
\t
theta %d %.3lf %.3lf
\n
"
,
vfblock
[
VFTHETA
],
vfmin
.
theta
*
RTD
,
vfmax
.
theta
*
RTD
);
fprintf
(
besto
,
"
\t
lcent %d %.3lf %.3lf
\n
"
,
vfblock
[
VFLCENT
],
vfmin
.
lcent
,
vfmax
.
lcent
);
fprintf
(
besto
,
"
\t
sigma %d %.3lf %.3lf
\n
"
,
vfblock
[
VFSIGMA
],
vfmin
.
sigma
,
vfmax
.
sigma
);
fprintf
(
besto
,
"
\t
end
\n
"
);
}
// COSMOLOGY
fprintf
(
besto
,
"cosmologie
\n
"
);
fprintf
(
besto
,
"
\t
model %d
\n
"
,
C
.
model
);
fprintf
(
besto
,
"
\t
H0 %.3lf
\n
"
,
C
.
H0
);
fprintf
(
besto
,
"
\t
omegaM %.3lf
\n
"
,
C
.
omegaM
);
fprintf
(
besto
,
"
\t
omegaX %.3lf
\n
"
,
C
.
omegaX
);
if
(
C
.
kcourb
==
0.
)
fprintf
(
besto
,
"
\t
omegaK 0.
\n
"
);
fprintf
(
besto
,
"
\t
wX %.3lf
\n
"
,
C
.
wX
);
fprintf
(
besto
,
"
\t
wa %.3lf
\n
"
,
C
.
wa
);
fprintf
(
besto
,
"
\t
end
\n
"
);
// COSMOLIMITS
fprintf
(
besto
,
"cosmolimit
\n
"
);
fprintf
(
besto
,
"
\t
omegaM %d %.3lf %.3lf
\n
"
,
cblock
[
OMEGAM
],
clmin
.
omegaM
,
clmax
.
omegaM
);
fprintf
(
besto
,
"
\t
omegaX %d %.3lf %.3lf
\n
"
,
cblock
[
OMEGAX
],
clmin
.
omegaX
,
clmax
.
omegaX
);
fprintf
(
besto
,
"
\t
wX %d %.3lf %.3lf
\n
"
,
cblock
[
WX
],
clmin
.
wX
,
clmax
.
wX
);
fprintf
(
besto
,
"
\t
wa %d %.3lf %.3lf
\n
"
,
cblock
[
WA
],
clmin
.
wa
,
clmax
.
wa
);
fprintf
(
besto
,
"
\t
end
\n
"
);
// CHAMP
fprintf
(
besto
,
"champ
\n
"
);
fprintf
(
besto
,
"
\t
xmin %.3lf
\n
"
,
F
.
xmin
);
fprintf
(
besto
,
"
\t
xmax %.3lf
\n
"
,
F
.
xmax
);
fprintf
(
besto
,
"
\t
ymin %.3lf
\n
"
,
F
.
ymin
);
fprintf
(
besto
,
"
\t
ymax %.3lf
\n
"
,
F
.
ymax
);
fprintf
(
besto
,
"
\t
end
\n
"
);
if
(
F
.
lmin
>
0
)
{
fprintf
(
besto
,
"
\t
lmin %.3lf
\n
"
,
F
.
lmin
);
fprintf
(
besto
,
"
\t
lmax %.3lf
\n
"
,
F
.
lmax
);
}
fprintf
(
besto
,
"
\t
end
\n
"
);
fprintf
(
besto
,
"fini
\n
"
);
fclose
(
besto
);
// Write the arclet.best file
if
(
I
.
stat
==
1
)
{
for
(
i
=
0
;
i
<
S
.
ns
;
i
++
)
{
z_dlsds
=
arclet
[
i
].
dr
;
arclet
[
i
].
z
=
zero
(
lens
[
0
].
z
,
100.
,
fz_dlsds
);
};
ecrire_r
(
0
,
S
.
ns
,
arclet
,
"arclet.best"
,
1
);
}
}
/* Write a potentiel section in best file
* flag = 1 : print values in arcsec
* flag = 2 : print values in kpc
* flag = 3 : print values in arcsec and kpc
*/
static
void
writePotentiel
(
FILE
*
best
,
long
int
i
,
int
flag
)
{
extern
struct
pot
lens
[];
fprintf
(
best
,
"potentiel %s
\n
"
,
lens
[
i
].
n
);
fprintf
(
best
,
"
\t
profil %d
\n
"
,
lens
[
i
].
type
);
if
(
lens
[
i
].
type
==
9
)
{
fprintf
(
best
,
"
\t
rhos %.4lf
\n
"
,
lens
[
i
].
pmass
);
fprintf
(
best
,
"
\t
z_lens %.4lf
\n
"
,
lens
[
i
].
z
);
fprintf
(
best
,
"
\t
end
\n
"
);
return
;
}
if
(
lens
[
i
].
type
==
14
)
{
fprintf
(
best
,
"
\t
gamma %.4lf
\n
"
,
lens
[
i
].
emass
);
fprintf
(
best
,
"
\t
angle_pos %.4lf
\n
"
,
lens
[
i
].
theta
*
RTD
);
fprintf
(
best
,
"
\t
z_lens %.4lf
\n
"
,
lens
[
i
].
z
);
fprintf
(
best
,
"
\t
end
\n
"
);
return
;
}
fprintf
(
best
,
"
\t
x_centre %.3lf
\n
"
,
lens
[
i
].
C
.
x
);
fprintf
(
best
,
"
\t
y_centre %.3lf
\n
"
,
lens
[
i
].
C
.
y
);
if
(
lens
[
i
].
type
!=
0
&&
lens
[
i
].
type
!=
2
&&
lens
[
i
].
type
!=
7
)
{
fprintf
(
best
,
"
\t
ellipticite %.3lf
\n
"
,
lens
[
i
].
emass
);
if
(
lens
[
i
].
type
==
121
)
{
fprintf
(
best
,
"
\t
theta %.3lf
\n
"
,
lens
[
i
].
theta
*
RTD
);
// triaxial NFW
fprintf
(
best
,
"
\t
phi %.3lf
\n
"
,
lens
[
i
].
phi
*
RTD
);
}
else
fprintf
(
best
,
"
\t
angle_pos %.3lf
\n
"
,
lens
[
i
].
theta
*
RTD
);
}
if
(
lens
[
i
].
type
==
12
)
{
if
(
flag
&
1
)
fprintf
(
best
,
"
\t
scale_radius %.3lf
\n
"
,
lens
[
i
].
rc
);
if
(
flag
&
2
)
fprintf
(
best
,
"
\t
scale_radius_kpc %.3lf
\n
"
,
lens
[
i
].
rckpc
);
if
(
lens
[
i
].
rcut
!=
DBL_MAX
)
{
if
(
flag
&
1
)
fprintf
(
best
,
"
\t
r200 %.3lf
\n
"
,
lens
[
i
].
rcut
);
if
(
flag
&
2
)
fprintf
(
best
,
"
\t
r200_kpc %.3lf
\n
"
,
lens
[
i
].
rcutkpc
);
}
fprintf
(
best
,
"
\t
v_disp %.3lf
\n
"
,
lens
[
i
].
sigma
);
fprintf
(
best
,
"
\t
concentration %.3lf
\n
"
,
lens
[
i
].
beta
);
fprintf
(
best
,
"
\t
m200 %.3le
\n
"
,
lens
[
i
].
masse
);
fprintf
(
best
,
"
\t
rhos %.3le
\n
"
,
lens
[
i
].
pmass
);
fprintf
(
best
,
"
\t
rc_slope %.3lf
\n
"
,
lens
[
i
].
rcslope
);
/////////////////
fprintf
(
best
,
"
\t
alpha %.3lf
\n
"
,
lens
[
i
].
alpha
);
}
else
if
(
lens
[
i
].
type
==
16
)
{
if
(
flag
&
1
)
fprintf
(
best
,
"
\t
scale_radius %.3lf
\n
"
,
lens
[
i
].
rc
);
if
(
flag
&
2
)
fprintf
(
best
,
"
\t
scale_radius_kpc %.3lf
\n
"
,
lens
[
i
].
rckpc
);
fprintf
(
best
,
"
\t
v_disp %.3lf
\n
"
,
lens
[
i
].
sigma
);
}
else
{
if
(
lens
[
i
].
type
!=
0
&&
fabs
(
lens
[
i
].
type
)
!=
1
&&
lens
[
i
].
type
!=
7
)
{
if
(
flag
&
1
)
fprintf
(
best
,
"
\t
core_radius %.3lf
\n
"
,
lens
[
i
].
rc
);
if
(
flag
&
2
)
fprintf
(
best
,
"
\t
core_radius_kpc %.3lf
\n
"
,
lens
[
i
].
rckpc
);
}
if
(
lens
[
i
].
rcut
!=
DBL_MAX
)
{
if
(
flag
&
1
)
fprintf
(
best
,
"
\t
cut_radius %.3lf
\n
"
,
lens
[
i
].
rcut
);
if
(
flag
&
2
)
fprintf
(
best
,
"
\t
cut_radius_kpc %.3lf
\n
"
,
lens
[
i
].
rcutkpc
);
}
if
(
lens
[
i
].
type
==
13
)
{
fprintf
(
best
,
"
\t
sigma_e %.3le
\n
"
,
lens
[
i
].
sigma
);
fprintf
(
best
,
"
\t
n %.3lf
\n
"
,
lens
[
i
].
alpha
);
}
else
fprintf
(
best
,
"
\t
v_disp %.3lf
\n
"
,
lens
[
i
].
sigma
);
if
(
lens
[
i
].
type
==
3
||
lens
[
i
].
type
==
6
||
lens
[
i
].
type
==
84
||
lens
[
i
].
type
==
87
||
lens
[
i
].
type
==
88
)
fprintf
(
best
,
"
\t
alpha %.3lf
\n
"
,
lens
[
i
].
alpha
);
if
(
lens
[
i
].
type
==
6
||
lens
[
i
].
type
==
89
)
{
fprintf
(
best
,
"
\t
beta %.3lf
\n
"
,
lens
[
i
].
beta
);
fprintf
(
best
,
"
\t
rc_slope %.3lf
\n
"
,
lens
[
i
].
rcslope
);
}
if
(
lens
[
i
].
type
==
7
)
fprintf
(
best
,
"
\t
masse %.3lf
\n
"
,
lens
[
i
].
masse
);
}
if
(
lens
[
i
].
mag
!=
0
)
fprintf
(
best
,
"
\t
mag %.3lf
\n
"
,
lens
[
i
].
mag
);
fprintf
(
best
,
"
\t
z_lens %.4lf
\n
"
,
lens
[
i
].
z
);
fprintf
(
best
,
"
\t
end
\n
"
);
}
/* Write a Limit section */
static
void
writeLimit
(
FILE
*
best
,
long
int
i
)
{
extern
struct
g_grille
G
;
extern
int
block
[][
NPAMAX
];
extern
struct
pot
lens
[],
lmin
[],
lmax
[],
prec
[];
fprintf
(
best
,
"limit %s
\n
"
,
lens
[
i
].
n
);
if
(
block
[
i
][
CX
]
!=
0
)
fprintf
(
best
,
"
\t
x_centre %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
CX
],
lmin
[
i
].
C
.
x
,
lmax
[
i
].
C
.
x
,
prec
[
i
].
C
.
x
);
if
(
block
[
i
][
CY
]
!=
0
)
fprintf
(
best
,
"
\t
y_centre %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
CY
],
lmin
[
i
].
C
.
y
,
lmax
[
i
].
C
.
y
,
prec
[
i
].
C
.
y
);
if
(
lens
[
i
].
type
!=
0
&&
lens
[
i
].
type
!=
2
&&
lens
[
i
].
type
!=
7
)
{
if
(
block
[
i
][
EPOT
]
!=
0
)
fprintf
(
best
,
"
\t
ellip_pot %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
EPOT
],
lmin
[
i
].
epot
,
lmax
[
i
].
epot
,
prec
[
i
].
epot
);
if
(
block
[
i
][
EMASS
]
!=
0
)
fprintf
(
best
,
"
\t
ellipticite %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
EMASS
],
lmin
[
i
].
emass
,
lmax
[
i
].
emass
,
prec
[
i
].
epot
);
if
(
block
[
i
][
THETA
]
!=
0
)
fprintf
(
best
,
"
\t
angle_pos %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
THETA
],
lmin
[
i
].
theta
*
RTD
,
lmax
[
i
].
theta
*
RTD
,
prec
[
i
].
theta
*
RTD
);
if
(
block
[
i
][
PHI
]
!=
0
)
fprintf
(
best
,
"
\t
phi %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
PHI
],
lmin
[
i
].
phi
*
RTD
,
lmax
[
i
].
phi
*
RTD
,
prec
[
i
].
phi
*
RTD
);
}
if
(
lens
[
i
].
type
==
12
||
lens
[
i
].
type
==
16
)
{
if
(
block
[
i
][
RC
]
!=
0
)
fprintf
(
best
,
"
\t
scale_radius_kpc %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
RC
],
lmin
[
i
].
rckpc
,
lmax
[
i
].
rckpc
,
prec
[
i
].
rckpc
);
if
(
lens
[
i
].
rcut
!=
DBL_MAX
&&
block
[
i
][
RCUT
]
!=
0
)
fprintf
(
best
,
"
\t
virial_radius_kpc %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
RCUT
],
lmin
[
i
].
rcutkpc
,
lmax
[
i
].
rcutkpc
,
prec
[
i
].
rcutkpc
);
if
(
block
[
i
][
BETA
]
!=
0
)
fprintf
(
best
,
"
\t
concentration %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
BETA
],
lmin
[
i
].
beta
,
lmax
[
i
].
beta
,
prec
[
i
].
beta
);
if
(
block
[
i
][
MASSE
]
!=
0
)
fprintf
(
best
,
"
\t
virial_mass %d %.3le %.3le %.3le
\n
"
,
block
[
i
][
MASSE
],
lmin
[
i
].
masse
,
lmax
[
i
].
masse
,
prec
[
i
].
masse
);
if
(
block
[
i
][
PMASS
]
!=
0
)
fprintf
(
best
,
"
\t
rhos %d %.3le %.3le %.3le
\n
"
,
block
[
i
][
PMASS
],
lmin
[
i
].
pmass
,
lmax
[
i
].
pmass
,
prec
[
i
].
pmass
);
if
(
block
[
i
][
RCSLOPE
]
!=
0
)
fprintf
(
best
,
"
\t
rc_slope %d %.3le %.3le %.3le
\n
"
,
block
[
i
][
RCSLOPE
],
lmin
[
i
].
rcslope
,
lmax
[
i
].
rcslope
,
prec
[
i
].
rcslope
);
////
}
else
{
if
(
block
[
i
][
RC
]
!=
0
)
fprintf
(
best
,
"
\t
core_radius_kpc %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
RC
],
lmin
[
i
].
rckpc
,
lmax
[
i
].
rckpc
,
prec
[
i
].
rckpc
);
if
(
lens
[
i
].
rcut
!=
DBL_MAX
&&
block
[
i
][
RCUT
]
!=
0
)
fprintf
(
best
,
"
\t
cut_radius_kpc %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
RCUT
],
lmin
[
i
].
rcutkpc
,
lmax
[
i
].
rcutkpc
,
prec
[
i
].
rcutkpc
);
if
(
lens
[
i
].
type
==
6
||
lens
[
i
].
type
==
89
)
if
(
block
[
i
][
BETA
]
!=
0
)
fprintf
(
best
,
"
\t
beta %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
BETA
],
lmin
[
i
].
beta
,
lmax
[
i
].
beta
,
prec
[
i
].
beta
);
if
(
lens
[
i
].
type
==
7
)
if
(
block
[
i
][
MASSE
]
!=
0
)
fprintf
(
best
,
"
\t
masse %d %.3le %.3le %.3le
\n
"
,
block
[
i
][
MASSE
],
lmin
[
i
].
masse
,
lmax
[
i
].
masse
,
prec
[
i
].
masse
);
}
if
(
block
[
i
][
B0
]
!=
0
)
{
if
(
lens
[
i
].
type
==
13
)
fprintf
(
best
,
"
\t
sigma_e %d %.3le %.3le %.3le
\n
"
,
block
[
i
][
B0
],
lmin
[
i
].
sigma
,
lmax
[
i
].
sigma
,
prec
[
i
].
sigma
);
else
fprintf
(
best
,
"
\t
v_disp %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
B0
],
lmin
[
i
].
sigma
,
lmax
[
i
].
sigma
,
prec
[
i
].
sigma
);
}
if
(
i
>=
G
.
nmsgrid
)
{
if
(
block
[
i
][
B0
]
!=
0
)
fprintf
(
best
,
"
\t
v_disp %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
B0
],
lmin
[
i
].
sigma
,
lmax
[
i
].
sigma
,
prec
[
i
].
sigma
);
else
fprintf
(
best
,
"
\t
rhos %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
PMASS
],
lmin
[
i
].
pmass
,
lmax
[
i
].
pmass
,
prec
[
i
].
pmass
);
}
if
(
block
[
i
][
ALPHA
]
!=
0
)
fprintf
(
best
,
"
\t
alpha %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
ALPHA
],
lmin
[
i
].
alpha
,
lmax
[
i
].
alpha
,
prec
[
i
].
alpha
);
if
(
block
[
i
][
ZLENS
]
!=
0
)
fprintf
(
best
,
"
\t
z_lens %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
ZLENS
],
lmin
[
i
].
z
,
lmax
[
i
].
z
,
prec
[
i
].
z
);
if
(
block
[
i
][
PMASS
]
!=
0
&&
lens
[
i
].
type
==
9
)
fprintf
(
best
,
"
\t
rhos %d %.3lf %.3lf %.3lf
\n
"
,
block
[
i
][
PMASS
],
lmin
[
i
].
pmass
,
lmax
[
i
].
pmass
,
prec
[
i
].
pmass
);
fprintf
(
best
,
"
\t
end
\n
"
);
}
Event Timeline
Log In to Comment