Skip to content

Commit

Permalink
Merge pull request #150 from aglowacki/master
Browse files Browse the repository at this point in the history
Added load mca to int_spec load func
  • Loading branch information
Arthur Glowacki authored Oct 12, 2022
2 parents 1449853 + 7340fbe commit ae98929
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "src/support/eigen-git-mirror"]
path = src/support/eigen-git-mirror
url = https://github.com/eigenteam/eigen-git-mirror.git
url = https://gitlab.com/libeigen/eigen.git
[submodule "src/support/pybind11"]
path = src/support/pybind11
url = https://github.com/pybind/pybind11.git
Expand Down
42 changes: 42 additions & 0 deletions src/io/file/hl_file_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,48 @@ DLL_EXPORT bool load_and_integrate_spectra_volume(std::string dataset_directory,
}
}


bool ends_in_mca = false;
size_t dlen = dataset_file.length();
if (dataset_file[dlen - 4] == '.' && dataset_file[dlen - 3] == 'm' && dataset_file[dlen - 2] == 'c' && dataset_file[dlen - 1] == 'a')
{
ends_in_mca = true;
}
else
{
for (int i = 0; i < 8; i++)
{
std::string s1 = std::to_string(i);
if (dataset_file[dlen - 5] == '.' && dataset_file[dlen - 4] == 'm' && dataset_file[dlen - 3] == 'c' && dataset_file[dlen - 2] == 'a' && dataset_file[dlen - 1] == s1[0])
{
ends_in_mca = true;
break;
}
}
}

if (ends_in_mca)
{
Spectra<T_real> spec;
unordered_map<string, T_real> pv_map;
if (true == io::file::mca::load_integrated_spectra(dataset_directory + "mda" + DIR_END_CHAR + dataset_file, integrated_spectra, pv_map))
{
if (pv_map.count(STR_SR_CURRENT) > 0)
{
params_override->sr_current = pv_map.at(STR_SR_CURRENT);
}
if (pv_map.count(STR_US_IC) > 0)
{
params_override->US_IC = pv_map.at(STR_US_IC);
}
if (pv_map.count(STR_DS_IC) > 0)
{
params_override->DS_IC = pv_map.at(STR_DS_IC);
}
return true;
}
}

// try to load from a pre analyzed file because they should contain the integrated spectra
std::string fullpath = dataset_directory + "img.dat" + DIR_END_CHAR + dataset_file + ".h5";
if (detector_num != -1)
Expand Down
2 changes: 1 addition & 1 deletion src/support/eigen-git-mirror
Submodule eigen-git-mirror updated from 36b959 to 462758
2 changes: 1 addition & 1 deletion vcpkg
Submodule vcpkg updated 3462 files

0 comments on commit ae98929

Please sign in to comment.