-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mods to support spectra file IO out of fortran #34
base: master
Are you sure you want to change the base?
Conversation
This looks like a nice addition - thanks! |
* added separate swig interface file * build tweaks for successful linking to shared libraries
* Then you can run ctest in the same dir you build in * Also update version in unit_tests
The beauty of doctest is you just have to include one header file.
unit_tests/test_spec_file.cpp
Outdated
//auto timesEqual = expectedM.start_time() == actualM.start_time(); | ||
auto timeStr1 = SpecUtils::to_iso_string(expectedM.start_time() ); | ||
auto timeStr2 = SpecUtils::to_iso_string(actualM.start_time() ); | ||
CHECK( timeStr1 == timeStr2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wcjohns I think we lose some time precision when we write and read pcf files. My test is failing when comparing measurement start times.
1: /mnt/c/Projects/code/SpecUtils/unit_tests/test_spec_file.cpp:81: ERROR: CHECK( timeStr1 == timeStr2 ) is NOT correct!
1: values: CHECK( 20240812T164010.285502 == 20240812T164010.29 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct - PCF files store time in VAX format (a 23 character string formatted like "19-Sep-2014 14:12:01.62"), so only to the 100th of a second.
SpecUtils normally tracks down to the microsecond (via using time_point_t = std::chrono::time_point<std::chrono::system_clock,std::chrono::microseconds>
).
It looks like SpecUtils::to_vax_string(..)
rounds to the nearest 0.01 seconds, so you could test:
auto timeStr1 = SpecUtils::to_vax_string( expectedM.start_time() );
auto timeStr2 = SpecUtils::to_vax_string( actualM.start_time() );
CHECK( timeStr1 == timeStr2);
Or something like:
CHECK( std::round(0.0001*expectedM.start_time().count()) == std::round(0.0001*actualM.start_time().count()) );
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks! I'll use to_vax_string
to compare.
@wcjohns I merged in master this am and did this cmake configuration:
I'm getting this error on WSL/Ubuntu:
|
Commit 6d8371f should fix this - let me know if not. |
CMakeLists.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If SpecUtils_FLT_PARSE_METHOD
is left as 'default_value' here, there is some logic below to hopefully pick the most reasonable float parsing method. Like for MSVC ≥2019, it should pick 'FromChars'.
Is there is reason to default to the slowest common denominator, or was it giving you an issue?
The default_value wasn't working for me, and I think that was before you fixed the FastFloat retrieval. I can revert it back to default_value.
…-Hugh
____________________________________________________
Hugh P. Bivens
Sandia National Laboratories
Albuquerque, NM USA
+1 (505) 284-6822
https://snl-wiki.sandia.gov/x/6ID2BQ
From: William Johnson ***@***.***>
Sent: Monday, September 16, 2024 5:43 PM
To: sandialabs/SpecUtils ***@***.***>
Cc: Bivens, Hugh P. ***@***.***>; Author ***@***.***>
Subject: [EXTERNAL] Re: [sandialabs/SpecUtils] Mods to support spectra file IO out of fortran (PR #34)
@wcjohns commented on this pull request.
________________________________
On CMakeLists.txt<#34 (comment)>:
If SpecUtils_FLT_PARSE_METHOD is left as 'default_value' here, there is some logic below to hopefully pick the most reasonable float parsing method. Like for MSVC ≥2019, it should pick 'FromChars'.
Is there is reason to default to the slowest common denominator, or was it giving you an issue?
-
Reply to this email directly, view it on GitHub<#34 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADAP4BE7WQ6LSBY52EADLQLZW5UJTAVCNFSM6AAAAABLPPWDBOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDGMBYGAYDANRUGI>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
* add pcf extension classes - this is the way
@@ -156,8 +156,8 @@ TEST_CASE("Round Trip") | |||
CheckFileExistanceAndDelete(n42Fname); | |||
|
|||
//auto detNames = generateDetectorNames(); | |||
//std::vector<std::string> detNames = { "Ba1", "Aa2", "Bc3", "Cb4" }; // Bc3 computes an out of range index | |||
std::vector<std::string> detNames = { "Ba1", "Aa2", "Bb3", "Cb4" }; | |||
std::vector<std::string> detNames = { "Ba1", "Aa2", "Bc3", "Cb4" }; // Bc3 computes an out of range index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wcjohns when I include Bc3 in the list of det names the test breaks:
Warning: 1 of the 4 gamma detectors didnt have conforming names, so they are being written in the first available spot in the PCF file.
1: ===============================================================================
1: /mnt/c/Projects/code/SpecUtils/unit_tests/test_spec_file.cpp:147:
1: TEST CASE: Round Trip
1: Write PCF File
1: Read PCF File
1:
1: /mnt/c/Projects/code/SpecUtils/unit_tests/test_spec_file.cpp:239: ERROR: CHECK( expectedM.deviation_pairs() == actualM.deviation_pairs() ) is NOT correct!
1: values: CHECK( {?} == {?} )
1: logged: devpair assert failed at: Bc3
1:
Isn't Bc3 a valid detector name?
No description provided.