Commit 73d2a561 authored by Jan Oliver Oelerich's avatar Jan Oliver Oelerich

More fixes and cleanup

parent 6541c044
......@@ -182,11 +182,11 @@ void GridManager::generateGrids() {
_defoci.push_back(mean);
_defocus_weights.push_back(1.0);
} else {
double sigma = fwhm / 2 * sqrt(2 * log(2));
double running_sum = 0;
float sigma = fwhm / 2 * (float)sqrt(2 * log(2));
float running_sum = 0;
// first value is spread, second value is center, third value is number
for(double d = mean - fwhm; d <= mean + fwhm; d += 2 * fwhm / (num_defoci - 1)) {
for(float d = mean - fwhm; d <= mean + fwhm; d += 2 * fwhm / (num_defoci - 1)) {
float val = (float)exp(-0.5 * pow(d - mean, 2) / pow(sigma, 2));
running_sum += val;
......
......@@ -281,7 +281,7 @@ namespace stemsalabim {
/*!
* Get the defocus values that are simulated.
*/
const std::vector<double> &defoci() const {
const std::vector<float> &defoci() const {
return _defoci;
}
......@@ -558,7 +558,7 @@ namespace stemsalabim {
std::vector<double> _adf_slice_coords;
std::vector<double> _cbed_slice_coords;
std::vector<float> _slice_coords;
std::vector<double> _defoci;
std::vector<float> _defoci;
std::vector<float> _defocus_weights;
std::vector<ScanPoint> _scan_points;
......
......@@ -150,8 +150,8 @@ void IO::initNCFile(const shared_ptr<GridManager> &gridman, const shared_ptr<ato
auto paramsGroup = f.defineGroup("params");
auto defocusDim = paramsGroup.defineDim("defocus", p.numberOfDefoci());
paramsGroup.defineVar<double>("defocus", vd({defocusDim}));
paramsGroup.defineVar<double>("defocus_weights", vd({defocusDim}));
paramsGroup.defineVar<float>("defocus", vd({defocusDim}));
paramsGroup.defineVar<float>("defocus_weights", vd({defocusDim}));
}
if(p.adf()) {
......@@ -889,7 +889,6 @@ void IO::dumpWave(string filename, const Wave &wave) {
std::shared_ptr<stemsalabim::atomic::Cell> IO::initCrystalFromXYZFile(const std::string &filename) {
atomic::ElementProvider elp = atomic::ElementProvider::getInstance();
atomic::Scattering &sf = atomic::Scattering::getInstance();
// some useful variable declarations
ifstream iss(filename);
......
This diff is collapsed.
......@@ -122,11 +122,11 @@ namespace stemsalabim {
void multisliceWorker(const SimulationState &st);
/*!
* Iterates the work_packages array and writes finished pixels to the output file. Should only be called from
* MPI rank 0 and is not thread safe, so only use it from the main thread!
* Stores the ScanPoint from work_packages with ids defined in pix_ids, for defocus idefocus and iconf
* in the temporary output file.
*/
void storeFinishedPixels(const SimulationState &st, std::vector<ScanPoint> &work_packages,
const std::vector<unsigned int> &indices);
void storeResultData(unsigned int idefocus, unsigned int iconf, const std::vector<unsigned int> &pix_ids,
std::vector<ScanPoint> &work_packages);
/*!
* Generate the propagator function for propagation of the wave between the slices.
......@@ -165,8 +165,7 @@ namespace stemsalabim {
* Store all finished results up to now.
*/
std::chrono::microseconds
storeDirtyResults(const SimulationState &st, std::vector<ScanPoint> &work_packages,
TaskQueue &scan_work);
storeDirtyResults(const SimulationState &st, std::vector<ScanPoint> &work_packages, TaskQueue &scan_work);
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment