@@ -52,7 +52,7 @@ def read_fileobj_or_hdulist(*args, **kwargs):
5252 hdulist .close ()
5353
5454
55- def spectrum_from_column_mapping (table , column_mapping , wcs = None , correl = None , verbose = False ):
55+ def spectrum_from_column_mapping (table , column_mapping , wcs = None , covar = None , verbose = False ):
5656 """
5757 Given a table and a mapping of the table column names to attributes
5858 on the Spectrum object, parse the information into a Spectrum.
@@ -76,10 +76,9 @@ def spectrum_from_column_mapping(table, column_mapping, wcs=None, correl=None, v
7676 wcs : :class:`~astropy.wcs.WCS` or :class:`gwcs.WCS`
7777 WCS object passed to the Spectrum initializer.
7878
79- correl : `astropy.table.Table`, optional
80- Table with correlation matrix for the uncertainties in coordinate
81- format; see `~astropy.nddata.Covariance`. If None, uncertainties are
82- assumed to be uncorrelated.
79+ covar : `astropy.table.Table`, optional
80+ Table providing a covariance matrix for the uncertainties in coordinate
81+ format; see `~astropy.nddata.Covariance`.
8382
8483 verbose : bool
8584 Print extra info.
@@ -136,28 +135,27 @@ def spectrum_from_column_mapping(table, column_mapping, wcs=None, correl=None, v
136135 spec_kwargs .setdefault (kwarg_name , kwarg_val )
137136
138137 # Ensure that the uncertainties are a subclass of NDUncertainty
139- if spec_kwargs .get ('uncertainty' ) is None and correl is not None :
138+ if spec_kwargs .get ('uncertainty' ) is None and covar is not None :
140139 warnings .warn ('Unable to parse uncertainty from provided table. Ignoring provided '
141- 'correlation matrix data.' )
142- correl = None
140+ 'covariance matrix data.' )
141+ covar = None
143142 if spec_kwargs .get ('uncertainty' ) is not None :
144- if correl is not None :
145- err = spec_kwargs .get ('uncertainty' )
143+ if covar is not None :
146144 try :
147- spec_kwargs ['uncertainty' ] = Covariance .from_tables ( err ** 2 , correl )
145+ spec_kwargs ['uncertainty' ] = Covariance .from_table ( covar )
148146 except (ValueError , TypeError ):
149- warnings .warn ('Unable to parse correlation table into a Covariance object. '
150- 'Ignoring correlation matrix data.' )
151- correl = None
147+ warnings .warn ('Unable to parse table with covariance data into into a Covariance '
148+ 'object. Ignoring covariance matrix data.' )
149+ covar = None
152150 # NOTE: This is not an `else` or `elif` block in order to catch the
153- # change to correl =None when handling the exception above.
154- if correl is None :
151+ # change to covar =None when handling the exception above.
152+ if covar is None :
155153 spec_kwargs ['uncertainty' ] = StdDevUncertainty (spec_kwargs .get ('uncertainty' ))
156154
157155 return Spectrum (** spec_kwargs , wcs = wcs , meta = {'header' : table .meta })
158156
159157
160- def generic_spectrum_from_table (table , wcs = None , correl = None , ** kwargs ):
158+ def generic_spectrum_from_table (table , wcs = None , covar = None , ** kwargs ):
161159 """
162160 Load spectrum from an Astropy table into a Spectrum object.
163161 Uses the following logic to figure out which column is which:
@@ -174,15 +172,15 @@ def generic_spectrum_from_table(table, wcs=None, correl=None, **kwargs):
174172
175173 Parameters
176174 ----------
177- table : `astropy.table.QTable`
178- Tabulated data with units
175+ table : :class:`~astropy.table.Table`
176+ Table containing a column of ``flux``, and optionally ``spectral_axis``
177+ and ``uncertainty`` as defined above.
179178 wcs : :class:`~astropy.wcs.WCS`, optional
180179 A FITS WCS object. If this is present, the machinery will fall back
181- to using the wcs to find the dispersion information.
182- correl : `astropy.table.Table`, optional
183- Table with correlation matrix for the uncertainties in coordinate
184- format; see `~astropy.nddata.Covariance`. If None, uncertainties are
185- assumed to be uncorrelated.
180+ to using the ``wcs`` to find the dispersion information.
181+ covar : `astropy.table.Table`, optional
182+ Table providing a covariance matrix for the uncertainties in coordinate
183+ format; see `~astropy.nddata.Covariance`.
186184
187185 Returns
188186 -------
@@ -297,24 +295,24 @@ def _find_spectral_column(table, columns_to_search, spectral_axis):
297295 if table [err_column ].ndim > 1 :
298296 err = table [err_column ].T
299297 elif flux .ndim > 1 : # Repeat uncertainties over all flux columns
300- if correl is not None :
301- warnings .warn ('When applying correlated errors , the dimensionality of the error '
298+ if covar is not None :
299+ warnings .warn ('When applying covariance , the dimensionality of the error '
302300 'array must match the dimensionality of the flux array. Ignoring '
303- 'correlated errors .' )
304- correl = None
301+ 'covariance .' )
302+ covar = None
305303 err = np .tile (table [err_column ], flux .shape [0 ], 1 )
306304 else :
307305 err = table [err_column ]
308- if correl is not None :
306+ if covar is not None :
309307 try :
310- err = Covariance .from_tables ( err ** 2 , correl )
308+ err = Covariance .from_table ( covar )
311309 except (ValueError , TypeError ):
312- warnings .warn ('Unable to parse correlation table into a Covariance object. '
313- 'Ignoring correlation matrix data.' )
314- correl = None
310+ warnings .warn ('Unable to parse covariance table into a Covariance object. '
311+ 'Ignoring covariance matrix data.' )
312+ covar = None
315313 # NOTE: This is not an `else` or `elif` block in order to catch the
316- # change to correl =None when handling the exception above.
317- if correl is None :
314+ # change to covar =None when handling the exception above.
315+ if covar is None :
318316 err = StdDevUncertainty (err .to (err .unit ))
319317 if np .min (table [err_column ]) <= 0. :
320318 warnings .warn ("Standard Deviation has values of 0 or less" , AstropyUserWarning )
0 commit comments