-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9906c58
commit a6ff0fc
Showing
18 changed files
with
341 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "(gdb) Launch", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/build/aare", | ||
"args": [], | ||
"stopAtEntry": true, | ||
"cwd": "${fileDirname}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
}, | ||
{ | ||
"description": "Set Disassembly Flavor to Intel", | ||
"text": "-gdb-set disassembly-flavor intel", | ||
"ignoreFailures": true | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "C/C++: g++ build and debug active file", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${fileDirname}/${fileBasenameNoExtension}", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${fileDirname}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
}, | ||
{ | ||
"description": "Set Disassembly Flavor to Intel", | ||
"text": "-gdb-set disassembly-flavor intel", | ||
"ignoreFailures": true | ||
} | ||
], | ||
"preLaunchTask": "C/C++: g++ build active file", | ||
"miDebuggerPath": "/usr/bin/gdb" | ||
} | ||
], | ||
"version": "2.0.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"tasks": [ | ||
{ | ||
"type": "cppbuild", | ||
"label": "C/C++: g++ build active file", | ||
"command": "/usr/bin/g++", | ||
"args": [ | ||
"-fdiagnostics-color=always", | ||
"-g", | ||
"${file}", | ||
"-o", | ||
"${fileDirname}/${fileBasenameNoExtension}" | ||
], | ||
"options": { | ||
"cwd": "${fileDirname}" | ||
}, | ||
"problemMatcher": [ | ||
"$gcc" | ||
], | ||
"group": "build", | ||
"detail": "Task generated by Debugger." | ||
} | ||
], | ||
"version": "2.0.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"Version": 7.1, | ||
"Timestamp": "Wed Sep 21 13:48:10 2022", | ||
"Detector Type": "Mythen3", | ||
"Timing Mode": "auto", | ||
"Geometry": { | ||
"x": 1, | ||
"y": 1 | ||
}, | ||
"Image Size in bytes": 15360, | ||
"Pixels": { | ||
"x": 3840, | ||
"y": 1 | ||
}, | ||
"Max Frames Per File": 10000, | ||
"Frame Discard Policy": "nodiscard", | ||
"Frame Padding": 1, | ||
"Scan Parameters": "[disabled]", | ||
"Total Frames": 1, | ||
"Receiver Roi": { | ||
"xmin": 4294967295, | ||
"xmax": 4294967295, | ||
"ymin": 4294967295, | ||
"ymax": 4294967295 | ||
}, | ||
"Dynamic Range": 32, | ||
"Ten Giga": 1, | ||
"Period": "2ms", | ||
"Counter Mask": "0x7", | ||
"Exptime1": "0.1s", | ||
"Exptime2": "0.1s", | ||
"Exptime3": "0.1s", | ||
"GateDelay1": "0ns", | ||
"GateDelay2": "0ns", | ||
"GateDelay3": "0ns", | ||
"Gates": 1, | ||
"Threshold Energies": "[-1, -1, -1]", | ||
"Frames in File": 1, | ||
"Frame Header Format": { | ||
"Frame Number": "8 bytes", | ||
"SubFrame Number/ExpLength": "4 bytes", | ||
"Packet Number": "4 bytes", | ||
"Bunch ID": "8 bytes", | ||
"Timestamp": "8 bytes", | ||
"Module Id": "2 bytes", | ||
"Row": "2 bytes", | ||
"Column": "2 bytes", | ||
"Reserved": "2 bytes", | ||
"Debug": "4 bytes", | ||
"Round Robin Number": "2 bytes", | ||
"Detector Type": "1 byte", | ||
"Header Version": "1 byte", | ||
"Packets Caught Mask": "64 bytes" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#include "SubFile.hpp" | ||
#include <iostream> | ||
// #include <filesystem> | ||
|
||
/** | ||
* SubFile methods | ||
* | ||
* | ||
*/ | ||
template <class Header, class DataType> | ||
SubFile<Header, DataType>::SubFile(std::filesystem::path fname, ssize_t rows, ssize_t cols) : rows(rows), cols(cols) { | ||
fp = fopen(fname.c_str(), "rb"); | ||
if (fp == nullptr) { | ||
throw std::runtime_error("Could not open file " + fname.string()); | ||
} | ||
std::cout<<"File opened"<<std::endl; | ||
n_frames = std::filesystem::file_size(fname) / (sizeof(Header) + rows * cols * sizeof(DataType)); | ||
std::cout<<"Number of frames: "<<n_frames<<std::endl; | ||
|
||
} | ||
/** | ||
* NormalSubFile methods | ||
*/ | ||
template <class Header, class DataType> | ||
NormalSubFile<Header, DataType>::NormalSubFile(std::filesystem::path fname, ssize_t rows, ssize_t cols) | ||
: SubFile<Header, DataType>(fname, rows, cols){}; | ||
|
||
template <class Header, class DataType> size_t NormalSubFile<Header, DataType>::read_impl(std::byte *buffer) { | ||
return fread(reinterpret_cast<char *>(buffer), sizeof(DataType) * this->rows * this->cols, 1, this->fp); | ||
}; | ||
|
||
|
||
|
||
/** | ||
* ReorderM03SubFile methods | ||
*/ | ||
template <class Header, class DataType> | ||
ReorderM03SubFile<Header, DataType>::ReorderM03SubFile(std::filesystem::path fname, ssize_t rows, ssize_t cols) | ||
: SubFile<Header, DataType>(fname, rows, cols){}; | ||
|
||
template <class Header, class DataType> size_t ReorderM03SubFile<Header, DataType>::read_impl(std::byte *buffer) { | ||
std::vector<DataType> tmp(this->pixels_per_frame()); | ||
size_t rc = fread(reinterpret_cast<char *>(&tmp[0]), this->bytes_per_frame(), 1, this->fp); | ||
|
||
int adc_nr[32] = {300, 325, 350, 375, 300, 325, 350, 375, 200, 225, 250, 275, 200, 225, 250, 275, | ||
100, 125, 150, 175, 100, 125, 150, 175, 0, 25, 50, 75, 0, 25, 50, 75}; | ||
int sc_width = 25; | ||
int nadc = 32; | ||
int pixels_per_sc = 5000; | ||
|
||
auto dst = reinterpret_cast<DataType *>(buffer); | ||
int pixel = 0; | ||
for (int i = 0; i != pixels_per_sc; ++i) { | ||
for (int i_adc = 0; i_adc != nadc; ++i_adc) { | ||
int col = adc_nr[i_adc] + (i % sc_width); | ||
int row; | ||
if ((i_adc / 4) % 2 == 0) | ||
row = 199 - int(i / sc_width); | ||
else | ||
row = 200 + int(i / sc_width); | ||
|
||
dst[col + row * 400] = tmp[pixel]; | ||
pixel++; | ||
} | ||
} | ||
return rc; | ||
}; | ||
|
||
template class NormalSubFile<sls_detector_header, uint16_t>; | ||
template class NormalSubFile<sls_detector_header, uint32_t>; | ||
template class ReorderM03SubFile<sls_detector_header, uint16_t>; |
Oops, something went wrong.