BraggPrediction: Set Lorentz-polarization correction properly
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 12m55s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 13m25s
Build Packages / Generate python client (push) Successful in 15s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 13m56s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 13m56s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky8) (push) Successful in 13m58s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 13m59s
Build Packages / Build documentation (push) Successful in 33s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 14m36s
Build Packages / build:rpm (rocky9) (push) Successful in 14m56s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 7m6s
Build Packages / Unit tests (push) Successful in 53m2s

This commit is contained in:
2026-01-30 20:49:07 +01:00
parent 0956e59b9c
commit f5bd76db05
12 changed files with 17 additions and 16 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ struct Reflection {
float bkg;
float sigma;
float dist_ewald;
float lp;
float rlp;
bool observed = false;
float S_x, S_y, S_z;
};
+1 -1
View File
@@ -146,7 +146,7 @@ See [DECTRIS documentation](https://github.com/dectris/documentation/tree/main/s
| - sigma | float | standard deviation, estimated from counting statistics (photons) | | |
| - image | float | image number (present for each spot) | | |
| - dist_ewald | float | distance to Ewald sphere (present only for indexed spots) | | |
| - lp | float | Lorentz and polarization corrections | | |
| - rlp | float | Reciprocal Lorentz and polarization corrections | | |
| spot_count | uint64 | Spot count | | |
| spot_count_ice_rings | uint64 | Number of spots within identified rings (experimental) | | |
| spot_count_low_res | uint64 | Number of spots in low resolution (prior to filtering) | | |
+1 -1
View File
@@ -464,7 +464,7 @@ namespace {
else if (key == "image")
r.image_number = GetCBORFloat(map_value);
else if (key == "rlp")
r.lp = GetCBORFloat(map_value);
r.rlp = GetCBORFloat(map_value);
else if (key == "rp")
r.dist_ewald = GetCBORFloat(map_value);
else
+1 -1
View File
@@ -243,7 +243,7 @@ inline void CBOR_ENC(CborEncoder &encoder, const Reflection& r) {
CBOR_ENC(mapEncoder, "sigma", r.sigma);
CBOR_ENC(mapEncoder, "image", r.image_number);
CBOR_ENC(mapEncoder, "rp", r.dist_ewald);
CBOR_ENC(mapEncoder, "lp", r.lp);
CBOR_ENC(mapEncoder, "rlp", r.rlp);
cborErr(cbor_encoder_close_container(&encoder, &mapEncoder));
}
@@ -99,11 +99,11 @@ std::vector<Reflection> IntegrateInternal(const DiffractionExperiment &experimen
r_3, r_1_sq, r_2_sq, r_3_sq);
if (r.observed) {
if (experiment.GetPolarizationFactor())
r.lp *= geom.CalcAzIntPolarizationCorr(r.predicted_x, r.predicted_y,
r.rlp *= geom.CalcAzIntPolarizationCorr(r.predicted_x, r.predicted_y,
experiment.GetPolarizationFactor().value());
r.I *= r.lp;
r.bkg *= r.lp;
r.sigma *= r.lp;
r.I *= r.rlp;
r.bkg *= r.rlp;
r.sigma *= r.rlp;
r.image_number = static_cast<float>(image_number);
ret.emplace_back(r);
}
@@ -100,7 +100,7 @@ int BraggPrediction::Calc(const DiffractionExperiment &experiment, const Crystal
.predicted_y = y,
.d = d,
.dist_ewald = dist_ewald_sphere,
.lp = 1.0,
.rlp = 1.0,
.S_x = S_x,
.S_y = S_y,
.S_z = S_z
@@ -84,7 +84,7 @@ namespace {
out.S_x = Sx;
out.S_y = Sy;
out.S_z = Sz;
out.lp = 1.0f;
out.rlp = 1.0f;
return true;
}
@@ -124,7 +124,7 @@ int BraggPredictionRot::Calc(const DiffractionExperiment &experiment, const Crys
.predicted_y = y,
.d = d,
.dist_ewald = dist_ewald_sphere,
.lp = lorentz_reciprocal,
.rlp = lorentz_reciprocal,
.S_x = S.x,
.S_y = S.y,
.S_z = S.z
@@ -131,7 +131,7 @@ namespace {
out[count].predicted_y = y;
out[count].d = 1.0f / sqrtf(p0_sq);
out[count].dist_ewald = dist_ewald;
out[count].lp = lorentz;
out[count].rlp = lorentz;
out[count].S_x = Sx;
out[count].S_y = Sy;
out[count].S_z = Sz;
+3 -2
View File
@@ -689,7 +689,8 @@ bool JFJochHDF5Reader::LoadImage_i(std::shared_ptr<JFJochReaderDataset> &dataset
for (size_t i = 0; i < h.size(); i++) {
float lp_val = 0.0;
if (lp.size() > i) lp_val = lp.at(i);
if (lp.size() > i && lp[i] != 0.0f)
lp_val = 1.0f / lp[i];
Reflection r{
.h = h.at(i),
.k = k.at(i),
@@ -700,7 +701,7 @@ bool JFJochHDF5Reader::LoadImage_i(std::shared_ptr<JFJochReaderDataset> &dataset
.I = int_sum.at(i),
.bkg = bkg.at(i),
.sigma = int_err.at(i),
.lp = lp_val
.rlp = lp_val
};
message.reflections.emplace_back(r);
}
+1 -1
View File
@@ -89,7 +89,7 @@ int main(int argc, char **argv) {
.I = r.I,
.last_image = i,
.count = 1,
.rlp = r.lp,
.rlp = r.rlp,
.image_number = r.image_number
};
bool found = false;
+1 -1
View File
@@ -30,7 +30,7 @@ void HDF5DataFilePluginReflection::Write(const DataMessage &msg, uint64_t image_
pred_x.emplace_back(refl.predicted_x);
pred_y.emplace_back(refl.predicted_y);
bkg.emplace_back(refl.bkg);
lp.emplace_back(refl.lp);
lp.emplace_back(1.0/refl.rlp);
}
std::string image_group_name = fmt::format("image_{:06d}", image_number);