diff --git a/broker/gen/model/Scan_result.cpp b/broker/gen/model/Scan_result.cpp index e38c6a3e..2e7df240 100644 --- a/broker/gen/model/Scan_result.cpp +++ b/broker/gen/model/Scan_result.cpp @@ -23,6 +23,8 @@ Scan_result::Scan_result() { m_File_prefix = ""; m_File_prefixIsSet = false; + m_Unit_cellIsSet = false; + m_Crystal_latticeIsSet = false; } @@ -45,7 +47,38 @@ bool Scan_result::validate(std::stringstream& msg, const std::string& pathPrefix bool success = true; const std::string _pathPrefix = pathPrefix.empty() ? "Scan_result" : pathPrefix; - + + if (crystalLatticeIsSet()) + { + const std::vector& value = m_Crystal_lattice; + const std::string currentValuePath = _pathPrefix + ".crystalLattice"; + + + if (value.size() < 9) + { + success = false; + msg << currentValuePath << ": must have at least 9 elements;"; + } + if (value.size() > 9) + { + success = false; + msg << currentValuePath << ": must have at most 9 elements;"; + } + { // Recursive validation of array elements + const std::string oldValuePath = currentValuePath; + int i = 0; + for (const float& value : value) + { + const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]"; + + + + i++; + } + } + + } + /* Images */ { const std::vector& value = m_Images; @@ -78,6 +111,12 @@ 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())) && + + + ((!crystalLatticeIsSet() && !rhs.crystalLatticeIsSet()) || (crystalLatticeIsSet() && rhs.crystalLatticeIsSet() && getCrystalLattice() == rhs.getCrystalLattice())) && + (getImages() == rhs.getImages()) @@ -94,6 +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; j["images"] = o.m_Images; } @@ -105,6 +148,16 @@ 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()) + { + j.at("unit_cell").get_to(o.m_Unit_cell); + o.m_Unit_cellIsSet = true; + } + if(j.find("crystal_lattice") != j.end()) + { + j.at("crystal_lattice").get_to(o.m_Crystal_lattice); + o.m_Crystal_latticeIsSet = true; + } j.at("images").get_to(o.m_Images); } @@ -126,6 +179,40 @@ void Scan_result::unsetFile_prefix() { m_File_prefixIsSet = false; } +org::openapitools::server::model::Unit_cell Scan_result::getUnitCell() const +{ + return m_Unit_cell; +} +void Scan_result::setUnitCell(org::openapitools::server::model::Unit_cell const& value) +{ + m_Unit_cell = value; + m_Unit_cellIsSet = true; +} +bool Scan_result::unitCellIsSet() const +{ + return m_Unit_cellIsSet; +} +void Scan_result::unsetUnit_cell() +{ + m_Unit_cellIsSet = false; +} +std::vector Scan_result::getCrystalLattice() const +{ + return m_Crystal_lattice; +} +void Scan_result::setCrystalLattice(std::vector const value) +{ + m_Crystal_lattice = value; + m_Crystal_latticeIsSet = true; +} +bool Scan_result::crystalLatticeIsSet() const +{ + return m_Crystal_latticeIsSet; +} +void Scan_result::unsetCrystal_lattice() +{ + m_Crystal_latticeIsSet = false; +} std::vector Scan_result::getImages() const { return m_Images; diff --git a/broker/gen/model/Scan_result.h b/broker/gen/model/Scan_result.h index 389b0e17..c40a9ea5 100644 --- a/broker/gen/model/Scan_result.h +++ b/broker/gen/model/Scan_result.h @@ -20,6 +20,7 @@ #include "Scan_result_images_inner.h" +#include "Unit_cell.h" #include #include #include @@ -70,6 +71,20 @@ public: /// /// /// + org::openapitools::server::model::Unit_cell getUnitCell() const; + void setUnitCell(org::openapitools::server::model::Unit_cell const& value); + bool unitCellIsSet() const; + void unsetUnit_cell(); + /// + /// 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) + /// + std::vector getCrystalLattice() const; + void setCrystalLattice(std::vector const value); + bool crystalLatticeIsSet() const; + void unsetCrystal_lattice(); + /// + /// + /// std::vector getImages() const; void setImages(std::vector const& value); @@ -78,6 +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 m_Crystal_lattice; + bool m_Crystal_latticeIsSet; std::vector m_Images; diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index 8b12185b..bc7149cd 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -588,6 +588,16 @@ components: type: number format: float description: X-ray fluorescence scan result in arbitrary units; must be exactly the same length, as energy_eV + crystal_lattice: + type: array + items: + type: number + format: float + minItems: 9 + maxItems: 9 + description: | + 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) unit_cell: type: object description: Unit cell parameters. Necessary to run indexing. Units of angstrom and degree @@ -1365,6 +1375,10 @@ components: properties: file_prefix: type: string + unit_cell: + $ref: '#/components/schemas/unit_cell' + crystal_lattice: + $ref: '#/components/schemas/crystal_lattice' images: type: array items: diff --git a/broker/redoc-static.html b/broker/redoc-static.html index f89ccdc4..3da39545 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -1319,7 +1319,7 @@ For still measurement the number is ignored

" class="sc-eVqvcJ sc-fszimp sc-etsjJW kIppRw jnwENr ljKHqG">

Error within Jungfraujoch code - see output message.

Response samples

Content type
application/json
{
  • "file_prefix": "string",
  • "images": [
    ]
}

Get Start message in CBOR format

http://localhost:5232/result/scan

Response samples

Content type
application/json
{
  • "file_prefix": "string",
  • "unit_cell": {
    },
  • "crystal_lattice": [
    ],
  • "images": [
    ]
}

Get Start message in CBOR format

Contains metadata for a dataset (e.g., experimental geometry)

Responses