Skip to content

Tabular models fail to serialize to asdf when used with units#8037

Closed
Cadair wants to merge 2 commits into
astropy:masterfrom
Cadair:tabular1d_asdf
Closed

Tabular models fail to serialize to asdf when used with units#8037
Cadair wants to merge 2 commits into
astropy:masterfrom
Cadair:tabular1d_asdf

Conversation

@Cadair

@Cadair Cadair commented Oct 30, 2018

Copy link
Copy Markdown
Member

This is a bug report in the form of a regression test.

It seems that when presented with a Tabular model where points and lookup_table are units the asdf tag fails. I am currently debugging this insanity.

Tabular models with units will not round trip to asdf

[ci skip]
@astropy-bot

astropy-bot Bot commented Oct 30, 2018

Copy link
Copy Markdown

Hi there @Cadair 👋 - thanks for the pull request! I'm just a friendly 🤖 that checks for issues related to the changelog and making sure that this pull request is milestoned and labeled correctly. This is mainly intended for the maintainers, so if you are not a maintainer you can ignore this, and a maintainer will let you know if any action is required on your part 😃.

I see this is a work in progress pull request. I'll report back on the checks once the PR is ready for review.

If there are any issues with this message, please report them here.

@Cadair

Cadair commented Oct 30, 2018

Copy link
Copy Markdown
Member Author

I ci skipped to save cycles. the error is:

astropy/io/misc/asdf/tags/transform/tests/test_transform.py:131: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/asdf/tests/helpers.py:175: in assert_roundtrip_tree
    AsdfFile(tree, extensions=extensions, **init_options).write_to(buff, **write_options)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/asdf/asdf.py:1071: in write_to
    self._serial_write(fd, pad_blocks, include_block_index)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/asdf/asdf.py:832: in _serial_write
    self._write_tree(self._tree, fd, pad_blocks)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/asdf/asdf.py:793: in _write_tree
    yamlutil.dump_tree(tree, fd, self)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/asdf/yamlutil.py:336: in dump_tree
    tags=tags)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/yaml/__init__.py:188: in dump_all
    dumper.represent(data)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/yaml/representer.py:26: in represent
    node = self.represent_data(data)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/asdf/yamlutil.py:78: in represent_data
    node = super(AsdfDumper, self).represent_data(data)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/yaml/representer.py:47: in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/asdf/yamlutil.py:103: in represent_mapping
    None, mapping.data, flow_style)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/yaml/representer.py:116: in represent_mapping
    node_value = self.represent_data(item_value)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/asdf/yamlutil.py:78: in represent_data
    node = super(AsdfDumper, self).represent_data(data)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/yaml/representer.py:47: in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/asdf/yamlutil.py:103: in represent_mapping
    None, mapping.data, flow_style)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/yaml/representer.py:116: in represent_mapping
    node_value = self.represent_data(item_value)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/asdf/yamlutil.py:78: in represent_data
    node = super(AsdfDumper, self).represent_data(data)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/yaml/representer.py:47: in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/yaml/representer.py:197: in represent_list
    return self.represent_sequence('tag:yaml.org,2002:seq', data)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/yaml/representer.py:91: in represent_sequence
    node_item = self.represent_data(item)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/asdf/yamlutil.py:78: in represent_data
    node = super(AsdfDumper, self).represent_data(data)
/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/yaml/representer.py:57: in represent_data
    node = self.yaml_representers[None](self, data)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <asdf.yamlutil.dump_tree.<locals>.AsdfDumperTmp object at 0x55b25a2a5058>, data = <Quantity 0. pix>

    def represent_undefined(self, data):
>       raise RepresenterError("cannot represent an object: %s" % data)
E       yaml.representer.RepresenterError: cannot represent an object: 0.0 pix

/opt/miniconda/envs/astropy-dev/lib/python3.7/site-packages/yaml/representer.py:229: RepresenterError

@nden nden added modeling zzz 💤 io.misc.asdf archived: Go to asdf-astropy repo labels Oct 30, 2018
@pllim

pllim commented Oct 30, 2018

Copy link
Copy Markdown
Member

@Cadair , is this release critical?

@Cadair

Cadair commented Oct 30, 2018

Copy link
Copy Markdown
Member Author

@Cadair , is this release critical?

yes, also probably a bug in 3.0 as well.

@pllim pllim added this to the v3.1 milestone Oct 30, 2018
@pllim pllim requested a review from drdavella October 30, 2018 15:31
bb = [list(item) for item in model.bounding_box]
node['bounding_box'] = bb

if 'bounding_box' not in node:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this is needed. When does this evaluate as True?

@nden

nden commented Oct 31, 2018

Copy link
Copy Markdown
Contributor

After looking a bit more into this, the problem is that model.bounding_box does not allow serialization if the values are Quantities. I will submit a fix for this today.

@pllim

pllim commented Oct 31, 2018

Copy link
Copy Markdown
Member

Superseded by #8052

@pllim pllim closed this Oct 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug modeling zzz 💤 io.misc.asdf archived: Go to asdf-astropy repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants