Reflection: Save zeta
This commit is contained in:
@@ -25,6 +25,7 @@ struct Reflection {
|
||||
bool observed = false;
|
||||
float S_x, S_y, S_z;
|
||||
float partiality;
|
||||
float zeta;
|
||||
};
|
||||
|
||||
#endif //JFJOCH_REFLECTION_H
|
||||
|
||||
@@ -471,6 +471,8 @@ namespace {
|
||||
r.dist_ewald = GetCBORFloat(map_value);
|
||||
else if (key == "partiality")
|
||||
r.partiality = GetCBORFloat(map_value);
|
||||
else if (key == "zeta")
|
||||
r.zeta = GetCBORFloat(map_value);
|
||||
else
|
||||
cbor_value_advance(&map_value);
|
||||
}
|
||||
|
||||
@@ -246,6 +246,7 @@ inline void CBOR_ENC(CborEncoder &encoder, const Reflection& r) {
|
||||
CBOR_ENC(mapEncoder, "rp", r.dist_ewald);
|
||||
CBOR_ENC(mapEncoder, "rlp", r.rlp);
|
||||
CBOR_ENC(mapEncoder, "partiality", r.partiality);
|
||||
CBOR_ENC(mapEncoder, "zeta", r.zeta);
|
||||
|
||||
cborErr(cbor_encoder_close_container(&encoder, &mapEncoder));
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ int BraggPrediction::Calc(const DiffractionExperiment &experiment, const Crystal
|
||||
.h = h,
|
||||
.k = k,
|
||||
.l = l,
|
||||
.delta_phi = NAN,
|
||||
.predicted_x = x,
|
||||
.predicted_y = y,
|
||||
.d = d,
|
||||
@@ -103,7 +104,9 @@ int BraggPrediction::Calc(const DiffractionExperiment &experiment, const Crystal
|
||||
.rlp = 1.0,
|
||||
.S_x = S_x,
|
||||
.S_y = S_y,
|
||||
.S_z = S_z
|
||||
.S_z = S_z,
|
||||
.partiality = 1.0,
|
||||
.zeta = NAN
|
||||
};
|
||||
++i;
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace {
|
||||
out.h = h;
|
||||
out.k = k;
|
||||
out.l = l;
|
||||
out.delta_phi = NAN;
|
||||
out.predicted_x = x;
|
||||
out.predicted_y = y;
|
||||
out.d = 1.0f / sqrtf(recip_sq);
|
||||
@@ -85,6 +86,8 @@ namespace {
|
||||
out.S_y = Sy;
|
||||
out.S_z = Sz;
|
||||
out.rlp = 1.0f;
|
||||
out.partiality = 1.0f;
|
||||
out.zeta = NAN;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +144,8 @@ int BraggPredictionRot::Calc(const DiffractionExperiment &experiment, const Crys
|
||||
.S_x = S.x,
|
||||
.S_y = S.y,
|
||||
.S_z = S.z,
|
||||
.partiality = partiality
|
||||
.partiality = partiality,
|
||||
.zeta = zeta_abs
|
||||
};
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -160,6 +160,7 @@ namespace {
|
||||
out[count].S_y = Sy;
|
||||
out[count].S_z = Sz;
|
||||
out[count].partiality = partiality;
|
||||
out[count].zeta = zeta_abs;
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
|
||||
@@ -683,6 +683,8 @@ bool JFJochHDF5Reader::LoadImage_i(std::shared_ptr<JFJochReaderDataset> &dataset
|
||||
auto lp = source_file->ReadOptVector<float>(image_group_name + "/lp");
|
||||
auto partiality = source_file->ReadOptVector<float>(image_group_name + "/partiality");
|
||||
auto phi = source_file->ReadOptVector<float>(image_group_name + "/delta_phi");
|
||||
auto zeta = source_file->ReadOptVector<float>(image_group_name + "/zeta");
|
||||
|
||||
if (h.size() != l.size() || h.size() != k.size() || h.size() != d.size()
|
||||
|| h.size() != predicted_x.size() || h.size() != predicted_y.size()
|
||||
|| h.size() != int_sum.size() || h.size() != int_err.size() || h.size() != bkg.size())
|
||||
@@ -699,6 +701,9 @@ bool JFJochHDF5Reader::LoadImage_i(std::shared_ptr<JFJochReaderDataset> &dataset
|
||||
float delta_phi_val = NAN;
|
||||
if (phi.size() > i)
|
||||
delta_phi_val = phi[i];
|
||||
float zeta_val = NAN;
|
||||
if (zeta.size() > i)
|
||||
zeta_val = zeta[i];
|
||||
|
||||
Reflection r{
|
||||
.h = h.at(i),
|
||||
@@ -712,7 +717,8 @@ bool JFJochHDF5Reader::LoadImage_i(std::shared_ptr<JFJochReaderDataset> &dataset
|
||||
.bkg = bkg.at(i),
|
||||
.sigma = int_err.at(i),
|
||||
.rlp = lp_val,
|
||||
.partiality = partiality_val
|
||||
.partiality = partiality_val,
|
||||
.zeta = zeta_val
|
||||
};
|
||||
message.reflections.emplace_back(r);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ void HDF5DataFilePluginReflection::Write(const DataMessage &msg, uint64_t image_
|
||||
|
||||
std::vector<int32_t> h, k, l;
|
||||
std::vector<float> I, sigma, d, lp;
|
||||
std::vector<float> image, phi, pred_x, pred_y, bkg, partiality;
|
||||
std::vector<float> image, phi, pred_x, pred_y, bkg, partiality, zeta;
|
||||
|
||||
for (const auto &refl : msg.reflections) {
|
||||
image.emplace_back(refl.image_number);
|
||||
@@ -33,6 +33,7 @@ void HDF5DataFilePluginReflection::Write(const DataMessage &msg, uint64_t image_
|
||||
lp.emplace_back(1.0/refl.rlp);
|
||||
partiality.emplace_back(refl.partiality);
|
||||
phi.emplace_back(refl.delta_phi);
|
||||
zeta.emplace_back(refl.zeta);
|
||||
}
|
||||
|
||||
std::string image_group_name = fmt::format("image_{:06d}", image_number);
|
||||
@@ -51,6 +52,7 @@ void HDF5DataFilePluginReflection::Write(const DataMessage &msg, uint64_t image_
|
||||
image_group.SaveVector("observed_frame", image);
|
||||
image_group.SaveVector("lp", lp);
|
||||
image_group.SaveVector("partiality", partiality);
|
||||
image_group.SaveVector("zeta", zeta);
|
||||
}
|
||||
|
||||
void HDF5DataFilePluginReflection::WriteFinal(HDF5File &data_file) {
|
||||
|
||||
Reference in New Issue
Block a user