My new combination of Andor software with Ikon-M camera takes data where the date and time is recorded as such:
Date and Time: Tue Jun 30 10:44:22.653 2026
In WrightTools.data.from_Solis(), we take this string and throw it into time.strptime('Tue Jun 30 10:44:22.06 2026', "%a %b %d %H:%M:%S %Y"), which throws an error while the seconds has decimals:
"ValueError: time data 'Tue Jun 30 10:44:22.06 2026' does not match format '%a %b %d %H:%M:%S %Y'"
Previous data (from the Wright Group PL Table) was not exported with fractional seconds in the timestamp, so there was no issue.
While the time library does have the option of using %f to assign a value in microseconds, it does not appear that time.strptime cares about microseconds, so this information is discarded, we just want it to not stop the import. There are many ways to do this:
- We could have a try and accept specific to this case
- Given that we already assume the time format, we could separate the seconds portion of the string, round it, and recombobulate the string
- We could loop and check that all numerical time components are nondecimal floats.
Given that this will make our code viable for use with new setups, it seems worthwhile to address. I can implement the update pending input on the preferred approach.
My new combination of Andor software with Ikon-M camera takes data where the date and time is recorded as such:
Date and Time: Tue Jun 30 10:44:22.653 2026
In WrightTools.data.from_Solis(), we take this string and throw it into time.strptime('Tue Jun 30 10:44:22.06 2026', "%a %b %d %H:%M:%S %Y"), which throws an error while the seconds has decimals:
"ValueError: time data 'Tue Jun 30 10:44:22.06 2026' does not match format '%a %b %d %H:%M:%S %Y'"
Previous data (from the Wright Group PL Table) was not exported with fractional seconds in the timestamp, so there was no issue.
While the time library does have the option of using %f to assign a value in microseconds, it does not appear that time.strptime cares about microseconds, so this information is discarded, we just want it to not stop the import. There are many ways to do this:
Given that this will make our code viable for use with new setups, it seems worthwhile to address. I can implement the update pending input on the preferred approach.