spacetelescope / jwst

Python library for science observations from the James Webb Space Telescope
https://jwst-pipeline.readthedocs.io/en/latest/
Other
569 stars 167 forks source link

ASDF update (2.7.3) prevents current slicing operation in ami_analyze #5827

Closed stscijgbot-jp closed 3 years ago

stscijgbot-jp commented 3 years ago

Issue JP-1955 was created on JIRA by Tyler Pauly:

For full-frame observations running through calwebb_ami3, ami_analyze includes indexing operations that are no longer supported by ASDF 2.7.3. Lines 57:59 now must include a

{...}.copy()

.

jdavies-st commented 3 years ago

I see, it is triggering on validation, before it even gets written out. @eslavich this is intended, right? Trigger on validation. I suspect this same custom_tree_to_tagged_tree function gets called on write.

stscijgbot-jp commented 8 months ago

Comment by Tyler Pauly on JIRA:

The first catch of this error in logs is given here:

2021-03-03 23:05:39,105 - stpipe.Ami3Pipeline.ami_analyze - INFO - Using filter throughput reference file /ifs/archive/test/jwst/ref/tmp_crds/cache/references/jwst/niriss/jwst_niriss_throughput_0008.fits
2021-03-03 23:05:39,134 - stpipe.Ami3Pipeline.ami_analyze - INFO - Extracting 80x80 subarray from full-frame data
----------------------------------------------------------------------
ERROR RUNNING STEP 'Ami3Pipeline':
    Only 2D ImageModel data can be processed.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/jwst/ami/ami_analyze_step.py", line 69, in process
    result = ami_analyze.apply_LG_plus(input_model, throughput_model,
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/jwst/ami/ami_analyze.py", line 57, in apply_LG_plus
    input_model.data = input_model.data[ystart-1:ystop, xstart-1:xstop]
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/stdatamodels/model_base.py", line 648, in __setattr__
    ndmodel.NDModel.__setattr__(self, attr, value)
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/stdatamodels/ndmodel.py", line 137, in data
    properties.ObjectNode.__setattr__(self, primary_array_name, value)
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/stdatamodels/properties.py", line 319, in __setattr__
    if node._validate():
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/stdatamodels/properties.py", line 262, in _validate
    return validate.value_change(self._name, self._instance, self._schema, self._ctx)
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/stdatamodels/validate.py", line 23, in value_change
    _check_value(value, schema, ctx)
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/stdatamodels/validate.py", line 49, in _check_value
    value = yamlutil.custom_tree_to_tagged_tree(value, ctx._asdf)
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/asdf/yamlutil.py", line 230, in custom_tree_to_tagged_tree
    return treeutil.walk_and_modify(
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/asdf/treeutil.py", line 406, in walk_and_modify
    return _recurse(top)
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/asdf/treeutil.py", line 392, in _recurse
    result = _handle_callback(node, json_id)
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/asdf/treeutil.py", line 270, in _handle_callback
    result = callback(node)
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/asdf/yamlutil.py", line 227, in walker
    return tag.to_tree_tagged(node, ctx)
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/asdf/types.py", line 314, in to_tree_tagged
    obj = cls.to_tree(node, ctx)
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/asdf/tags/core/ndarray.py", line 439, in to_tree
    raise ValueError(
ValueError: ASDF has only limited support for serializing views over arrays stored in FITS HDUs.  This error likely means that a slice of such an array was found in the ASDF tree.  The slice can be decoupled from the FITS array by calling copy() before assigning it to the tree.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/bin/strun", line 28, in <module>
    step = Step.from_cmdline(sys.argv[1:])
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/stpipe/step.py", line 173, in from_cmdline
    return cmdline.step_from_cmdline(args)
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/stpipe/cmdline.py", line 339, in step_from_cmdline
    step.run(*positional)
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/stpipe/step.py", line 407, in run
    step_result = self.process(*args)
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/jwst/pipeline/calwebb_ami3.py", line 83, in process
    result = self.ami_analyze(input_file)
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/stpipe/step.py", line 407, in run
    step_result = self.process(*args)
  File "/dms/local/jwst/pipeline/pkgs/miniconda3/envs/jwstdp-1.1.0.20210226-py38/lib/python3.8/site-packages/jwst/ami/ami_analyze_step.py", line 82, in process
    raise RuntimeError("Only 2D ImageModel data can be processed.") from err
RuntimeError: Only 2D ImageModel data can be processed.
stscijgbot-jp commented 8 months ago

Comment by Howard Bushouse on JIRA:

Fixed by #5828