The SpecOneD Module

This module introduces the SpecOneD class, it’s functions and the related PassBand class. The main purpose of the SpecOneD class and it’s children classes is to provide python functionality for the manipulation of 1D spectral data in astronomy.

class sculptor.speconed.PassBand(passband_name=None, dispersion=None, fluxden=None, fluxden_err=None, header=None, dispersion_unit=None, fluxden_unit=None)

The PassBand class, a child of the SpecOneD class, is a data structure for storing and manipulating astronomical filter transmission curves.

Parameters:
  • passband_name (str) – Name of the passband. The passband names provided with the Sculptor package are in the format [ INSTRUMENT]-[BAND] and can be found in the Sculptor data folder.

  • dispersion (numpy.ndarray) – A 1D array providing the dispersion axis of the passband.

  • fluxden (numpy.ndarray) – A 1D array providing the transmission data of the spectrum in quantum efficiency.

  • fluxden_err (numpy.ndarray) – A 1D array providing the 1-sigma error of the passband’s transmission curve.

  • header (pandas.DataFrame) – A pandas DataFrame containing additional information on the spectrum.

  • dispersion_unit (astropy.units.Unit or astropy.units.Quantity or astropy.units.CompositeUnit or astropy.units.IrreducibleUnit) – The physical unit (including normalization factors) of the dispersion axis of the passband.

  • fluxden_unit (astropy.units.Unit or astropy.units.Quantity or astropy.units.CompositeUnit or astropy.units.IrreducibleUnit) – The physical unit (including normalization factors) of the transmission curve and associated properties (e.g. flux density error) of the spectrum.

convert_spectral_units(new_dispersion_unit)

Convert the passband to new physical dispersion units.

This function only converts the passband dispersion axis.

Parameters:

new_dispersion_unit

Type:

astropy.units.Unit or astropy.units.Quantity or astropy.units.CompositeUnit or astropy.units.IrreducibleUnit

Returns:

load_passband(passband_name, tolerance=0.005)

Load a passband from the sculptor/data/passbands folder.

The passband names are in the following format: [INSTRUMENT]-[BAND]

Parameters:
  • passband_name (str) – Name of the passband, e.g. WISE-W1

  • tolerance (float) – Value below which the passband throughput will be ignored when reading the passband in. In many cases the original passband files contain a large range of 0 values below and above the passband. The default value for the tolerance is 0.005, i.e. 0.5% throughput.

Returns:

plot(mask_values=False, ymin=0, ymax=1.1)

Plot the passband.

This plot is aimed for a quick visualization of the passband spectrum and not for publication grade figures.

Parameters:
  • mask_values (bool) – Boolean to indicate whether the mask will be applied when plotting the spectrum (default:True).

  • ymin (float) – Minimum value for the y-axis of the plot (flux density axis). This defaults to ‘None’. If either ymin or ymax are ‘None’ the y-axis range will be determined automatically.

  • ymax (float) – Maximum value for the y-axis of the plot (flux density axis). This defaults to ‘None’. If either ymin or ymax are ‘None’ the y-axis range will be determined automatically.

Returns:

class sculptor.speconed.SpecOneD(dispersion=None, fluxden=None, fluxden_err=None, fluxden_ivar=None, header=None, dispersion_unit=None, fluxden_unit=None, obj_model=None, telluric=None, mask=None)

The SpecOneD class provides a data structure for 1D astronomical spectra with extensive capabilities for spectrum analysis and manipulation.

Parameters:
  • dispersion (numpy.ndarray) – A 1D array providing the dispersion axis of the spectrum.

  • fluxden (numpy.ndarray) – A 1D array providing the flux density data of the spectrum.

  • fluxden_err (numpy.ndarray) – A 1D array providing the 1-sigma flux density error of the spectrum.

  • fluxden_ivar (numpy.ndarray) – A 1D array providing the inverse variance of the flux density for the spectrum.

  • header (pandas.DataFrame) – A pandas DataFrame containing additional information on the spectrum.

  • dispersion_unit (astropy.units.Unit or astropy.units.Quantity or astropy.units.CompositeUnit or astropy.units.IrreducibleUnit) – The physical unit (including normalization factors) of the dispersion axis of the spectrum.

  • fluxden_unit (astropy.units.Unit or astropy.units.Quantity or astropy.units.CompositeUnit or astropy.units.IrreducibleUnit) – The physical unit (including normalization factors) of the flux density and associated properties (e.g. flux density error) of the spectrum.

  • obj_model (numpy.ndarray) – Object model from the telluric correction routine of PypeIt.

  • telluric (numpy.ndarray) – Telluric (atmospheric transmission) model from the telluric correction routine of PypeIt.

  • mask (numpy.ndarray) – A boolean 1D array specifying regions that allows to mask region in the spectrum during spectral manipulation or for display purposes.

Raises:

ValueError – Raises a ValueError if the supplied header is not a pandas.DataFrame

apply_extinction(a_v, r_v, extinction_law='ccm89', inplace=False)

Apply extinction to the spectrum (flux density ONLY).

This function makes use of the python extinction package: https://github.com/kbarbary/extinction .

Their documentation is available at https://extinction.readthedocs.io/en/latest/ .

Please have a careful look at their implementation and regarding details on the use of a_v and r_v. Possible extinction laws to use are “ccm89”, “odonnell94”, “calzetti00”, “fitzpatrick99”, “fm07”.

Parameters:
  • a_v (float) – Extinction value ein the V band.

  • r_v (float) – Ratio of total to selective extinction r_v = a_v/E(B-V)

  • extinction_law (str) – Extinction law name as implemented in the extinction package, see documentation.

  • inplace (bool) – Boolean to indicate whether the active SpecOneD object will be modified or a new SpecOneD object will be created and returned.

Returns:

Returns the binned spectrum as a SpecOneD object if inplace==False.

Return type:

SpecOneD

average_fluxden(dispersion_range=None)

Calculate the average flux density over the full spectrum or the specified dispersion range

Parameters:

dispersion_range ([float, float]) – Dispersion range over which to average the flux density.

Returns:

Average flux density of the full spectrum or specified dispersion range

Return type:

float

bin_by_npixels(npix, inplace=False)

Bin the spectrum by an integer number of pixel.

The spectrum is binned by npix pixel. A new dispersion axis is calculated asumming that the old dispersion values marked the center positions of their bins.

The flux density (obj_model, telluric) are averaged over the new bin width, whereas the flux density error is accordingly propagated.

The spectrum mask will be automatically reset.

Parameters:
  • npix (int) – Number of pixels to be binned.

  • inplace (boolean) – Boolean to indicate whether the active SpecOneD object will be modified or a new SpecOneD object will be created and returned.

Returns:

Returns the binned spectrum as a SpecOneD object if inplace==False.

Return type:

SpecOneD

broaden_by_gaussian(fwhm, inplace=False)

The spectrum is broadened by a Gaussian with the specified FWHM ( in km/s).

The convolution of the current spectrum and the Gaussian is performed in logarithmic wavelength. Therefore, the spectrum is first converted to flux per logarithmic wavelength, then convolved with the Gaussian kernel and then converted back.

The conversion functions will automatically take care of the unit conversion and input spectra can be in flux density per unit frequency or wavelength.

This function normalizes the output of the convolved spectrum in a way that a Gaussian input signal of FWHM X broadened by a Gaussian kernel of FWHM Y, results in a Gaussian output signal of FWHM sqrt( X**2+Y**2) with the same amplitude as the input signal. Due to the normalization factor of the Gaussian itself, this results in a lower peak height.

The input spectrum and the Gaussian kernel are matched to the same dispersion axis using the ‘interpolate’ function.

Parameters:
  • fwhm (float) – FWHM of the Gaussian that the spectrum will be convolved with in km/s.

  • inplace (bool) – Boolean to indicate whether the active SpecOneD object will be modified or a new SpecOneD object will be created and returned.

Returns:

Returns the binned spectrum as a SpecOneD object if inplace==False.

Return type:

SpecOneD

calculate_passband_ab_magnitude(passband, match_method='interpolate', force=False)

Calculate the AB magnitude of the spectrum in the given passband.

AB magnitudes are calculated following equation 4 in https://arxiv.org/pdf/astro-ph/0210394.pdf

Parameters:
  • passband (PassBand) – The astronomical passband with throughput in quantum efficiencies.

  • match_method (str) – Method for matching the dispersion axis of the spectrum to the passband.

  • force (bool) – Boolean to indicate if they spectra will be forced to match if the spectrum does not fully cover the passband. The forced match will result in an inner match of the spectrum’s and the passband’s dispersion axes. User discretion is advised.

Returns:

AB magnitude of the spectrum in the specified passband :rtype: float

calculate_passband_flux_density(passband, match_method='interpolate', force=False)

Calculate the integrated flux in the specified passband.

Parameters:
  • passband (PassBand) – The astronomical passband with throughput in quantum efficiencies.

  • match_method (str) – Method for matching the dispersion axis of the spectrum to the passband.

  • force (bool) – Boolean to indicate if they spectra will be forced to match if the spectrum does not fully cover the passband. The forced match will result in an inner match of the spectrum’s and the passband’s dispersion axes. User discretion is advised.

Returns:

Integrated spectrum flux in the passband

Return type:

Quantity

check_dispersion_overlap(secondary_spectrum)

Check the overlap between the active spectrum and the supplied secondary spectrum.

This method determines whether the active spectrum (primary) and the supplied spectrum (secondary) have overlap in their dispersions. Possible cases include: i) The current spectrum dispersion is fully within the dispersion range of the ‘secondary’ spectrum -> ‘primary’ overlap. ii) The secondary spectrum dispersion is fully within the dispersion range of the current spectrum -> ‘secondary’ overlap. iii) and iv) There is only partial overlap between the spectra -> ‘partial’ overlap. v) There is no overlap between the spectra -> ‘none’ overlap. In the case of no overlap np.NaN values are returned for the minimum and maximum dispersion limits.

Parameters:

secondary_spectrum (SpecOneD) –

Returns:

overlap, overlap_min, overlap_max Returns a string indicating the dispersion overlap type according to the cases above ‘overlap and the minimum and maximum dispersion value of the overlap region of the two spectra.

Return type:

(str, float, float)

check_units(spectrum)

Raise a ValueError if current and input spectrum have different dispersion of flux density units.

Parameters:

spectrum (SpecOneD) –

Returns:

convert_spectral_units(new_dispersion_unit, new_fluxden_unit, verbosity=0)

Convert the spectrum to new physical dispersion and flux density units.

The function converts the flux density, the dispersion, the flux density error and the inverse variance. Object model and telluric if they exist will not be converted.

Parameters:
  • new_dispersion_unit (astropy.units.Unit or astropy.units.Quantity or astropy.units.CompositeUnit or astropy.units.IrreducibleUnit) – New dispersion unit (or quantity)

  • new_fluxden_unit (astropy.units.Unit or astropy.units.Quantity or astropy.units.CompositeUnit or astropy.units.IrreducibleUnit) – New flux density unit (or quantity)

Returns:

copy()

Copy the current SpecOneD object to a new instance and return it.

Returns:

Return type:

SpecOneD

create_dispersion_by_resolution(resolution)

This function creates a new dispersion axis in wavelength sampled by a fixed resolution, given in km/s.

This should work for all spectra with flux densities per unit wavelength/frequency.

Parameters:

resolution

Returns:

Returns new dispersion axis with a resolution in km/s as given by the input value.

Return type:

numpy.ndarray

get_fluxden_error_from_ivar()

Calculate the flux density 1-sigma error from the inverse variance of the flux density/

Returns:

get_ivar_from_fluxden_error()

Calculate inverse variance of the flux density from the flux density 1-sigma error.

Returns:

get_specplot_ylim()
Calculate the minimum and maximum flux density values for plotting

the spectrum.

The minimum value is set to -0.5 * median of the flux density. The maximum value is set 4 times the 84-percentile value of the flux density. This is an ‘approximate guess’ for a quick visualization of the spectrum and may not be optimal for all purposes. For pulication grade plots, the user should devise their own plots.

Returns:

(ylim_min, ylim_max) Return the minimum and maximum values for the flux density (y-axis) for the plot function.

Return type:

(float, float)

interpolate(new_dispersion, kind='linear', fill_value='const', inplace=False, verbosity=0)

Interpolate spectrum to a new dispersion axis.

The interpolation is done using scipy.interpolate.interp1d.

Interpolating a spectrum to a new dispersion axis automatically resets the spectrum mask.

Parameters:
  • new_dispersion (numpy.ndarray) – 1D array with the new dispersion axis

  • kind (str) – String that indicates the interpolation function ( default: ‘linear’)

  • fill_value (str) – A string indicating whether values outside the dispersion range will be extrapolated (‘extrapolate’) or filled with a constant value (‘const’) based on the median of the 10 values at the edge.

  • inplace (bool) – Boolean to indicate whether the active SpecOneD object will be modified or a new SpecOneD object will be created and returned.

  • verbosity (int) – Integer indecating the verbosity level

Returns:

mask_between(limits, inplace=False)

Mask spectrum between specified dispersion limits.

Parameters:
  • limits ([float, float]) – A list of two floats indicating the lower and upper dispersion limit to mask between.

  • inplace (bool) – Boolean to indicate whether the active SpecOneD object will be modified or a new SpecOneD object will be created and returned.

Returns:

mask_by_snr(signal_to_noise_ratio, inplace=False)

Mask all regions with a signal to noise below the specified limit

Parameters:
  • signal_to_noise_ratio (float) – All regions of the spectrum with a value below this limit will be masked.

  • inplace (bool) – Boolean to indicate whether the active SpecOneD object will be modified or a new SpecOneD object will be created and returned.

Returns:

SpecOneD

match_dispersions(secondary_spectrum, match_secondary=True, force=False, method='interpolate', interp_method='linear')

Match the dispersion of the current spectrum and the secondary spectrum.

Both, current and secondary, SpecOneD objects are modified in this process. The dispersion match identifies the maximum possible overlap in the dispersion direction of both spectra and automatically trims them to that range.

If the current (primary) spectrum overlaps fully with the secondary spectrum the dispersion of the secondary will be interpolated/resampled to the primary dispersion.

If the secondary spectrum overlaps fully with the primary, the primary spectrum will be interpolated/resampled on the secondary spectrum resolution, but this will only be executed if ‘force==True’ and ‘match_secondary==False’.

If there is partial overlap between the spectra and ‘force==True’ the secondary spectrum will be interpolated/resampled to match the dispersion values of the primary spectrum.

If there is no overlap a ValueError will be raised.

Parameters:
  • secondary_spectrum (SpecOneD) – Secondary spectrum

  • match_secondary (bool) – The boolean indicates whether the secondary will always be matched to the primary or whether reverse matching, primary to secondary is allowed.

  • force (bool) – The boolean sets whether the dispersions are matched if only partial overlap between the spectral dispersions exists.

  • method (str) –

  • interp_method (str) –

Returns:

Raises:

ValueError – A ValueError will be raised if there is no overlap between the spectra.

normalize_fluxden_by_error(inplace=False)

Normalize the flux density, flux density error and object model numerical values by the median value of the flux density error array.

The flux density unit will be scaled accordingly. Hence, this normalization does not affect the physical values of the flux density and only serves to normalize the values in the flux density array.

This enables more efficient calculations on the flux density array by avoiding small numerical values.

Parameters:

inplace (bool) – Boolean to indicate whether the active SpecOneD object will be modified or a new SpecOneD object will be created and returned.

Returns:

SpecOneD

normalize_fluxden_by_factor(factor, inplace=False)

Normalize the flux density, flux density error and object model numerical values by the specified numerical factor.

The flux density unit will be scaled accordingly. Hence, this normalization does not affect the physical values of the flux density and only serves to normalize the values in the flux density array.

This enables more efficient calculations on the flux density array by avoiding small numerical values.

Parameters:
  • factor (float) – Scale factor by which the flux density, flux density error and object model will be divided and the flux density unit will be multiplied with.

  • inplace (bool) – Boolean to indicate whether the active SpecOneD object will be modified or a new SpecOneD object will be created and returned.

Returns:

SpecOneD

normalize_fluxden_to_factor(factor, inplace=False)

Normalize the flux density, flux density error and object model numerical values to the specified unit factor.

The flux density unit will be scaled accordingly. Hence, this normalization does not affect the physical values of the flux density and only serves to normalize the values in the flux density array.

For example normalizing the flux density to a factor 1e-17 will assure that the flux density unit is 1e-17 times the original unit of the flux density.

This enables more efficient calculations on the flux density array by avoiding small numerical values.

Parameters:
  • factor (float) – Scale factor by which the flux density, flux density error and object model will be divided and the flux density unit will be multiplied with.

  • inplace (bool) – Boolean to indicate whether the active SpecOneD object will be modified or a new SpecOneD object will be created and returned.

Returns:

SpecOneD

peak_dispersion()

Return the dispersion of the maximum flux density value in the spectrum.

Returns:

Dispersion value of maximum flux density

Return type:

float

peak_fluxden()

Return the maximum flux density value in the spectrum.

Returns:

Maximum flux density value

Return type:

float

plot(show_fluxden_err=True, mask_values=True, ymin=None, ymax=None, show_obj_model=True, show_telluric=True)

Plot the spectrum.

This plot is aimed for a quick visualization of the spectrum not for publication grade figures.

Parameters:
  • show_fluxden_err (bool) – Boolean to indicate whether the error will be plotted or not (default:True).

  • mask_values (bool) – Boolean to indicate whether the mask will be applied when plotting the spectrum (default:True).

  • ymin (float) – Minimum value for the y-axis of the plot (flux density axis). This defaults to ‘None’. If either ymin or ymax are ‘None’ the y-axis range will be determined automatically.

  • ymax (float) – Maximum value for the y-axis of the plot (flux density axis). This defaults to ‘None’. If either ymin or ymax are ‘None’ the y-axis range will be determined automatically.

  • show_obj_model (bool) – Boolean to indicate whether the object model will be plotted or not (default:True).

  • show_telluric (bool) – Boolean to indicate whether the atmospheric model will be plotted or not (default:True).

Returns:

read_from_fits(filename)

Read in an iraf fits spectrum as a SpecOneD object.

Parameters:

filename (str) – Filename of the fits file.

Returns:

Raises:

ValueError – Raises an error when the filename could not be read in.

read_from_hdf(filename)

Read in a SpecOneD object from a hdf5 file.

Parameters:

filename (str) – Filename from which to read the new SpecOneD object in.

Returns:

read_pypeit_fits(filename, exten=1)

Read in a pypeit fits spectrum as a SpecOneD object.

Parameters:
  • filename (string) – Filename of the fits file.

  • exten (int) – Extension of the pypeit fits file to read. This defaults to exten=1.

Returns:

Raises:

ValueError – Raises an error when the filename could not be read in.

read_sdss_fits(filename)

Read in an SDSS/BOSS fits spectrum as a SpecOneD object.

Parameters:

filename (str) – Filename of the fits file.

Returns:

Raises:

ValueError – Raises an error when the filename could not be read in.

remove_extinction(a_v, r_v, extinction_law='ccm89', inplace=False)

Remove extinction from spectrum (flux density ONLY).

This function makes use of the python extinction package: https://github.com/kbarbary/extinction .

Their documentation is available at https://extinction.readthedocs.io/en/latest/ .

Please have a careful look at their implementation and regarding details on the use of a_v and r_v. Possible extinction laws to use are “ccm89”, “odonnell94”, “calzetti00”, “fitzpatrick99”, “fm07”.

Parameters:
  • a_v (float) – Extinction value ein the V band.

  • r_v (float) – Ratio of total to selective extinction r_v = a_v/E(B-V)

  • extinction_law (str) – Extinction law name as implemented in the extinction package, see documentation.

  • inplace (bool) – Boolean to indicate whether the active SpecOneD object will be modified or a new SpecOneD object will be created and returned.

Returns:

Returns the binned spectrum as a SpecOneD object if inplace==False.

Return type:

SpecOneD

renormalize_by_ab_magnitude(magnitude, passband, match_method='interpolate', force=False, output_mode='spectrum', inplace=False)

Scale the spectrum flux density and 1-sigma errors to the specified magnitude in the provided passband.

Parameters:
  • magnitude (float) – Magnitude to scale the spectrum to.

  • passband (PassBand) – The astronomical passband with throughput in quantum efficiencies.

  • match_method (str) – Method for matching the dispersion axis of the spectrum to the passband.

  • force – Boolean to indicate if they spectra will be forced to match if the spectrum does not fully cover the passband. The forced match will result in an inner match of the spectrum’s and the passband’s dispersion axes. User discretion is advised. :type force: bool

  • output_mode (str) – Output mode of the function. The default mode “Spectrum” returns the rescaled spectrum as a SpecOneD object or if inplace=True updates the provided spectrum. The alternative output mode “flux_factor” returns the factor to scale the flux with as a float.

  • inplace (bool) – Boolean to indicate whether the active SpecOneD object will be modified or a new SpecOneD object will be created and returned.

Returns:

Normalized spectrum or flux density normalization factor

renormalize_by_spectrum(spectrum, dispersion_limits=None, output_mode='spectrum', inplace=False)

Scale the spectrum flux density and 1-sigma errors to match the provided spectrum in the full overlap region or in a specified dispersion range.

The original SpecOneD spectrum and the normalization spectrum should be in the same units. If this is not the case, the normalization spectrum will be converted to the same units as the original SpecOneD spectrum.

The dispersion limits are unitless (list of two floats) but need to be in the same units as the SpecOneD dispersion axis (dispersion_unit).

Parameters:
  • spectrum (SpecOneD) – The provided spectrum to scale the SpecOneD spectrum to.

  • dispersion_limits ((float, float)) – A list of two floats indicating the lower and upper dispersion limits between which the spectra are normalized.

  • output_mode (str) – Output mode of the function. The default mode “Spectrum” returns the rescaled spectrum as a SpecOneD object or if inplace=True updates the provided spectrum. The alternative output mode “flux_factor” returns the factor to scale the flux with as a float.

  • inplace (bool) – Boolean to indicate whether the active SpecOneD object will be modified or a new SpecOneD object will be created and returned.

Returns:

resample(new_dispersion, force=False, inplace=False)

Function for resampling spectra (and optionally associated uncertainties) onto a new wavelength basis.

This code is making use of SpectRes https://github.com/ACCarnall/SpectRes by Adam Carnall - damc@roe.ac.uk

The mask will be automatically reset.

If obj_model and telluric exist for the spectrum these will be linearly interpolated onto the new dispersion axis and NOT resampled.

Parameters:
  • new_dispersion (numpy.ndarray) – Array containing the new wavelength sampling desired for the spectrum or spectra.

  • force (bool) – Boolean to force the resampling of the spectrum by reducing the new dispersion axis range to the old dispersion axis range.

  • inplace (bool) – Boolean to indicate whether the active SpecOneD object will be modified or a new SpecOneD object will be created and returned.

Returns:

Returns the resampled spectrum as a SpecOneD object if inplace==False.

Return type:

SpecOneD

resample_to_resolution(resolution, buffer=2, inplace=False)

Resample spectrum at a specific resolution specified in km/s.

This should work for all spectra with flux densities per unit wavelength/frequency.

Parameters:
  • resolution (float) – Specified resolution in km/s

  • buffer (int) – Integer value indicating how many pixels at the beginning and the end of the current spectrum will be omitted in the resampling process.

  • inplace (bool) – Boolean to indicate whether the active SpecOneD object will be modified or a new SpecOneD object will be created and returned.

Returns:

Returns the resampled spectrum as a SpecOneD object if inplace==False.

Return type:

SpecOneD

reset_mask()

Reset the spectrum mask.

Returns:

save_to_csv(filename, outputformat='linetools')

Save SpecOneD object to a csv file.

Output formats: - default: All array-like SpecOneD data will be saved to the csv file. Standard columns include dispersion, flux density, and flux density error. Additional columns can be telluric or object model from spectra reduced with pypeit. - “linetools”: In the linetool format dispersion, flux density and flux density error (if exists) are saved in three columns with names ‘wave’, ‘flux’, and ‘error’.

WARNING: At present the SpecOneD data will be saved independent of its physical units. They will not be automatically converted to a common format. User discretion is advised as unit information might get lost if saving to csv.

Parameters:
  • filename (str) – Filename to save the SpecOneD object to.

  • outputformat (str) – Format of the csv file. Possible formats include “linetools”. All other inputs will save it to the default format.

Returns:

save_to_hdf(filename)

Save a SpecOneD object to a hdf5 file.

SpecOneD hdf5 files have three extensions: - data: holding the array spectral information like dispersion, flux density, flux density error, flux density inverse variance, or mask - spec_meta: holding information on the spectral meta data, currently this includes the units of the dispersion and flux density axis. - header: If a header exists, it will be saved here.

Parameters:

filename (str) – Filename to save the current SpecOneD object to.

Returns:

smooth(width, kernel='boxcar', scale_sigma=True, inplace=False)

Smoothing the flux density of the spectrum using a boxcar oder gaussian kernel.

This function uses astropy.convolution to convolve the spectrum with the selected kernel.

If scale_sigma=True, the fluxden error is scaled down according to sqrt(width).

Parameters:
  • width – Width (in pixels) of the kernel)

  • kernel (str) – String indicating whether to use the Boxcar (“boxcar”) or Gaussian (“gaussian”) kernel.

  • scale_sigma (bool) – Boolean to indicate whether to scale the fluxden error according to the width of the boxcar kernel.

  • inplace (bool) – Boolean to indicate whether the active SpecOneD object will be modified or a new SpecOneD object will be created and returned.

Type:

width: int

Returns:

to_fluxden_per_unit_frequency_cgs()

Convert SpecOneD spectrum to flux density per unit frequency (Hz) in cgs units.

Returns:

to_fluxden_per_unit_frequency_jy()

Convert SpecOneD spectrum to flux density per unit frequency (Hz) in Jy.

Returns:

to_fluxden_per_unit_frequency_si()

Convert SpecOneD spectrum to flux density per unit frequency (Hz) in SI units.

Returns:

to_fluxden_per_unit_wavelength_cgs()

Convert SpecOneD spectrum to flux density per unit wavelength ( Angstroem) in cgs units.

Returns:

trim_dispersion(limits, mode='physical', inplace=False)

Trim the spectrum according to the dispersion limits specified.

Parameters:
  • limits ([float, float] or [int, int]) – A list of two floats indicating the lower and upper dispersion limit to trim the dispersion axis to.

  • mode (str) – A string specifying whether the limits are in ‘physical’ values of the dispersion axis (e.g. Angstroem) or in pixel values.

  • inplace (bool) – Boolean to indicate whether the active SpecOneD object will be modified or a new SpecOneD object will be created and returned.

Returns:

Spectrum trimmed to the specified limits

Return type:

SpecOneD

sculptor.speconed.gaussian(x, amp, cen, sigma, shift)

1-D Gaussian function