Commit 429e934a authored by Ruben Farinelli's avatar Ruben Farinelli
Browse files

Corrected bug while computing the PA in equation (58) of Poutanen (2020)

parent 61807390
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ int main(int argc, char* argv[])

  xmin[1] = phimin / 180 * PI;
  xmax[1] = phimax / 180 * PI;
  ;
  

  /*=====================================================================*/
  if (simulfile == NULL || simulfile == 0x0)
@@ -152,6 +152,8 @@ int main(int argc, char* argv[])

  hcubature(1, observed_flux, function_params, 2, xmin, xmax, 2500, 0, 1e-40, ERROR_INDIVIDUAL, &Uval, &Uval_err);

  /*=====================================================================*/
  /*In the Q-U plane, the angle is here defined bewteen -PI/2 and PI/2*/
  /*=====================================================================*/
  
  printf("I %lf Q %5.4e  U %5.4e\n", stokes1, Qval, Uval);
@@ -168,14 +170,14 @@ int main(int argc, char* argv[])
    }
    else
    {
      PA_obs = 1 / 2. * (atan(ratio_UQ) + PI);
      PA_obs = 1 / 2. * atan(ratio_UQ)-PI/2;
    }
  }
  else
  {
    if (Qval > 0)
    {
      PA_obs = 1 / 2. * (atan(ratio_UQ)) + PI;
      PA_obs = 1 / 2. * (atan(ratio_UQ));
    }
    else
    {
@@ -183,8 +185,7 @@ int main(int argc, char* argv[])
    }
  }

  printf("\nPD %5.3f \n", PD_obs * 100);
  printf("PA %5.3f \n\n", PA_obs / PI * 180);
  printf("\nPD %5.3f PA %5.3f  \n", PD_obs * 100,  PA_obs / PI * 180);

  return 0;
}
@@ -394,8 +395,6 @@ int observed_flux(unsigned dim, const double* x, void* params, unsigned fdim, do
    PA = polarization_angle(alpha, Psi, theta, phi, i_obs, beta);
    PD = PolarizationRestFrame(E_rest, cos_alpha_prime);

    if (cos_alpha_prime > 0)

      *retval = flag * value * PD * sin(2 * PA);
  }

+3 −1
Original line number Diff line number Diff line
@@ -24,7 +24,9 @@ double polarization_angle(double alpha, double Psi, double theta, double phi, do
  num = (sin(theta) * sin(phi) + beta * A);
  denom = (-sin(i_obs) * cos(theta) + cos(i_obs) * sin(theta) * cos(phi) - beta * sin(phi) * C);

  csi_angle = arctan(denom, num);
  //csi_angle = arctan(num, denom);

  csi_angle=atan(num/denom);
  
  // printf("===> %lf  %lf\n", csi_angle/PI*180, atan(denom/num)/PI*180);

+8 −1
Original line number Diff line number Diff line
@@ -40,6 +40,13 @@ double PolarizationRestFrame(double E_rest, double CosAlphaPrime)
    Pdeg = P_interp;
  }

  
  /*To define the observed PA following the definition of Poutanen (2020) */
  /* change sign to the polarization of the slab*/
   
  
   Pdeg=-Pdeg;
   
   return Pdeg;
}