Skip to content

Mods to support spectra file IO out of fortran#34

Draft
hbivens wants to merge 131 commits intomasterfrom
issue/31-spectra-io-out-of-fortran
Draft

Mods to support spectra file IO out of fortran#34
hbivens wants to merge 131 commits intomasterfrom
issue/31-spectra-io-out-of-fortran

Conversation

@hbivens
Copy link
Copy Markdown
Collaborator

@hbivens hbivens commented Jul 25, 2024

No description provided.

@hbivens hbivens requested a review from wcjohns July 25, 2024 23:46
@hbivens hbivens linked an issue Jul 25, 2024 that may be closed by this pull request
@hbivens hbivens changed the title Add install stuff and support for Finding Specutils in CMake Mods to support spectra file IO out of fortran Jul 25, 2024
@wcjohns
Copy link
Copy Markdown
Collaborator

wcjohns commented Jul 25, 2024

This looks like a nice addition - thanks!

Comment thread 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);
Copy link
Copy Markdown
Collaborator Author

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 )

Copy link
Copy Markdown
Collaborator

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()) );

Copy link
Copy Markdown
Collaborator Author

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.

@hbivens hbivens marked this pull request as ready for review August 30, 2024 20:30
This was referenced Aug 30, 2024
@wcjohns
Copy link
Copy Markdown
Collaborator

wcjohns commented Jan 30, 2025

It looks like its libSpecUtils.a that is causing the issue; I'm not sure why delocate is trying to do its thing on a static library, I thought it essentially fixed up shared libraries.

I just pushed 4e70828 and 4f0f402, which changes the main CMakeLists.txt file so none of the install stuff is called, if the build is not a top-level project. E.g., if a python build.
It seems like this is probably the behavior wanted, in general - does it seem like it to you?

@hbivens
Copy link
Copy Markdown
Collaborator Author

hbivens commented Jan 30, 2025

It looks like its libSpecUtils.a that is causing the issue; I'm not sure why delocate is trying to do its thing on a static library, I thought it essentially fixed up shared libraries.

I just pushed 4e70828 and 4f0f402, which changes the main CMakeLists.txt file so none of the install stuff is called, if the build is not a top-level project. E.g., if a python build. It seems like this is probably the behavior wanted, in general - does it seem like it to you?

Yeah I don't think we need to install stuff on a python build.

@hbivens
Copy link
Copy Markdown
Collaborator Author

hbivens commented Mar 12, 2025

@wcjohns How do I set or get the energy cal low energy field?

image

@wcjohns
Copy link
Copy Markdown
Collaborator

wcjohns commented Mar 12, 2025

Its the 5th entry in the energy calibration coefficient parameters.
For example, its used here.

@hbivens
Copy link
Copy Markdown
Collaborator Author

hbivens commented Mar 12, 2025

Its the 5th entry in the energy calibration coefficient parameters. For example, its used here.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spectra io out of fortran

2 participants