You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say a user has an astropy.table.Table that when serialized could conform to a more generic tableschema/tag.
af=AsdfFile({"my_table": generic_astropy_table})
On write, asdf will call the select_tag method of the table converter (if one is implemented) to determine what tag to use (and in turn which schema to use to check the serialized table). The current signature to select_tag provides the converter with:
Neither of which contain user-definable information about which tag to use in this specific case. It may be helpful to provide a way for a user to do something like:
to inform asdf that the user would like to use the generic table tag for this object.
This may help to break the link between objects and tags for the python library. We should consider the side-effects this might produce.
Relation to astropy units
This could be helpful for other tags (like unit) where currently the asdf-astropy converter automatically selects a tag based on if the unit is vo-compatible or not. This has issues where a user may provide what they think is a valid astropy unit (but is not a vo-compatible unit) and then they see validation errors if the schema only allows the generic unit tag and not astropy units.
Generic options
An additional point to consider is if the per-object options (which already exist for array objects) could be standardized. So instead of the above use_tag perhaps something like:
This last example highlights one concern with these generic options. The compression_kwargs are not saved to the file some consideration of how these options are round-tripped is worthwhile before developing this new API.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Let's say a user has an
astropy.table.Table
that when serialized could conform to a more generictable
schema/tag.On write, asdf will call the
select_tag
method of the table converter (if one is implemented) to determine what tag to use (and in turn which schema to use to check the serialized table). The current signature toselect_tag
provides the converter with:obj
: in this case the astropy tablectx
: the SerializationContextNeither of which contain user-definable information about which tag to use in this specific case. It may be helpful to provide a way for a user to do something like:
to inform asdf that the user would like to use the generic table tag for this object.
This may help to break the link between objects and tags for the python library. We should consider the side-effects this might produce.
Relation to astropy units
This could be helpful for other tags (like unit) where currently the asdf-astropy converter automatically selects a tag based on if the unit is vo-compatible or not. This has issues where a user may provide what they think is a valid astropy unit (but is not a vo-compatible unit) and then they see validation errors if the schema only allows the generic unit tag and not astropy units.
Generic options
An additional point to consider is if the per-object options (which already exist for array objects) could be standardized. So instead of the above
use_tag
perhaps something like:and to replace
set_array_storage
:and
set_compression
:and
set_compression_kwargs
:This last example highlights one concern with these generic options. The compression_kwargs are not saved to the file some consideration of how these options are round-tripped is worthwhile before developing this new API.
Beta Was this translation helpful? Give feedback.
All reactions