v1.0.0-rc.68
This commit is contained in:
@@ -35,26 +35,30 @@ std::pair<float, float> DiffractionGeometry::RecipToDector(const Coord &recip) c
|
||||
return {x, y};
|
||||
}
|
||||
|
||||
float DiffractionGeometry::TwoTheta(float x, float y) const {
|
||||
float DiffractionGeometry::TwoTheta_rad(float x, float y) const {
|
||||
auto lab = LabCoord(x, y);
|
||||
|
||||
float r = sqrtf(lab.x * lab.x + lab.y * lab.y);
|
||||
return atan2f(r, lab.z);
|
||||
}
|
||||
|
||||
float DiffractionGeometry::Phi(float x, float y) const {
|
||||
float DiffractionGeometry::Phi_rad(float x, float y) const {
|
||||
auto lab = LabCoord(x, y);
|
||||
auto v = atan2f(-lab.y, lab.x);
|
||||
auto v = atan2f(lab.y, lab.x);
|
||||
if (v < 0)
|
||||
v += 2.0f * M_PI;
|
||||
return v;
|
||||
}
|
||||
|
||||
float DiffractionGeometry::PxlToRes(float x, float y) const {
|
||||
float two_theta = TwoTheta(x, y);
|
||||
float two_theta = TwoTheta_rad(x, y);
|
||||
return wavelength_A / (2.0f * sinf(two_theta/2.0f));
|
||||
}
|
||||
|
||||
float DiffractionGeometry::PxlToQ(float x, float y) const {
|
||||
return 2 * M_PI / PxlToRes(x,y);
|
||||
}
|
||||
|
||||
float DiffractionGeometry::PxlToRes(float dist_pxl) const {
|
||||
// This is agnostic to detector rotation!!!
|
||||
if (dist_pxl == 0)
|
||||
@@ -88,15 +92,15 @@ float DiffractionGeometry::CalcAzIntSolidAngleCorr(float q) const {
|
||||
}
|
||||
|
||||
float DiffractionGeometry::CalcAzIntSolidAngleCorr(float x, float y) const {
|
||||
float cos_2theta = cosf(TwoTheta(x, y));
|
||||
float cos_2theta = cosf(TwoTheta_rad(x, y));
|
||||
float cos_2theta_3 = cos_2theta * cos_2theta * cos_2theta;
|
||||
return cos_2theta_3;
|
||||
}
|
||||
|
||||
float DiffractionGeometry::CalcAzIntPolarizationCorr(float x, float y, float coeff) const {
|
||||
auto cos_2theta = cosf(TwoTheta(x, y));
|
||||
auto cos_2theta = cosf(TwoTheta_rad(x, y));
|
||||
float cos_2theta_2 = cos_2theta * cos_2theta;
|
||||
float cos_2phi = cosf(2.0f * Phi(x, y));
|
||||
float cos_2phi = cosf(2.0f * Phi_rad(x, y));
|
||||
return 0.5f * (1.0f + cos_2theta_2 - coeff * cos_2phi * (1.0f - cos_2theta_2));
|
||||
}
|
||||
|
||||
@@ -175,9 +179,9 @@ float DiffractionGeometry::AngleFromEwaldSphere_deg(const Coord &p0) const {
|
||||
}
|
||||
|
||||
void DiffractionGeometry::UpdatePoniRotMatrix() {
|
||||
poni_rot = RotMatrix(-poni_rot_1, {0,1,0})
|
||||
poni_rot = RotMatrix(-poni_rot_3, {0,0,1})
|
||||
* RotMatrix(poni_rot_2, {1,0,0})
|
||||
* RotMatrix(poni_rot_3, {0,0,1});
|
||||
* RotMatrix(poni_rot_1, {0,1,0});
|
||||
}
|
||||
|
||||
DiffractionGeometry &DiffractionGeometry::PoniRot1_rad(float input) {
|
||||
|
||||
Reference in New Issue
Block a user