Time from astropy.time not precise
See original GitHub issueHello,
I encounter difficulties with Time. I’m working on a package to perform photometry and occultation.
For this last case, data need times values accurately estimated. Of course, data coming from different camera will will have different time format in the header.
to manage this without passing long time to build a time parser, i decided to use Time object which do exactly what i need. The problem is, i dont arrive to make accurate conversion between different format using Time.
let’s do an exemple:
t1 = '2022-03-24T23:13:41.390999'
t1 = Time(t1, format = 'isot', precision = len(t1.split('.')[-1]))
t2 = t1.to_value('jd')
# result is 2459663.4678401737
now let’s do reverse
t2 = Time(t2, format = 'jd', precision = len(str(t2).split('.')[-1]))
t3 = t2.to_value('isot')
# result is 2022-03-24T23:13:41.0551352177
as you can see i don’t fall back on the same value and the difference is quite high. I would like to fall back on the original one.
thank you in advance
Issue Analytics
- State:
- Created a year ago
- Comments:13 (9 by maintainers)
Top Results From Across the Web
Time and Dates (astropy.time) — Astropy v5.2
The precision setting affects string formats when outputting a value that includes seconds. It must be an integer between 0 and 9. There...
Read more >Time and Dates (astropy.time) — Astropy v1.0.4
The Time object maintains an internal representation of time as a pair of double precision numbers expressing Julian days. The sum of the...
Read more >Time and Dates (astropy.time) — Astropy v3.2.dev994
The Time object maintains an internal representation of time as a pair of double precision numbers expressing Julian days. The sum of the...
Read more >Time and Dates (astropy.time)
The sum of the two numbers is the Julian Date for that time relative to the given time scale. Users requiring no better...
Read more >Transition from datetime to astropy.time
Time can provide sub-nanosecond precision for time objects while ... Time . datetime has no support for leap second while ~astropy.time.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Probably we should keep this open to address the issue with precsion > 9 that @saimn found?
As for how to fix this, right now we do check
precision
as a property, but not on input:Seems reasonable to check on input as well.