Comments (5)
Tagging @mhvk and @taldcroft, for their advice on refactoring the time converter:
asdf-astropy/asdf_astropy/converters/time/time.py
Lines 14 to 104 in 816dc57
from asdf-astropy.
@WilliamJamieson - in newer astropy, the way to ensure precision is not lost when using a string representation is
from astropy.time import Time
t = Time(50000., 1/9, format='mjd')
t.to_value('mjd', 'str')
# '50000.1111111111111111'
Note that this will round-trip for MJD, but not for BYEAR, since the latter involves a calculation that uses a single float
. But at least it should be considerably closer.
from asdf-astropy.
@mhvk, in an offline conversation with @taldcroft, it was suggested that maybe we should use something like Time.info._represent_as_dict()
, which should be "stable". This would let us serialize the JD1/JD2 representation that astropy is using to represent the given time, which should round trip?
If this seems like an option, we might require something like a to_dict
(or to_yaml
) and from_dict
method to be added to astropy.time.Time
which we could then use a new Converter
and schema
for.
from asdf-astropy.
@WilliamJamieson - I think explicitly using the methods astropy uses internally to serialize objects makes sense. I'm not quite sure that this would need a method on Time
itself, especially since you may well want a similar procedure for SkyCoord
. Perhaps instead we should just make our current machinery public? (Could be functions or public methods on .info
.)
from asdf-astropy.
Could be functions or public methods on
.info
.
This is fine, I just would prefer to use some sort of public interface to both serialize and deserialize (construct) Time
objects using the representations astropy works with internally. That way I can rely on the interface being consistent.
from asdf-astropy.
Related Issues (20)
- Does the data block needs to be binary? HOT 6
- different output compared to astropy.io.misc.asdf HOT 1
- `dtype` is not preserved roundtrip by `Quantity`
- `Time` values do not always round trip perfectly HOT 6
- Support non-VOunits HOT 5
- Support `MagUnits` HOT 1
- Fixing AstropyDeprecationWarning by using asdf-astropy causes real failure HOT 1
- setting compression on individual columns of astropy table HOT 2
- `assert_model_roundtrip` should be a `helper`
- Access table metadata without loading data HOT 8
- Warnings from package building
- Missing converter for `astropy.coordinates.representation.geodetic` HOT 1
- Allow lazy loading of Quantity instances created during deserialization HOT 1
- Support MaskedQuantity
- Circular dependency with astropy? HOT 5
- Investigate options for saving tables with standard asdf table tag
- Release in preparation for astropy 6.0 HOT 1
- Failed tests: cannot represent an object: RepresenterError HOT 6
- Copy semantics change in numpy 2.0 caused incompatibility with astropy v6.1rc HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asdf-astropy.