VaneSpectrum

class dysh.spectra.vane.VaneSpectrum(vane, scan, fdnum, ifnum, plnum, tcal=None, twarm=None, zenith_opacity=None, tatm=None, tbkg=None, *args, **kwargs)[source]#

Bases: Spectrum

Vane calibration spectrum.

Parameters:
vanendarray

Vane power values. The values will define the data attribute of the VaneSpectrum object.

scanint

Scan number.

fdnumint

The feed number.

ifnumint

The intermediate frequency (IF) number.

plnumint

The polarization number.

tcalNone or float

The calibration temperature in K. If None, it will be estimated using get_tcal().

twarmNone or float

The vane temperature in K. If None, it will be inferred from the TWARM column.

zenith_opacityfloat or None

The zenith opacity in nepers. If None, it will be retrieved from the GBO weather forecast scripts (only available at GBO). If None and not at GBO, tcal will equal twarm (accurate to approximately 10%).

tatmfloat or None

The atmospheric temperature towards the zenith in K. If None, it will be retrieved from the GBO weather forecast scripts (only available at GBO). If None and not at GBO, tcal will equal twarm (accurate to approximately 10%).

tbkgfloat or None

The background temperature in K. Default is the CMB temperature at 3 mm (2.725 K).

Attributes:
array_axis_physical_types

Returns the WCS physical types that vary along each array axis.

baseline_model

Returns the computed baseline model or None if it has not yet been computed.

bin_edges
combined_wcs

The WCS transform for the NDCube, including the coordinates specified in .extra_coords.

comments

Get the comment strings.

data

ndarray - like

dimensions
doppler_convention

String representation of the velocity (Doppler) convention

energy

The energy of the spectral axis as a Quantity in units of eV.

equivalencies

Get the spectral axis equivalencies that can be used in converting the axis

exclude_regions

The baseline exclusion region(s) of this spectrum

extra_coords

Coordinates not described by NDCubeABC.wcs which vary along one or more axes.

fdnum

The feed number.

flux

Converts the stored data and unit and mask into a Quantity object.

frequency

The spectral_axis as a Quantity in units of GHz

global_coords

Coordinate metadata which applies to the whole cube.

history

Get the history strings.

ifnum

The intermediate frequency (IF) number.

mask

any type : Mask for the dataset, if any.

meta
nchan

The number of channels in the Spectrum

observer

Returns ——- observer : BaseCoordinateFrame or derivative The coordinate frame of the observer if present.

obstime
photon_flux

The flux density of photons as a Quantity, in units of

plnum

The polarization number.

plotter
psf

Image representation of the PSF for the dataset.

quantity

Unitful representation of the NDCube data.

radial_velocity

The radial velocity(s) of the objects represented by this spectrum.

redshift

The redshift(s) of the objects represented by this spectrum.

rest_value

Rest frequency used in velocity conversions.

scan

The scan number.

shape
spectral_axis

Returns the SpectralCoord object.

spectral_axis_direction
spectral_axis_index
spectral_wcs

Returns the spectral axes of the WCS

subtracted

Has a baseline model been subtracted?”

target

The target object of this spectrum.

tscale

The descriptive brightness unit of the data.

tscale_fac

The factor by which the data have been scale from antenna temperature to corrected antenna temperature or flux density.

twarm

Vane temperature in K.

uncertainty

any type : Uncertainty in the dataset, if any.

unit

Unit : Unit for the dataset, if any.

velocity

Converts the spectral axis array to the given velocity space unit given the rest value.

velocity_convention

Returns the velocity convention

velocity_frame

String representation of the velocity frame

wavelength

The spectral_axis as a Quantity in units of Angstroms

wcs

any type : A world coordinate system (WCS) for the dataset, if any.

weights

The channel weights of this spectrum

Methods

add(operand[, operand2])

Performs addition by evaluating self + operand.

add_comment(comment[, add_time])

Add one or more comments to the class metadata.

add_history(history[, add_time])

Add one or more history entries to the class metadata

align_to(other[, units, frame, remove_wrap, ...])

Align the Spectrum with respect to other.

average(spectra[, weights, align])

Average this Spectrum with spectra.

axis_velocity([unit])

Get the spectral axis in velocity units.

axis_world_coords(*axes[, pixel_corners, wcs])

Returns objects representing the world coordinates of pixel centers for a desired axes.

axis_world_coords_values(*axes[, ...])

Returns the world coordinate values of all pixels for desired axes.

baseline(degree[, exclude, include, color])

Compute and optionally remove a baseline.

bshow()

Show the baseline model

cog([vc, width_frac, bchan, echan, ...])

Curve of growth (CoG) analysis based on Yu et al. (2020) [Re28fcf3e3187-1].

collapse(method[, axis])

Collapse the flux array given a method.

crop(*points[, wcs, keepdims])

Crop using real world coordinates.

crop_by_values(*points[, units, wcs, keepdims])

Crop using real world coordinates.

decimate(n)

Decimate the Spectrum by n pixels.

divide(operand[, operand2])

Performs division by evaluating self / operand.

explode_along_axis(axis)

Separates slices of NDCubes along a given axis into an NDCubeSequence of (N-1)DCubes.

fake_spectrum([nchan, seed, normal, use_wcs])

Create a fake spectrum with gaussian noise, useful for simple testing.

find_shift(other[, units, frame])

Find the shift required to align this Spectrum with other.

from_spectrum(spectrum, scan, fdnum, ifnum, ...)

Returns a VaneSpectrum object given a Spectrum object.

get_selected_regions([unit])

Get selected regions from plot.

get_tcal(ref[, mjd, freq, elev, ...])

Calibration temperature.

get_tsys(ref[, tcal])

Compute the system temperature.

get_velocity_in_frame(toframe)

Compute the radial velocity of the Spectrum.target in a new velocity frame.

make_spectrum(data, meta[, use_wcs, ...])

Factory method to create a Spectrum object from a data and header.

merge_commentary(other)

Merge the history and comments from another HistoricalBase instance.

meta_as_table()

Return Spectrum.meta as an Table.

multiply(operand[, operand2])

Performs multiplication by evaluating self * operand.

new_flux_unit(unit[, equivalencies, ...])

normalness()

Compute the p-value if the noise in a spectrum is gaussian using the Anderson-Darling statistic The p-value gives the probability that the spectrum is gaussian.

plot(**kwargs)

Plot the spectrum.

query_lines([chemical_name, ...])

Query locally or remotely for lines and return a table object.

radiometer([roll])

Check the radiometer equation, and return the dimensionless ratio of the measured vs.

rebin(bin_shape[, operation, ...])

Downsample array by combining contiguous pixels into bins.

recomb(line[, cat])

Search for recombination lines of H, He, and C in the frequency range of this Spectrum.

recomball([cat])

Fetch all recombination lines of H, He, C in the frequency range of this Spectrum from the catalog.

reproject_to(target_wcs[, algorithm, ...])

Reprojects the instance to the coordinates described by another WCS object.

roll([rollmax])

Rolling data to check for channel correllations and channel-to-channel correllations.

savefig(file, **kwargs)

Save the plot

set_convention(doppler_convention)

Set the velocity convention of this Spectrum.

set_frame(toframe)

Set the sky coordinate and doppler tracking reference frame of this Spectrum.

set_radial_velocity_to(radial_velocity)

This sets the radial velocity of the spectrum to be radial_velocity without changing the values of the spectral_axis.

set_redshift_to(redshift)

This sets the redshift of the spectrum to be redshift without changing the values of the spectral_axis.

shift(s[, remove_wrap, fill_value, method])

Shift the Spectrum by s channels in place.

shift_spectrum_to(*[, redshift, radial_velocity])

This shifts in-place the values of the spectral_axis, given either a redshift or radial velocity.

smooth([method, width, decimate, meta, ...])

Smooth or Convolve the Spectrum, optionally decimating it.

snr([peak, flux, rms])

Signal-to-noise (S/N) ratio, measured either in channel or total flux mode.

squeeze([axis])

Removes all axes with a length of 1.

sratio([mean])

Signal ratio: (pSum+nSum)/(pSum-nSum) Here pSum and nSum are the sum of positive and negative values respectively in the spectrum.

stats([roll, qac])

Compute some statistics of this Spectrum.

subtract(operand[, operand2])

Performs subtraction by evaluating self - operand.

to(new_unit, **kwargs)

Convert instance to another unit.

undo_baseline()

Undo the most recently computed baseline.

velocity_axis_to([unit, toframe, ...])

Convert the spectral axis to unit in toframe using doppler_convention if converting from frequency/wavelength to velocity.

with_flux_unit(unit[, equivalencies, ...])

Returns a new spectrum with a different flux unit.

with_frame(toframe)

Return a copy of this Spectrum with a new coordinate reference frame.

with_spectral_axis_and_flux_units(...[, ...])

Perform with_spectral_axis_unit() and with_flux_unit() together.

with_spectral_axis_last()

Convenience method to return a new copy of the Spectrum with the spectral axis last.

with_spectral_axis_unit(unit[, ...])

Returns a new spectrum with a different spectral axis unit.

with_spectral_unit(unit[, ...])

with_velocity_convention(doppler_convention)

Returns a copy of this Spectrum with the input velocity convention.

list_to_spectral_region

max

mean

median

min

read

sum

write

property fdnum#

The feed number.

classmethod from_spectrum(spectrum, scan, fdnum, ifnum, plnum, vane=None, tcal=None, twarm=None, zenith_opacity=None, tatm=None, tbkg=None)[source]#

Returns a VaneSpectrum object given a Spectrum object.

Parameters:
spectrumSpectrum

Spectrum object. Its attributes will be copied into the VaneSpectrum object, except for the data and flux attributes which can be defined by the vane parameter.

scanint

Scan number.

fdnumint

The feed number.

ifnumint

The intermediate frequency (IF) number.

plnumint

The polarization number.

vaneNone or ndarray

Vane power values. If None, then it will use the flux attribute of spectrum. If set, the values will define the data attribute of the VaneSpectrum object.

tcalNone or float

The calibration temperature in K. If None, it will be estimated using get_tcal().

twarmNone or float

The vane temperature in K. If None, it will be inferred from the TWARM column.

zenith_opacityfloat or None

The zenith opacity in nepers. If None, it will be retrieved from the GBO weather forecast scripts (only available at GBO). If None and not at GBO, tcal will equal twarm (accurate to approximately 10%).

tatmfloat or None

The atmospheric temperature towards the zenith in K. If None, it will be retrieved from the GBO weather forecast scripts (only available at GBO). If None and not at GBO, tcal will equal twarm (accurate to approximately 10%).

tbkgfloat or None

The background temperature in K. Default is the CMB temperature at 3 mm (2.725 K).

Returns:
VaneSpectrum

A VaneSpectrum object.

get_tcal(ref, mjd: float | None = None, freq: Quantity | None = None, elev: Quantity | None = None, zenith_opacity: float | None = None, tatm: float | None = None, twarm: float | None = None, tbkg: float = 2.725)[source]#

Calibration temperature.

Parameters:
refSpectrum

Reference spectrum used to derive \(T_{\mathrm{cal}}\).

mjdfloat or None

Modified Julian date. If None, will use DATE-OBS in ref.meta.

freqQuantity or None

Frequency at which to compute the calibration temperature. If None, will use OBSFREQ in ref.meta.

elevQuantity or None

Elevation at which to evaluate the airmass. If None, will use ELEVATIO in ref.meta.

twarmNone or float

The vane temperature in K. If None, it will be inferred from the TWARM column.

zenith_opacityfloat or None

The zenith opacity in nepers. If None, it will be retrieved from the GBO weather forecast scripts (only available at GBO). If None and not at GBO, tcal will equal twarm (accurate to approximately 10%).

tatmfloat or None

The atmospheric temperature towards the zenith in K. If None, it will be retrieved from the GBO weather forecast scripts (only available at GBO). If None and not at GBO, tcal will equal twarm (accurate to approximately 10%).

tbkgfloat or None

The background temperature in K. Default is the CMB temperature at 3 mm (2.725 K).

Returns:
tcalfloat

Calibration temperature for the vane in K.

get_tsys(ref, tcal=None)[source]#

Compute the system temperature.

Parameters:
refSpectrum

The reference spectrum.

tcalNone or float

The calibration temperature in K. If None, it will be estimated using get_tcal().

Returns:
tsysfloat

The system temperature in K.

property ifnum#

The intermediate frequency (IF) number.

property plnum#

The polarization number.

property scan#

The scan number.

property twarm#

Vane temperature in K.