Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-pipeline
msc
sextractor
Commits
cf8aa6bd
Commit
cf8aa6bd
authored
Apr 28, 2009
by
Emmanuel Bertin
Browse files
Fixed bug in make_kernel() test bug (thanks to R.Owen).
parent
c306ea86
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/profit.c
View file @
cf8aa6bd
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
*
*
* Contents: Fit an arbitrary profile combination to a detection.
* Contents: Fit an arbitrary profile combination to a detection.
*
*
* Last modify: 2
0
/0
3
/2009
* Last modify: 2
8
/0
4
/2009
*
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
*/
...
@@ -168,7 +168,7 @@ OUTPUT Pointer to an allocated fit structure (containing details about the
...
@@ -168,7 +168,7 @@ OUTPUT Pointer to an allocated fit structure (containing details about the
fit).
fit).
NOTES It is a modified version of the lm_minimize() of lmfit.
NOTES It is a modified version of the lm_minimize() of lmfit.
AUTHOR E. Bertin (IAP)
AUTHOR E. Bertin (IAP)
VERSION
20
/0
3
/2009
VERSION
15
/0
4
/2009
***/
***/
void
profit_fit
(
profitstruct
*
profit
,
void
profit_fit
(
profitstruct
*
profit
,
picstruct
*
field
,
picstruct
*
wfield
,
picstruct
*
field
,
picstruct
*
wfield
,
...
@@ -178,9 +178,8 @@ void profit_fit(profitstruct *profit,
...
@@ -178,9 +178,8 @@ void profit_fit(profitstruct *profit,
patternstruct
*
pattern
;
patternstruct
*
pattern
;
psfstruct
*
psf
;
psfstruct
*
psf
;
checkstruct
*
check
;
checkstruct
*
check
;
double
*
oldparaminit
,
double
psf_fwhm
,
a
,
cp
,
sp
,
emx2
,
emy2
,
emxy
,
dchi2
;
psf_fwhm
,
oldchi2
,
a
,
cp
,
sp
,
emx2
,
emy2
,
emxy
,
dchi2
;
int
i
,
j
,
p
,
nparam
,
ncomp
;
int
i
,
j
,
p
,
oldniter
,
nparam
,
ncomp
;
nparam
=
profit
->
nparam
;
nparam
=
profit
->
nparam
;
if
(
profit
->
psfdft
)
if
(
profit
->
psfdft
)
...
@@ -256,7 +255,7 @@ the_gal++;
...
@@ -256,7 +255,7 @@ the_gal++;
/* Actual minimisation */
/* Actual minimisation */
profit
->
niter
=
profit_minimize
(
profit
,
PROFIT_MAXITER
);
profit
->
niter
=
profit_minimize
(
profit
,
PROFIT_MAXITER
);
profit_residuals
(
profit
,
field
,
wfield
,
0
.
0
,
profit
->
param
,
profit
->
resi
);
profit_residuals
(
profit
,
field
,
wfield
,
1
0
.
0
,
profit
->
param
,
profit
->
resi
);
/*
/*
QMEMCPY(profit->paraminit, oldparaminit, double, nparam);
QMEMCPY(profit->paraminit, oldparaminit, double, nparam);
...
@@ -536,7 +535,7 @@ the_gal++;
...
@@ -536,7 +535,7 @@ the_gal++;
}
}
pprofit
.
paraminit
[
pprofit
.
paramindex
[
PARAM_DISK_FLUX
]]
=
profit
->
flux
;
pprofit
.
paraminit
[
pprofit
.
paramindex
[
PARAM_DISK_FLUX
]]
=
profit
->
flux
;
pprofit
.
niter
=
profit_minimize
(
&
pprofit
,
PROFIT_MAXITER
);
pprofit
.
niter
=
profit_minimize
(
&
pprofit
,
PROFIT_MAXITER
);
profit_residuals
(
&
pprofit
,
field
,
wfield
,
0
.
0
,
pprofit
.
param
,
pprofit
.
resi
);
profit_residuals
(
&
pprofit
,
field
,
wfield
,
1
0
.
0
,
pprofit
.
param
,
pprofit
.
resi
);
dchi2
=
0
.
5
*
(
pprofit
.
chi2
-
profit
->
chi2
);
dchi2
=
0
.
5
*
(
pprofit
.
chi2
-
profit
->
chi2
);
obj2
->
prof_class_star
=
dchi2
<
50
.
0
?
obj2
->
prof_class_star
=
dchi2
<
50
.
0
?
(
dchi2
>
-
50
.
0
?
2
.
0
/
(
1
.
0
+
exp
(
dchi2
))
:
2
.
0
)
:
0
.
0
;
(
dchi2
>
-
50
.
0
?
2
.
0
/
(
1
.
0
+
exp
(
dchi2
))
:
2
.
0
)
:
0
.
0
;
...
@@ -820,12 +819,12 @@ INPUT Profile-fitting structure,
...
@@ -820,12 +819,12 @@ INPUT Profile-fitting structure,
OUTPUT Vector of residuals.
OUTPUT Vector of residuals.
NOTES -.
NOTES -.
AUTHOR E. Bertin (IAP)
AUTHOR E. Bertin (IAP)
VERSION
20
/0
3
/2009
VERSION
15
/0
4
/2009
***/
***/
double
*
profit_compresi
(
profitstruct
*
profit
,
double
dynparam
,
double
*
resi
)
double
*
profit_compresi
(
profitstruct
*
profit
,
double
dynparam
,
double
*
resi
)
{
{
double
*
resit
,
double
*
resit
,
error
,
x1c
,
x1
,
x2
,
rmin
;
error
,
x1c
,
x2
,
rmin
;
PIXTYPE
*
objpix
,
*
objweight
,
*
lmodpix
,
PIXTYPE
*
objpix
,
*
objweight
,
*
lmodpix
,
val
,
val2
,
wval
,
invsig
;
val
,
val2
,
wval
,
invsig
;
int
npix
,
i
;
int
npix
,
i
;
...
@@ -2550,12 +2549,12 @@ INPUT Position,
...
@@ -2550,12 +2549,12 @@ INPUT Position,
OUTPUT -.
OUTPUT -.
NOTES -.
NOTES -.
AUTHOR E. Bertin (IAP)
AUTHOR E. Bertin (IAP)
VERSION
11
/04/200
8
VERSION
28
/04/200
9
***/
***/
void
make_kernel
(
double
pos
,
double
*
kernel
,
interpenum
interptype
)
void
make_kernel
(
double
pos
,
double
*
kernel
,
interpenum
interptype
)
{
{
double
x
,
val
,
sinx1
,
sinx2
,
sinx3
,
cosx1
;
double
x
,
val
,
sinx1
,
sinx2
,
sinx3
,
cosx1
;
printf
(
"%g
\n
"
,
pos
);
if
(
interptype
==
INTERP_NEARESTNEIGHBOUR
)
if
(
interptype
==
INTERP_NEARESTNEIGHBOUR
)
*
kernel
=
1
;
*
kernel
=
1
;
else
if
(
interptype
==
INTERP_BILINEAR
)
else
if
(
interptype
==
INTERP_BILINEAR
)
...
@@ -2565,7 +2564,7 @@ void make_kernel(double pos, double *kernel, interpenum interptype)
...
@@ -2565,7 +2564,7 @@ void make_kernel(double pos, double *kernel, interpenum interptype)
}
}
else
if
(
interptype
==
INTERP_LANCZOS2
)
else
if
(
interptype
==
INTERP_LANCZOS2
)
{
{
if
(
pos
<
1e-5
&&
pos
>-
1e5
)
if
(
pos
<
1e-5
&&
pos
>-
1e
-
5
)
{
{
*
(
kernel
++
)
=
0
.
0
;
*
(
kernel
++
)
=
0
.
0
;
*
(
kernel
++
)
=
1
.
0
;
*
(
kernel
++
)
=
1
.
0
;
...
@@ -2597,7 +2596,7 @@ void make_kernel(double pos, double *kernel, interpenum interptype)
...
@@ -2597,7 +2596,7 @@ void make_kernel(double pos, double *kernel, interpenum interptype)
}
}
else
if
(
interptype
==
INTERP_LANCZOS3
)
else
if
(
interptype
==
INTERP_LANCZOS3
)
{
{
if
(
pos
<
1e-5
&&
pos
>-
1e5
)
if
(
pos
<
1e-5
&&
pos
>-
1e
-
5
)
{
{
*
(
kernel
++
)
=
0
.
0
;
*
(
kernel
++
)
=
0
.
0
;
*
(
kernel
++
)
=
0
.
0
;
*
(
kernel
++
)
=
0
.
0
;
...
@@ -2639,7 +2638,7 @@ void make_kernel(double pos, double *kernel, interpenum interptype)
...
@@ -2639,7 +2638,7 @@ void make_kernel(double pos, double *kernel, interpenum interptype)
}
}
else
if
(
interptype
==
INTERP_LANCZOS4
)
else
if
(
interptype
==
INTERP_LANCZOS4
)
{
{
if
(
pos
<
1e-5
&&
pos
>-
1e5
)
if
(
pos
<
1e-5
&&
pos
>-
1e
-
5
)
{
{
*
(
kernel
++
)
=
0
.
0
;
*
(
kernel
++
)
=
0
.
0
;
*
(
kernel
++
)
=
0
.
0
;
*
(
kernel
++
)
=
0
.
0
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment