From c0b59b1dd47ecd32764a8f3aa7416899427c34cf Mon Sep 17 00:00:00 2001 From: Erik Tollerud Date: Tue, 12 Nov 2024 19:51:34 -0500 Subject: [PATCH] Backport PR #3279: update datamodels example to include more info --- docs/imviz/import_data.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/imviz/import_data.rst b/docs/imviz/import_data.rst index df682e66ee..6e94873b23 100644 --- a/docs/imviz/import_data.rst +++ b/docs/imviz/import_data.rst @@ -94,12 +94,15 @@ object, you can load it into Imviz as follows: .. code-block:: python - import numpy as np - from astropy.nddata import NDData + from astropy.nddata import NDData, StdDevUncertainty from jdaviz import Imviz - # mydatamodel is a jwst.datamodels object - ndd = NDData(np.array(mydatamodel.data), wcs=mydatamodel.get_fits_wcs()) + # mydatamodel is a jwst.datamodels object with stddev ERR array + ndd = NDData(mydatamodel.data, + uncertainty=StdDevUncertainty(mydatamodel.err), + mask=mydatamodel.dq, + wcs=mydatamodel.meta.wcs, + meta=dict(mydatamodel.meta.items())) imviz = Imviz() imviz.load_data(ndd, data_label='my_data_model') imviz.show()