Commit 835daf4c authored by Johan Richard's avatar Johan Richard
Browse files

Corrected output and compute d_profile for double Sersic

parent 542d87fd
......@@ -26,11 +26,12 @@
double d_profil(double x, double y, const struct galaxie *gal)
{
double xx, yy, xxx, yyy;
double res;
double res,res2;
const extern struct g_observ O;
const extern struct g_large L;
res = 0;
res2 = 0;
//jrichard
//Test E.b according to E.a and eps
......@@ -119,6 +120,19 @@ double d_profil(double x, double y, const struct galaxie *gal)
else
res = 0.;
}
/* Sersic */
else if (L.vitesse == 6 || gal->type == 6)
{
xx = ((x - gal->C.x) * sin(gal->E.theta) - (y - gal->C.y) * cos(gal->E.theta)) / gal->E.b;
yy = ((y - gal->C.y) * sin(gal->E.theta) + (x - gal->C.x) * cos(gal->E.theta)) / gal->E.a;
res = exp(pow(xx * xx + yy * yy, 0.5/gal->var1));
res = pow(10., (26. - gal->mag) / 2.5) / res;
xx = ((x - gal->C.x) * sin(gal->E2.theta) - (y - gal->C.y) * cos(gal->E2.theta)) / gal->E2.b;
yy = ((y - gal->C.y) * sin(gal->E2.theta) + (x - gal->C.x) * cos(gal->E2.theta)) / gal->E2.a;
res2 = exp(pow(xx * xx + yy * yy, 0.5/gal->var2));
res2 = pow(10., (26. - gal->mag2) / 2.5) / res2;
res += res2;
}
else
{
fprintf(stderr, "ERROR: source %s brightness profil type %d unknown\n", gal->n, gal->type);
......
......@@ -288,18 +288,18 @@ void o_print_res(double chi0, double evidence)
fprintf(best, "\ttype %d\n", source[i].type);
fprintf(best, "\ts_center_x %.6lf\n", source[i].C.x);
fprintf(best, "\ts_center_y %.6lf\n", source[i].C.y);
fprintf(best, "\ts_angle %.6lf\n", source[i].E.theta * RTD);
fprintf(best, "\ts_sigx %.6lf\n", source[i].E.a);
fprintf(best, "\ts_sigy %.6lf\n", source[i].E.b);
fprintf(best, "\ts_eps %.6lf\n", source[i].eps);
fprintf(best, "\ts_angle %.6lf\n", source[i].E.theta * RTD);
fprintf(best, "\tmag %.6lf\n", source[i].mag);
fprintf(best, "\tindex %.6lf\n", source[i].var1);
if(source[i].type==6) // double Sersic
{
fprintf(best, "\ts_angle2 %.6lf\n", source[i].E2.theta * RTD);
fprintf(best, "\ts_sigx2 %.6lf\n", source[i].E2.a);
fprintf(best, "\ts_sigy2 %.6lf\n", source[i].E2.b);
fprintf(best, "\ts_eps2 %.6lf\n", source[i].eps2);
fprintf(best, "\ts_angle2 %.6lf\n", source[i].E2.theta * RTD);
fprintf(best, "\tmag2 %.6lf\n", source[i].mag2);
fprintf(best, "\tindex2 %.6lf\n", source[i].var2);
}
......@@ -584,18 +584,18 @@ void o_print_res(double chi0, double evidence)
fprintf(besto, "\ttype %d\n", source[i].type);
fprintf(besto, "\ts_center_x %.6lf\n", source[i].C.x);
fprintf(besto, "\ts_center_y %.6lf\n", source[i].C.y);
fprintf(besto, "\ts_angle %.6lf\n", source[i].E.theta * RTD);
fprintf(besto, "\ts_sigx %.6lf\n", source[i].E.a);
fprintf(besto, "\ts_sigy %.6lf\n", source[i].E.b);
fprintf(besto, "\ts_eps %.6lf\n", source[i].eps);
fprintf(besto, "\ts_angle %.6lf\n", source[i].E.theta * RTD);
fprintf(besto, "\ts_mag %.6lf\n", source[i].mag);
fprintf(besto, "\tindex %.6lf\n", source[i].var1);
if(source[i].type==6) //double Sersic
{
fprintf(besto, "\ts_angle2 %.6lf\n", source[i].E2.theta * RTD);
fprintf(besto, "\ts_sigx2 %.6lf\n", source[i].E2.a);
fprintf(besto, "\ts_sigy2 %.6lf\n", source[i].E2.b);
fprintf(besto, "\ts_eps2 %.6lf\n", source[i].eps2);
fprintf(besto, "\ts_angle2 %.6lf\n", source[i].E2.theta * RTD);
fprintf(besto, "\ts_mag2 %.6lf\n", source[i].mag2);
fprintf(besto, "\tindex2 %.6lf\n", source[i].var2);
fprintf(besto, "\tend\n");
......@@ -607,24 +607,24 @@ void o_print_res(double chi0, double evidence)
fprintf(besto, "\ts_center_x %d %.6lf %.6lf\n", sblock[i][SCX], smin[i].C.x, smax[i].C.x);
if( sblock[i][SCY] )
fprintf(besto, "\ts_center_y %d %.6lf %.6lf\n", sblock[i][SCY], smin[i].C.y, smax[i].C.y);
if( sblock[i][STHETA] )
fprintf(besto, "\ts_angle %d %.6lf %.6lf\n", sblock[i][STHETA], smin[i].E.theta * RTD, smax[i].E.theta * RTD);
if( sblock[i][SA] )
fprintf(besto, "\ts_sigx %d %.6lf %.6lf\n", sblock[i][SA], smin[i].E.a, smax[i].E.a);
if( sblock[i][SEPS] )
fprintf(besto, "\ts_eps %d %.6lf %.6lf\n", sblock[i][SEPS], smin[i].eps, smax[i].eps);
if( sblock[i][STHETA] )
fprintf(besto, "\ts_angle %d %.6lf %.6lf\n", sblock[i][STHETA], smin[i].E.theta * RTD, smax[i].E.theta * RTD);
if( sblock[i][SFLUX] )
fprintf(besto, "\tmag %d %.6lf %.6lf\n", sblock[i][SFLUX], smin[i].mag, smax[i].mag);
if( sblock[i][SINDEX] )
fprintf(besto, "\tindex %d %.6lf %.6lf\n", sblock[i][SINDEX], smin[i].var1, smax[i].var1);
if(source[i].type==6) //double Sersic
{
if( sblock[i][STHETA2] )
fprintf(besto, "\ts_angle2 %d %.6lf %.6lf\n", sblock[i][STHETA2], smin[i].E2.theta * RTD, smax[i].E2.theta * RTD);
if( sblock[i][SA2] )
fprintf(besto, "\ts_sigx2 %d %.6lf %.6lf\n", sblock[i][SA2], smin[i].E2.a, smax[i].E2.a);
if( sblock[i][SEPS2] )
fprintf(besto, "\ts_eps2 %d %.6lf %.6lf\n", sblock[i][SEPS2], smin[i].eps2, smax[i].eps2);
if( sblock[i][STHETA2] )
fprintf(besto, "\ts_angle2 %d %.6lf %.6lf\n", sblock[i][STHETA2], smin[i].E2.theta * RTD, smax[i].E2.theta * RTD);
if( sblock[i][SFLUX2] )
fprintf(besto, "\ts_mag2 %d %.6lf %.6lf\n", sblock[i][SFLUX2], smin[i].mag2, smax[i].mag2);
if( sblock[i][SINDEX2] )
......
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