Commit a9446199 authored by Emmanuel Bertin's avatar Emmanuel Bertin
Browse files

Fixed model-fitting issue with empty images in dual-image mode (thanks to V....

Fixed model-fitting issue with empty images in dual-image mode (thanks to V. de Lapparent for reporting).
Updated LevMar to version 2.5.
Updated URLs in various places.
Pushed version number to 2.12.1.
No related merge requests found
Showing with 46 additions and 38 deletions
+46 -38
function x = modhs76(p)
x(1)=p(1);
x(2)=sqrt(0.5)*p(2);
x(3)=p(3);
x(4)=sqrt(0.5)*p(4);
function x = osborne(p)
n=33;
for i=1:n
t=10*(i-1);
x(i)=p(1) + p(2)*exp(-p(4)*t) + p(3)*exp(-p(5)*t);
end
......@@ -28,7 +28,7 @@
#include <math.h>
#include <float.h>
#include "lm.h"
#include "levmar.h"
#include "misc.h"
#if !defined(LM_DBL_PREC) && !defined(LM_SNGL_PREC)
......
......@@ -579,8 +579,8 @@ int rnk;
LM_REAL fact;
#ifdef HAVE_LAPACK
rnk=LEVMAR_PSEUDOINVERSE(JtJ, C, m);
if(!rnk) return 0;
rnk=LEVMAR_PSEUDOINVERSE(JtJ, C, m);
if(!rnk) return 0;
#else
#ifdef _MSC_VER
#pragma message("LAPACK not available, LU will be used for matrix inversion when computing the covariance; this might be unstable at times")
......@@ -592,10 +592,9 @@ LM_REAL fact;
// rnk=LEVMAR_LUINVERSE(JtJ, C, m);
rnk = SVDINV(JtJ, C, m);
rnk = SVDINV(JtJ, C, m);
if (!rnk)
return 0;
if (!rnk) return 0;
// rnk=m; /* assume full rank */
#endif /* HAVE_LAPACK */
......@@ -689,12 +688,6 @@ register int i;
#ifdef HAVE_LAPACK
/* compute the Cholesky decomposition of C in W, s.t. C=W^t W and W is upper triangular */
int LEVMAR_CHOLESKY(LM_REAL *C, LM_REAL *W, int m)
{
register int i, j;
int info;
/* compute the Cholesky decomposition of C in W, s.t. C=W^t W and W is upper triangular */
int LEVMAR_CHOLESKY(LM_REAL *C, LM_REAL *W, int m)
{
......@@ -711,13 +704,13 @@ int info;
POTF2("U", (int *)&m, W, (int *)&m, (int *)&info);
/* error treatment */
if(info!=0){
if(info<0){
if(info<0){
fprintf(stderr, "LAPACK error: illegal value for argument %d of dpotf2 in %s\n", -info, LCAT(LEVMAR_CHOLESKY, "()"));
}
else{
fprintf(stderr, "LAPACK error: the leading minor of order %d is not positive definite,\n%s()\n", info,
RCAT("and the Cholesky factorization could not be completed in ", LEVMAR_CHOLESKY));
}
}
else{
fprintf(stderr, "LAPACK error: the leading minor of order %d is not positive definite,\n%s()\n", info,
RCAT("and the Cholesky factorization could not be completed in ", LEVMAR_CHOLESKY));
}
return LM_ERROR;
}
......@@ -783,12 +776,12 @@ register LM_REAL sum0=0.0, sum1=0.0, sum2=0.0, sum3=0.0;
switch(n - i){
case 7 : e[i]=x[i]-y[i]; sum0+=e[i]*e[i]; ++i;
case 6 : e[i]=x[i]-y[i]; sum0+=e[i]*e[i]; ++i;
case 5 : e[i]=x[i]-y[i]; sum0+=e[i]*e[i]; ++i;
case 4 : e[i]=x[i]-y[i]; sum0+=e[i]*e[i]; ++i;
case 6 : e[i]=x[i]-y[i]; sum1+=e[i]*e[i]; ++i;
case 5 : e[i]=x[i]-y[i]; sum2+=e[i]*e[i]; ++i;
case 4 : e[i]=x[i]-y[i]; sum3+=e[i]*e[i]; ++i;
case 3 : e[i]=x[i]-y[i]; sum0+=e[i]*e[i]; ++i;
case 2 : e[i]=x[i]-y[i]; sum0+=e[i]*e[i]; ++i;
case 1 : e[i]=x[i]-y[i]; sum0+=e[i]*e[i]; ++i;
case 2 : e[i]=x[i]-y[i]; sum1+=e[i]*e[i]; ++i;
case 1 : e[i]=x[i]-y[i]; sum2+=e[i]*e[i]; //++i;
}
}
}
......@@ -818,12 +811,12 @@ register LM_REAL sum0=0.0, sum1=0.0, sum2=0.0, sum3=0.0;
switch(n - i){
case 7 : e[i]=-y[i]; sum0+=e[i]*e[i]; ++i;
case 6 : e[i]=-y[i]; sum0+=e[i]*e[i]; ++i;
case 5 : e[i]=-y[i]; sum0+=e[i]*e[i]; ++i;
case 4 : e[i]=-y[i]; sum0+=e[i]*e[i]; ++i;
case 6 : e[i]=-y[i]; sum1+=e[i]*e[i]; ++i;
case 5 : e[i]=-y[i]; sum2+=e[i]*e[i]; ++i;
case 4 : e[i]=-y[i]; sum3+=e[i]*e[i]; ++i;
case 3 : e[i]=-y[i]; sum0+=e[i]*e[i]; ++i;
case 2 : e[i]=-y[i]; sum0+=e[i]*e[i]; ++i;
case 1 : e[i]=-y[i]; sum0+=e[i]*e[i]; ++i;
case 2 : e[i]=-y[i]; sum1+=e[i]*e[i]; ++i;
case 1 : e[i]=-y[i]; sum2+=e[i]*e[i]; //++i;
}
}
}
......
......@@ -9,7 +9,7 @@
*
* Contents: Fit an arbitrary profile combination to a detection.
*
* Last modify: 19/08/2010
* Last modify: 26/08/2010
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -31,7 +31,7 @@
#include "globals.h"
#include "prefs.h"
#include "fits/fitscat.h"
#include "levmar/lm.h"
#include "levmar/levmar.h"
#include "fft.h"
#include "fitswcs.h"
#include "check.h"
......@@ -199,14 +199,13 @@ OUTPUT Pointer to an allocated fit structure (containing details about the
fit).
NOTES It is a modified version of the lm_minimize() of lmfit.
AUTHOR E. Bertin (IAP)
VERSION 08/03/2010
VERSION 26/08/2010
***/
void profit_fit(profitstruct *profit,
picstruct *field, picstruct *wfield,
objstruct *obj, obj2struct *obj2)
{
profitstruct pprofit;
profitstruct hdprofit;
patternstruct *pattern;
psfstruct *psf;
checkstruct *check;
......@@ -2450,7 +2449,7 @@ INPUT Pointer to the profit structure,
OUTPUT -.
NOTES -.
AUTHOR E. Bertin (IAP)
VERSION 02/07/2010
VERSION 26/08/2010
***/
void profit_resetparam(profitstruct *profit, paramenum paramtype)
{
......@@ -2631,6 +2630,8 @@ void profit_resetparam(profitstruct *profit, paramenum paramtype)
if (parammin!=parammax && (param<=parammin || param>=parammax))
param = (parammin+parammax)/2.0;
else if (parammin==0.0 && parammax==0.0)
parammax = 1.0;
profit_setparam(profit, paramtype, param, parammin, parammax);
return;
......
......@@ -16,8 +16,8 @@
<xsl:variable name="time" select="/VOTABLE/RESOURCE/RESOURCE[@name='MetaData']/PARAM[@name='Time']/@value"/>
<HTML>
<HEAD>
<link rel="shortcut icon" type="image/x-icon" href="http://astromatic.iap.fr/xsl/favicon.ico" />
<script type="text/javascript" src="http://astromatic.iap.fr/xsl/sorttable.js"/>
<link rel="shortcut icon" type="image/x-icon" href="http://astromatic.net/xsl/favicon.ico" />
<script type="text/javascript" src="http://astromatic.net/xsl/sorttable.js"/>
<style type="text/css">
p {
......@@ -27,7 +27,7 @@
body {
margin: 10px;
background-color: #e0e0e0;
background-image: url("http://astromatic.iap.fr/xsl/body_bg.jpg");
background-image: url("http://astromatic.net/xsl/body_bg.jpg");
background-repeat: repeat-x;
background-position: top;
min-width:662px;
......@@ -65,7 +65,7 @@
#header {
padding: 5px;
min-width: 662px;
background-image: url("http://astromatic.iap.fr/xsl/astromaticleft.png");
background-image: url("http://astromatic.net/xsl/astromaticleft.png");
background-repeat: repeat-x;
background-position: left top;
text-align: left;
......@@ -132,7 +132,7 @@
</HEAD>
<BODY>
<div id="header">
<a href="/"><img style="vertical-align: middle; border:0px" src="http://astromatic.iap.fr/xsl/astromatic.png" title="Astromatic home" alt="Astromatic.net" /></a> Processing summary
<a href="/"><img style="vertical-align: middle; border:0px" src="http://astromatic.net/xsl/astromatic.png" title="Astromatic home" alt="Astromatic.net" /></a> Processing summary
</div>
<xsl:call-template name="VOTable"/>
</BODY>
......
Supports Markdown
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