v1.0.0-rc.31
This commit is contained in:
@@ -95,7 +95,6 @@ DiffractionExperiment &DiffractionExperiment::PedestalG2Frames(int64_t input) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::IncidentEnergy_keV(float input) {
|
||||
dataset.PhotonEnergy_keV(input);
|
||||
return *this;
|
||||
@@ -142,27 +141,27 @@ DiffractionExperiment &DiffractionExperiment::MaskChipEdges(bool input) {
|
||||
}
|
||||
|
||||
DiffractionExperiment& DiffractionExperiment::LowResForAzimInt_A(float input) {
|
||||
radial_integration_settings.LowQ_recipA(2 * static_cast<float>(M_PI) / input);
|
||||
az_integration_settings.LowQ_recipA(2 * static_cast<float>(M_PI) / input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
DiffractionExperiment& DiffractionExperiment::HighResForAzimInt_A(float input) {
|
||||
radial_integration_settings.HighQ_recipA(2 * static_cast<float>(M_PI) / input);
|
||||
az_integration_settings.HighQ_recipA(2 * static_cast<float>(M_PI) / input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
DiffractionExperiment& DiffractionExperiment::LowQForAzimInt_recipA(float input) {
|
||||
radial_integration_settings.LowQ_recipA(input);
|
||||
az_integration_settings.LowQ_recipA(input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
DiffractionExperiment& DiffractionExperiment::HighQForAzimInt_recipA(float input) {
|
||||
radial_integration_settings.HighQ_recipA(input);
|
||||
az_integration_settings.HighQ_recipA(input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
DiffractionExperiment& DiffractionExperiment::QSpacingForAzimInt_recipA(float input) {
|
||||
radial_integration_settings.QSpacing_recipA(input);
|
||||
az_integration_settings.QSpacing_recipA(input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -199,6 +198,11 @@ DiffractionExperiment &DiffractionExperiment::SampleName(const std::string &inpu
|
||||
return *this;
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::OverwriteExistingFiles(bool input) {
|
||||
file_writer.OverwriteExistingFiles(input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// getter functions
|
||||
int64_t DiffractionExperiment::GetNumTriggers() const {
|
||||
if (IsPedestalRun())
|
||||
@@ -407,27 +411,15 @@ int64_t DiffractionExperiment::GetPixelsNum() const {
|
||||
}
|
||||
|
||||
int64_t DiffractionExperiment::GetXPixelsNum() const {
|
||||
if (IsGeometryTransformed())
|
||||
return detector.GetGeometry().GetWidth();
|
||||
else
|
||||
return RAW_MODULE_COLS;
|
||||
return detector.GetGeometry().GetWidth(IsGeometryTransformed());
|
||||
}
|
||||
|
||||
int64_t DiffractionExperiment::GetYPixelsNum() const {
|
||||
if (IsGeometryTransformed())
|
||||
return detector.GetGeometry().GetHeight();
|
||||
else
|
||||
return RAW_MODULE_LINES * GetModulesNum();
|
||||
return detector.GetGeometry().GetHeight(IsGeometryTransformed());
|
||||
}
|
||||
|
||||
int64_t DiffractionExperiment::GetPixel0OfModule(uint16_t module_number) const {
|
||||
if (module_number >= GetModulesNum())
|
||||
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Module number out of bounds");
|
||||
|
||||
if (IsGeometryTransformed())
|
||||
return detector.GetGeometry().GetPixel0(module_number);
|
||||
else
|
||||
return RAW_MODULE_SIZE * module_number;
|
||||
return detector.GetGeometry().GetPixel0(module_number, IsGeometryTransformed());
|
||||
}
|
||||
|
||||
int64_t DiffractionExperiment::GetOverflow() const {
|
||||
@@ -509,13 +501,6 @@ std::string DiffractionExperiment::GetUnitCellString() const {
|
||||
return "-";
|
||||
}
|
||||
|
||||
Coord DiffractionExperiment::LabCoord(float detector_x, float detector_y) const {
|
||||
// Assumes planar detector, 90 deg towards beam
|
||||
return {(detector_x - GetBeamX_pxl()) * GetPixelSize_mm() ,
|
||||
(detector_y - GetBeamY_pxl()) * GetPixelSize_mm() ,
|
||||
GetDetectorDistance_mm()};
|
||||
}
|
||||
|
||||
int64_t DiffractionExperiment::GetSpaceGroupNumber() const {
|
||||
return dataset.GetSpaceGroupNumber();
|
||||
}
|
||||
@@ -541,14 +526,14 @@ int64_t DiffractionExperiment::GetStorageCellStart() const {
|
||||
}
|
||||
|
||||
float DiffractionExperiment::GetLowQForAzimInt_recipA() const {
|
||||
return radial_integration_settings.GetLowQ_recipA();
|
||||
return az_integration_settings.GetLowQ_recipA();
|
||||
}
|
||||
float DiffractionExperiment::GetHighQForAzimInt_recipA() const {
|
||||
return radial_integration_settings.GetHighQ_recipA();
|
||||
return az_integration_settings.GetHighQ_recipA();
|
||||
}
|
||||
|
||||
float DiffractionExperiment::GetQSpacingForAzimInt_recipA() const {
|
||||
return radial_integration_settings.GetQSpacing_recipA();
|
||||
return az_integration_settings.GetQSpacing_recipA();
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::MaxSpotCount(int64_t input) {
|
||||
@@ -611,8 +596,12 @@ void DiffractionExperiment::FillMessage(StartMessage &message) const {
|
||||
message.sensor_thickness = detector.GetSensorThickness_um() * 1e-6f;
|
||||
message.bit_depth_image = GetByteDepthImage() * 8;
|
||||
message.bit_depth_readout = GetByteDepthReadout() * 8;
|
||||
message.storage_cell_number = GetStorageCellNumber();
|
||||
message.storage_cell_delay_ns = GetStorageCellDelay().count();
|
||||
|
||||
if (GetDetectorType() == DetectorType::JUNGFRAU) {
|
||||
message.storage_cell_number = GetStorageCellNumber();
|
||||
message.storage_cell_delay_ns = GetStorageCellDelay().count();
|
||||
}
|
||||
|
||||
message.file_prefix = GetFilePrefix();
|
||||
message.pixel_signed = IsPixelSigned();
|
||||
message.sample_name = GetSampleName();
|
||||
@@ -659,6 +648,8 @@ void DiffractionExperiment::FillMessage(StartMessage &message) const {
|
||||
message.jfjoch_release = jfjoch_version();
|
||||
message.detector_serial_number = detector.GetSerialNumber();
|
||||
message.write_master_file = dataset.IsWriteNXmxHDF5Master();
|
||||
message.overwrite = file_writer.IsOverwriteExistingFiles();
|
||||
message.hdf5_format_version = file_writer.GetHDF5MasterFormatVersion();
|
||||
|
||||
message.channels = {"default"};
|
||||
|
||||
@@ -669,6 +660,15 @@ void DiffractionExperiment::FillMessage(StartMessage &message) const {
|
||||
message.jungfrau_conversion_factor = GetPhotonEnergyForConversion_keV() * 1000;
|
||||
|
||||
message.geometry_transformation_enabled = IsGeometryTransformed();
|
||||
|
||||
if (GetSummation() == 1)
|
||||
message.summation_mode = "none";
|
||||
else {
|
||||
if (IsCPUSummation())
|
||||
message.summation_mode = "cpu";
|
||||
else
|
||||
message.summation_mode = "fpga";
|
||||
}
|
||||
}
|
||||
|
||||
float DiffractionExperiment::GetPixelSize_mm() const {
|
||||
@@ -688,16 +688,10 @@ std::string DiffractionExperiment::GetInstrumentName() const {
|
||||
}
|
||||
|
||||
int64_t DiffractionExperiment::GetModuleFastDirectionStep(uint16_t module_number) const {
|
||||
if (module_number >= GetModulesNum())
|
||||
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Module number out of bounds");
|
||||
|
||||
return detector.GetGeometry().GetFastDirectionStep(module_number);
|
||||
}
|
||||
|
||||
int64_t DiffractionExperiment::GetModuleSlowDirectionStep(uint16_t module_number) const {
|
||||
if (module_number >= GetModulesNum())
|
||||
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Module number out of bounds");
|
||||
|
||||
return detector.GetGeometry().GetSlowDirectionStep(module_number);
|
||||
}
|
||||
|
||||
@@ -710,13 +704,13 @@ std::string DiffractionExperiment::GetDetectorDescription() const {
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::ApplySolidAngleCorr(bool input) {
|
||||
radial_integration_settings.SolidAngleCorrection(input);
|
||||
az_integration_settings.SolidAngleCorrection(input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
bool DiffractionExperiment::GetApplySolidAngleCorr() const {
|
||||
return radial_integration_settings.IsSolidAngleCorrection();
|
||||
return az_integration_settings.IsSolidAngleCorrection();
|
||||
}
|
||||
|
||||
bool DiffractionExperiment::GetSaveCalibration() const {
|
||||
@@ -1019,7 +1013,7 @@ int64_t DiffractionExperiment::GetImagesPerFile() const {
|
||||
return tmp;
|
||||
}
|
||||
|
||||
int64_t DiffractionExperiment::GetSendBufferLocationSize() const {
|
||||
int64_t DiffractionExperiment::GetImageBufferLocationSize() const {
|
||||
return GetMaxCompressedSize() + 1024 * 1024;
|
||||
}
|
||||
|
||||
@@ -1063,6 +1057,15 @@ InstrumentMetadata DiffractionExperiment::GetInstrumentMetadata() const {
|
||||
return instrument;
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::ImportFileWriterSettings(const FileWriterSettings &input) {
|
||||
file_writer = input;
|
||||
return *this;
|
||||
}
|
||||
|
||||
FileWriterSettings DiffractionExperiment::GetFileWriterSettings() const {
|
||||
return file_writer;
|
||||
}
|
||||
|
||||
bool DiffractionExperiment::IsGeometryTransformed() const {
|
||||
return image_format_settings.IsGeometryTransformed();
|
||||
}
|
||||
@@ -1190,22 +1193,22 @@ ImageFormatSettings DiffractionExperiment::GetImageFormatSettings() const {
|
||||
return image_format_settings;
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::ImportRadialIntegrationSettings(const AzimuthalIntegrationSettings &input) {
|
||||
radial_integration_settings = input;
|
||||
DiffractionExperiment &DiffractionExperiment::ImportAzimuthalIntegrationSettings(const AzimuthalIntegrationSettings &input) {
|
||||
az_integration_settings = input;
|
||||
return *this;
|
||||
}
|
||||
|
||||
AzimuthalIntegrationSettings DiffractionExperiment::GetRadialIntegrationSettings() const {
|
||||
return radial_integration_settings;
|
||||
AzimuthalIntegrationSettings DiffractionExperiment::GetAzimuthalIntegrationSettings() const {
|
||||
return az_integration_settings;
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::PolarizationFactor(const std::optional<float> &input) {
|
||||
radial_integration_settings.PolarizationFactor(input);
|
||||
az_integration_settings.PolarizationFactor(input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::optional<float> DiffractionExperiment::GetPolarizationFactor() const {
|
||||
return radial_integration_settings.GetPolarizationFactor();
|
||||
return az_integration_settings.GetPolarizationFactor();
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::SaveCalibration(const std::optional<bool> &input) {
|
||||
@@ -1286,3 +1289,47 @@ DiffractionExperiment & DiffractionExperiment::ElectronSource(bool input) {
|
||||
bool DiffractionExperiment::IsElectronSource() const {
|
||||
return instrument.IsElectronSource();
|
||||
}
|
||||
|
||||
DiffractionExperiment &DiffractionExperiment::HDF5MasterFormatVersion(int input) {
|
||||
file_writer.HDF5MasterFormatVersion(input);
|
||||
return *this;
|
||||
}
|
||||
|
||||
int DiffractionExperiment::GetHDF5MasterFormatVersion() const {
|
||||
return file_writer.GetHDF5MasterFormatVersion();
|
||||
}
|
||||
|
||||
DiffractionGeometry DiffractionExperiment::GetDiffractionGeometry() const {
|
||||
DiffractionGeometry g;
|
||||
g.Wavelength_A(GetWavelength_A()).PixelSize_mm(GetPixelSize_mm())
|
||||
.BeamX_pxl(GetBeamX_pxl()).BeamY_pxl(GetBeamY_pxl())
|
||||
.DetectorDistance_mm(GetDetectorDistance_mm());
|
||||
return g;
|
||||
}
|
||||
|
||||
|
||||
void DiffractionExperiment::CalcAzIntCorrRawCoord(float *output, size_t module_number) const {
|
||||
if (module_number >= GetModulesNum())
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Wrong module number");
|
||||
auto geom = GetDiffractionGeometry();
|
||||
|
||||
for (int i = 0; i < RAW_MODULE_SIZE; i++) {
|
||||
auto [x,y] = RawToConvertedCoordinate(*this, module_number, i);
|
||||
if (GetApplySolidAngleCorr())
|
||||
output[i] /= geom.CalcAzIntSolidAngleCorr(static_cast<float>(x), static_cast<float>(y));
|
||||
auto p = GetPolarizationFactor();
|
||||
if (p.has_value())
|
||||
output[i] /= geom.CalcAzIntPolarizationCorr(static_cast<float>(x), static_cast<float>(y), p.value());
|
||||
}
|
||||
}
|
||||
|
||||
void DiffractionExperiment::CalcSpotFinderResolutionMap(float *data, size_t module_number) const {
|
||||
if (module_number >= GetModulesNum())
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Wrong module number");
|
||||
auto geom = GetDiffractionGeometry();
|
||||
|
||||
for (int i = 0; i < RAW_MODULE_SIZE; i++) {
|
||||
auto [x,y] = RawToConvertedCoordinate(*this, module_number, i);
|
||||
data[i] = geom.PxlToRes(static_cast<float>(x), static_cast<float>(y));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user