Skip to content

Commit 7ea8fe8

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent c8028dd commit 7ea8fe8

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

dx2/detector.cxx

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,19 @@ void Panel::update(Matrix3d d) {
7676
Panel::Panel(json panel_data) {
7777
// We can either get an explicit origin or beam centre and distance
7878
std::vector<std::string> required_keys = {
79-
"fast_axis", "slow_axis", "pixel_size","image_size", "trusted_range",
80-
"type", "name","thickness", "raw_image_offset","gain", "pedestal","px_mm_strategy"
81-
};
79+
"fast_axis", "slow_axis", "pixel_size", "image_size",
80+
"trusted_range", "type", "name", "thickness",
81+
"raw_image_offset", "gain", "pedestal", "px_mm_strategy"};
8282
for (const auto &key : required_keys) {
8383
if (panel_data.find(key) == panel_data.end()) {
84-
throw std::invalid_argument("Key " + key +
85-
" is missing from the input detector panel JSON");
84+
throw std::invalid_argument(
85+
"Key " + key + " is missing from the input detector panel JSON");
8686
}
8787
}
8888
Vector3d fast{{panel_data["fast_axis"][0], panel_data["fast_axis"][1],
8989
panel_data["fast_axis"][2]}};
9090
Vector3d slow{{panel_data["slow_axis"][0], panel_data["slow_axis"][1],
91-
panel_data["slow_axis"][2]}};
91+
panel_data["slow_axis"][2]}};
9292
fast.normalize();
9393
slow.normalize();
9494
fast_axis_ = fast;
@@ -97,32 +97,31 @@ Panel::Panel(json panel_data) {
9797
image_size_ = {{panel_data["image_size"][0], panel_data["image_size"][1]}};
9898
Matrix3d d_matrix;
9999

100-
if (panel_data.contains("beam_center") && panel_data.contains("distance")){
100+
if (panel_data.contains("beam_center") && panel_data.contains("distance")) {
101101
double distance = panel_data["distance"];
102102
std::array<double, 2> beam_center = panel_data["beam_center"];
103103
origin_ = {0., 0., -1.0 * distance};
104104
origin_ -= beam_center[0] * pixel_size_[0] * fast_axis_;
105105
origin_ -= beam_center[1] * pixel_size_[1] * slow_axis_;
106106
normal_ = fast_axis_.cross(slow_axis_);
107-
d_matrix << fast_axis_[0], slow_axis_[0], origin_[0],
108-
fast_axis_[1], slow_axis_[1], origin_[1],
109-
fast_axis_[2], slow_axis_[2], origin_[2];
107+
d_matrix << fast_axis_[0], slow_axis_[0], origin_[0], fast_axis_[1],
108+
slow_axis_[1], origin_[1], fast_axis_[2], slow_axis_[2], origin_[2];
110109
} else {
111-
if (!panel_data.contains("origin")){
112-
throw std::invalid_argument("Detector panel JSON must contain either origin or beam_center + distance");
110+
if (!panel_data.contains("origin")) {
111+
throw std::invalid_argument("Detector panel JSON must contain either "
112+
"origin or beam_center + distance");
113113
}
114114
origin_ = Vector3d{{panel_data["origin"][0], panel_data["origin"][1],
115-
panel_data["origin"][2]}};
116-
d_matrix << fast[0], slow[0], origin_[0],
117-
fast[1], slow[1], origin_[1],
118-
fast[2], slow[2], origin_[2];
119-
//origin_ = origin;
115+
panel_data["origin"][2]}};
116+
d_matrix << fast[0], slow[0], origin_[0], fast[1], slow[1], origin_[1],
117+
fast[2], slow[2], origin_[2];
118+
// origin_ = origin;
120119
normal_ = fast_axis_.cross(slow_axis_);
121120
}
122-
121+
123122
d_ = d_matrix;
124123
D_ = d_.inverse();
125-
124+
126125
image_size_mm_ = {
127126
{image_size_[0] * pixel_size_[0], image_size_[1] * pixel_size_[1]}};
128127
trusted_range_ = {
@@ -233,12 +232,11 @@ const std::map<std::string, Vector3d> axis_map = {
233232
{"y", Vector3d(0.0, 1.0, 0.0)},
234233
{"-y", Vector3d(0.0, -1.0, 0.0)}};
235234

236-
Panel::Panel(double distance,// units mm
235+
Panel::Panel(double distance, // units mm
237236
std::array<double, 2> beam_center, // units px
238-
std::array<double, 2> pixel_size, // units mm
239-
std::array<int, 2> image_size,
240-
const std::string &fast_axis, const std::string &slow_axis,
241-
double thickness, double mu)
237+
std::array<double, 2> pixel_size, // units mm
238+
std::array<int, 2> image_size, const std::string &fast_axis,
239+
const std::string &slow_axis, double thickness, double mu)
242240
: pixel_size_(pixel_size), image_size_(image_size), thickness_(thickness),
243241
mu_(mu) {
244242
if (valid_axes.find(fast_axis) == valid_axes.end()) {

0 commit comments

Comments
 (0)