jfjoch_broker: Set Unit Cell vectors
This commit is contained in:
@@ -1026,6 +1026,19 @@ org::openapitools::server::model::Scan_result Convert(const ScanResult& input) {
|
||||
v.emplace_back(std::move(tmp));
|
||||
}
|
||||
ret.setImages(v);
|
||||
if (input.rotation_lattice) {
|
||||
ret.setRotationCrystalLattice(input.rotation_lattice->GetVector());
|
||||
org::openapitools::server::model::Unit_cell uc;
|
||||
auto i_uc = input.rotation_lattice->GetUnitCell();
|
||||
|
||||
uc.setA(i_uc.a);
|
||||
uc.setB(i_uc.b);
|
||||
uc.setC(i_uc.c);
|
||||
uc.setAlpha(i_uc.alpha);
|
||||
uc.setBeta(i_uc.beta);
|
||||
uc.setGamma(i_uc.gamma);
|
||||
ret.setRotationUnitCell(uc);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ Scan_result::Scan_result()
|
||||
{
|
||||
m_File_prefix = "";
|
||||
m_File_prefixIsSet = false;
|
||||
m_Unit_cellIsSet = false;
|
||||
m_Crystal_latticeIsSet = false;
|
||||
m_Rotation_unit_cellIsSet = false;
|
||||
m_Rotation_crystal_latticeIsSet = false;
|
||||
|
||||
}
|
||||
|
||||
@@ -48,10 +48,10 @@ bool Scan_result::validate(std::stringstream& msg, const std::string& pathPrefix
|
||||
const std::string _pathPrefix = pathPrefix.empty() ? "Scan_result" : pathPrefix;
|
||||
|
||||
|
||||
if (crystalLatticeIsSet())
|
||||
if (rotationCrystalLatticeIsSet())
|
||||
{
|
||||
const std::vector<float>& value = m_Crystal_lattice;
|
||||
const std::string currentValuePath = _pathPrefix + ".crystalLattice";
|
||||
const std::vector<float>& value = m_Rotation_crystal_lattice;
|
||||
const std::string currentValuePath = _pathPrefix + ".rotationCrystalLattice";
|
||||
|
||||
|
||||
if (value.size() < 9)
|
||||
@@ -112,10 +112,10 @@ bool Scan_result::operator==(const Scan_result& rhs) const
|
||||
((!filePrefixIsSet() && !rhs.filePrefixIsSet()) || (filePrefixIsSet() && rhs.filePrefixIsSet() && getFilePrefix() == rhs.getFilePrefix())) &&
|
||||
|
||||
|
||||
((!unitCellIsSet() && !rhs.unitCellIsSet()) || (unitCellIsSet() && rhs.unitCellIsSet() && getUnitCell() == rhs.getUnitCell())) &&
|
||||
((!rotationUnitCellIsSet() && !rhs.rotationUnitCellIsSet()) || (rotationUnitCellIsSet() && rhs.rotationUnitCellIsSet() && getRotationUnitCell() == rhs.getRotationUnitCell())) &&
|
||||
|
||||
|
||||
((!crystalLatticeIsSet() && !rhs.crystalLatticeIsSet()) || (crystalLatticeIsSet() && rhs.crystalLatticeIsSet() && getCrystalLattice() == rhs.getCrystalLattice())) &&
|
||||
((!rotationCrystalLatticeIsSet() && !rhs.rotationCrystalLatticeIsSet()) || (rotationCrystalLatticeIsSet() && rhs.rotationCrystalLatticeIsSet() && getRotationCrystalLattice() == rhs.getRotationCrystalLattice())) &&
|
||||
|
||||
(getImages() == rhs.getImages())
|
||||
|
||||
@@ -133,10 +133,10 @@ void to_json(nlohmann::json& j, const Scan_result& o)
|
||||
j = nlohmann::json::object();
|
||||
if(o.filePrefixIsSet())
|
||||
j["file_prefix"] = o.m_File_prefix;
|
||||
if(o.unitCellIsSet())
|
||||
j["unit_cell"] = o.m_Unit_cell;
|
||||
if(o.crystalLatticeIsSet() || !o.m_Crystal_lattice.empty())
|
||||
j["crystal_lattice"] = o.m_Crystal_lattice;
|
||||
if(o.rotationUnitCellIsSet())
|
||||
j["rotation_unit_cell"] = o.m_Rotation_unit_cell;
|
||||
if(o.rotationCrystalLatticeIsSet() || !o.m_Rotation_crystal_lattice.empty())
|
||||
j["rotation_crystal_lattice"] = o.m_Rotation_crystal_lattice;
|
||||
j["images"] = o.m_Images;
|
||||
|
||||
}
|
||||
@@ -148,15 +148,15 @@ void from_json(const nlohmann::json& j, Scan_result& o)
|
||||
j.at("file_prefix").get_to(o.m_File_prefix);
|
||||
o.m_File_prefixIsSet = true;
|
||||
}
|
||||
if(j.find("unit_cell") != j.end())
|
||||
if(j.find("rotation_unit_cell") != j.end())
|
||||
{
|
||||
j.at("unit_cell").get_to(o.m_Unit_cell);
|
||||
o.m_Unit_cellIsSet = true;
|
||||
j.at("rotation_unit_cell").get_to(o.m_Rotation_unit_cell);
|
||||
o.m_Rotation_unit_cellIsSet = true;
|
||||
}
|
||||
if(j.find("crystal_lattice") != j.end())
|
||||
if(j.find("rotation_crystal_lattice") != j.end())
|
||||
{
|
||||
j.at("crystal_lattice").get_to(o.m_Crystal_lattice);
|
||||
o.m_Crystal_latticeIsSet = true;
|
||||
j.at("rotation_crystal_lattice").get_to(o.m_Rotation_crystal_lattice);
|
||||
o.m_Rotation_crystal_latticeIsSet = true;
|
||||
}
|
||||
j.at("images").get_to(o.m_Images);
|
||||
|
||||
@@ -179,39 +179,39 @@ void Scan_result::unsetFile_prefix()
|
||||
{
|
||||
m_File_prefixIsSet = false;
|
||||
}
|
||||
org::openapitools::server::model::Unit_cell Scan_result::getUnitCell() const
|
||||
org::openapitools::server::model::Unit_cell Scan_result::getRotationUnitCell() const
|
||||
{
|
||||
return m_Unit_cell;
|
||||
return m_Rotation_unit_cell;
|
||||
}
|
||||
void Scan_result::setUnitCell(org::openapitools::server::model::Unit_cell const& value)
|
||||
void Scan_result::setRotationUnitCell(org::openapitools::server::model::Unit_cell const& value)
|
||||
{
|
||||
m_Unit_cell = value;
|
||||
m_Unit_cellIsSet = true;
|
||||
m_Rotation_unit_cell = value;
|
||||
m_Rotation_unit_cellIsSet = true;
|
||||
}
|
||||
bool Scan_result::unitCellIsSet() const
|
||||
bool Scan_result::rotationUnitCellIsSet() const
|
||||
{
|
||||
return m_Unit_cellIsSet;
|
||||
return m_Rotation_unit_cellIsSet;
|
||||
}
|
||||
void Scan_result::unsetUnit_cell()
|
||||
void Scan_result::unsetRotation_unit_cell()
|
||||
{
|
||||
m_Unit_cellIsSet = false;
|
||||
m_Rotation_unit_cellIsSet = false;
|
||||
}
|
||||
std::vector<float> Scan_result::getCrystalLattice() const
|
||||
std::vector<float> Scan_result::getRotationCrystalLattice() const
|
||||
{
|
||||
return m_Crystal_lattice;
|
||||
return m_Rotation_crystal_lattice;
|
||||
}
|
||||
void Scan_result::setCrystalLattice(std::vector<float> const value)
|
||||
void Scan_result::setRotationCrystalLattice(std::vector<float> const value)
|
||||
{
|
||||
m_Crystal_lattice = value;
|
||||
m_Crystal_latticeIsSet = true;
|
||||
m_Rotation_crystal_lattice = value;
|
||||
m_Rotation_crystal_latticeIsSet = true;
|
||||
}
|
||||
bool Scan_result::crystalLatticeIsSet() const
|
||||
bool Scan_result::rotationCrystalLatticeIsSet() const
|
||||
{
|
||||
return m_Crystal_latticeIsSet;
|
||||
return m_Rotation_crystal_latticeIsSet;
|
||||
}
|
||||
void Scan_result::unsetCrystal_lattice()
|
||||
void Scan_result::unsetRotation_crystal_lattice()
|
||||
{
|
||||
m_Crystal_latticeIsSet = false;
|
||||
m_Rotation_crystal_latticeIsSet = false;
|
||||
}
|
||||
std::vector<org::openapitools::server::model::Scan_result_images_inner> Scan_result::getImages() const
|
||||
{
|
||||
|
||||
@@ -71,17 +71,17 @@ public:
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
org::openapitools::server::model::Unit_cell getUnitCell() const;
|
||||
void setUnitCell(org::openapitools::server::model::Unit_cell const& value);
|
||||
bool unitCellIsSet() const;
|
||||
void unsetUnit_cell();
|
||||
org::openapitools::server::model::Unit_cell getRotationUnitCell() const;
|
||||
void setRotationUnitCell(org::openapitools::server::model::Unit_cell const& value);
|
||||
bool rotationUnitCellIsSet() const;
|
||||
void unsetRotation_unit_cell();
|
||||
/// <summary>
|
||||
/// Real-space crystal lattice 3D vectors in Angstrom. Order is 1st vector (x,y,z), 2nd vector (x,y,z) and 3rd vector (x,y,z)
|
||||
/// </summary>
|
||||
std::vector<float> getCrystalLattice() const;
|
||||
void setCrystalLattice(std::vector<float> const value);
|
||||
bool crystalLatticeIsSet() const;
|
||||
void unsetCrystal_lattice();
|
||||
std::vector<float> getRotationCrystalLattice() const;
|
||||
void setRotationCrystalLattice(std::vector<float> const value);
|
||||
bool rotationCrystalLatticeIsSet() const;
|
||||
void unsetRotation_crystal_lattice();
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -93,10 +93,10 @@ public:
|
||||
protected:
|
||||
std::string m_File_prefix;
|
||||
bool m_File_prefixIsSet;
|
||||
org::openapitools::server::model::Unit_cell m_Unit_cell;
|
||||
bool m_Unit_cellIsSet;
|
||||
std::vector<float> m_Crystal_lattice;
|
||||
bool m_Crystal_latticeIsSet;
|
||||
org::openapitools::server::model::Unit_cell m_Rotation_unit_cell;
|
||||
bool m_Rotation_unit_cellIsSet;
|
||||
std::vector<float> m_Rotation_crystal_lattice;
|
||||
bool m_Rotation_crystal_latticeIsSet;
|
||||
std::vector<org::openapitools::server::model::Scan_result_images_inner> m_Images;
|
||||
|
||||
|
||||
|
||||
@@ -1375,9 +1375,9 @@ components:
|
||||
properties:
|
||||
file_prefix:
|
||||
type: string
|
||||
unit_cell:
|
||||
rotation_unit_cell:
|
||||
$ref: '#/components/schemas/unit_cell'
|
||||
crystal_lattice:
|
||||
rotation_crystal_lattice:
|
||||
$ref: '#/components/schemas/crystal_lattice'
|
||||
images:
|
||||
type: array
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -10,6 +10,7 @@
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include "CrystalLattice.h"
|
||||
#include "UnitCell.h"
|
||||
|
||||
struct ScanResultElem {
|
||||
@@ -40,6 +41,8 @@ struct ScanResultElem {
|
||||
struct ScanResult {
|
||||
std::string file_prefix;
|
||||
std::vector<ScanResultElem> images;
|
||||
|
||||
std::optional<CrystalLattice> rotation_lattice;
|
||||
};
|
||||
|
||||
#endif //JFJOCH_SCANRESULT_H
|
||||
|
||||
@@ -7,8 +7,8 @@ Results of a scan
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**file_prefix** | **str** | | [optional]
|
||||
**unit_cell** | [**UnitCell**](UnitCell.md) | | [optional]
|
||||
**crystal_lattice** | **List[float]** | Real-space crystal lattice 3D vectors in Angstrom. Order is 1st vector (x,y,z), 2nd vector (x,y,z) and 3rd vector (x,y,z) | [optional]
|
||||
**rotation_unit_cell** | [**UnitCell**](UnitCell.md) | | [optional]
|
||||
**rotation_crystal_lattice** | **List[float]** | Real-space crystal lattice 3D vectors in Angstrom. Order is 1st vector (x,y,z), 2nd vector (x,y,z) and 3rd vector (x,y,z) | [optional]
|
||||
**images** | [**List[ScanResultImagesInner]**](ScanResultImagesInner.md) | |
|
||||
|
||||
## Example
|
||||
|
||||
@@ -11,8 +11,8 @@ import type { unit_cell } from './unit_cell';
|
||||
*/
|
||||
export type scan_result = {
|
||||
file_prefix?: string;
|
||||
unit_cell?: unit_cell;
|
||||
crystal_lattice?: crystal_lattice;
|
||||
rotation_unit_cell?: unit_cell;
|
||||
rotation_crystal_lattice?: crystal_lattice;
|
||||
images: Array<{
|
||||
efficiency: number;
|
||||
/**
|
||||
|
||||
@@ -154,6 +154,17 @@ void JFJochReceiver::SendEndMessage() {
|
||||
|
||||
message.az_int_result["dataset"] = plots.GetAzIntProfile();
|
||||
|
||||
const auto rotation_indexer_ret = indexer.Finalize(true);
|
||||
if (rotation_indexer_ret.has_value()) {
|
||||
message.rotation_lattice = rotation_indexer_ret->lattice;
|
||||
message.rotation_lattice_type = LatticeMessage{
|
||||
.centering = rotation_indexer_ret->search_result.centering,
|
||||
.niggli_class = rotation_indexer_ret->search_result.niggli_class,
|
||||
.crystal_system = rotation_indexer_ret->search_result.system
|
||||
};
|
||||
rotation_indexing_lattice = rotation_indexer_ret->lattice;
|
||||
}
|
||||
|
||||
for (int i = 0; i < adu_histogram_module.size(); i++)
|
||||
message.adu_histogram["module" + std::to_string(i)] = adu_histogram_module[i]->GetHistogram();
|
||||
|
||||
@@ -180,6 +191,7 @@ JFJochReceiverOutput JFJochReceiver::GetFinalStatistics() const {
|
||||
ret.status = GetStatus();
|
||||
ret.writer_err = writer_error;
|
||||
ret.scan_result = scan_result.GetResult();
|
||||
ret.scan_result.rotation_lattice = rotation_indexing_lattice;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ protected:
|
||||
std::mutex max_delay_mutex;
|
||||
|
||||
IndexAndRefine indexer;
|
||||
std::optional<CrystalLattice> rotation_indexing_lattice;
|
||||
|
||||
std::string writer_error;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user