SMV: read an ADSC header with a d*TREK block appended as ADSC
Some ADSC Quantum beamlines write a complete ADSC header (TYPE=, PIXEL_SIZE,
DISTANCE, BEAM_CENTER_X/Y, per-frame OSC_START) followed by a d*TREK block.
Any DETECTOR_NAMES sent the file down the d*TREK path, which either refused it
(translation names it does not know) or read its vectors as a mirrored image:
the sweep then indexes at the right cell with the hand inverted - invisible to
R-free, but the anomalous map at the heavy-atom sites comes out negative.
The d*TREK path is now taken only for Rigaku's own headers, which carry
Data_type= in place of ADSC's TYPE=, as dxtbx decides it. On the affected sets
the anomalous peaks at the Se sites turn positive and R-free is unchanged;
d*TREK files with Data_type= are read as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVeDQrPqZ52Tp6rzzZGxf3
(cherry picked from commit 06aad37a7f)
This commit is contained in:
1 parent
a63676247e
commit
601594de7b
2 files changed
+39
-1
No files matched your search
+5
-1
@@ -266,7 +266,11 @@ Header Parse(const std::map<std::string, std::string> &kv, const std::string &pa
|
||||
std::transform(a.begin(), a.end(), a.begin(), [](unsigned char c) { return std::tolower(c); });
|
||||
h.axis_name = a;
|
||||
}
|
||||
if (kv.count("DETECTOR_NAMES"))
|
||||
// Only Rigaku's own d*TREK headers (Data_type= in place of ADSC's TYPE=) are read as d*TREK, as
|
||||
// dxtbx decides it. Some ADSC Quantum beamlines append a d*TREK block to a complete ADSC header,
|
||||
// and its vectors mirror the image: read that way the sweep indexes with the hand inverted, which
|
||||
// R-free cannot see but the anomalous map at the heavy-atom sites shows as negative peaks.
|
||||
if (kv.count("DETECTOR_NAMES") && kv.count("DATA_TYPE"))
|
||||
ParseDtrek(kv, path, h);
|
||||
return h;
|
||||
}
|
||||
|
||||
@@ -4929,6 +4929,7 @@ namespace {
|
||||
std::string byte_order = "little_endian";
|
||||
int saturation = 65535; // CCD_IMAGE_SATURATION; 0 leaves the line out
|
||||
bool write_header = true;
|
||||
std::string extra; // further header lines, written after the ADSC ones
|
||||
std::vector<uint16_t> pixels; // empty: all zero
|
||||
};
|
||||
|
||||
@@ -4944,6 +4945,7 @@ namespace {
|
||||
<< "BEAM_CENTER_X=" << f.beam_x_mm << ";\nBEAM_CENTER_Y=" << f.beam_y_mm << ";\n";
|
||||
if (f.saturation > 0)
|
||||
h << "CCD_IMAGE_SATURATION=" << f.saturation << ";\n";
|
||||
h << f.extra;
|
||||
} else {
|
||||
h << "SOMETHING_ELSE=1;\n"; // a brace block that is not an image header
|
||||
}
|
||||
@@ -5017,6 +5019,38 @@ TEST_CASE("JFJochSMVReader_Geometry", "[HDF5][Full][portable]") {
|
||||
RemoveSMVSweep("smv_", ".img");
|
||||
}
|
||||
|
||||
SECTION("an ADSC header with a d*TREK block appended is read as ADSC") {
|
||||
// Some ADSC Quantum beamlines append a d*TREK block (no Data_type=) to a complete ADSC header.
|
||||
// Its translation names are not ones the d*TREK path knows, and its vectors mirror the image;
|
||||
// the ADSC fields are what the file is read by.
|
||||
WriteSMVSweep("smvplain_", ".img");
|
||||
JFJochSMVReader plain;
|
||||
REQUIRE_NOTHROW(plain.ReadFiles("smvplain_001.img"));
|
||||
const auto p = plain.GetDataset()->experiment;
|
||||
|
||||
SMVFields f;
|
||||
f.extra = "DETECTOR_NAMES=ADSC_;\nADSC_GONIO_NAMES=RotZ RotX/Swing RotY TransX TransY TransZ/Dist;\n"
|
||||
"ROTATION_VECTOR=-1 0 0;\n";
|
||||
WriteSMVSweep("smvdtrek_", ".img", f);
|
||||
JFJochSMVReader reader;
|
||||
REQUIRE_NOTHROW(reader.ReadFiles("smvdtrek_001.img"));
|
||||
const auto x = reader.GetDataset()->experiment;
|
||||
CHECK(x.GetDetectorDistance_mm() == Catch::Approx(250.0));
|
||||
CHECK(x.GetBeamX_pxl() == Catch::Approx(12.0));
|
||||
CHECK(x.GetBeamY_pxl() == Catch::Approx(8.0));
|
||||
CHECK(x.GetDiffractionGeometry().GetOrientation().IsMirrorY()
|
||||
== p.GetDiffractionGeometry().GetOrientation().IsMirrorY());
|
||||
CHECK(x.GetDiffractionGeometry().GetOrientation().GetQuarterTurns()
|
||||
== p.GetDiffractionGeometry().GetOrientation().GetQuarterTurns());
|
||||
REQUIRE(x.GetGoniometer().has_value());
|
||||
CHECK((x.GetGoniometer()->GetAxis() - p.GetGoniometer()->GetAxis()).Length() < 1e-5f);
|
||||
CHECK(x.GetGoniometer()->GetStart_deg() == Catch::Approx(5.0));
|
||||
plain.Close();
|
||||
reader.Close();
|
||||
RemoveSMVSweep("smvplain_", ".img");
|
||||
RemoveSMVSweep("smvdtrek_", ".img");
|
||||
}
|
||||
|
||||
SECTION("a d*TREK header: vectors, a swung arm, a counted wavelength and encoded overflows") {
|
||||
// The vocabulary Rigaku's CrystalClear writes for a Saturn: the detector as named circles with
|
||||
// their vectors in the imgCIF frame, the beam position in pixels, and the wavelength behind a
|
||||
|
||||
Reference in new issue
Block a user