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:
SpectrumVane calibration spectrum.
- Parameters:
- vane
ndarray Vane power values. The values will define the
dataattribute of theVaneSpectrumobject.- 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 usingget_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). IfNoneand not at GBO,tcalwill equaltwarm(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). IfNoneand not at GBO,tcalwill equaltwarm(accurate to approximately 10%).- tbkgfloat or None
The background temperature in K. Default is the CMB temperature at 3 mm (2.725 K).
- vane
- Attributes:
array_axis_physical_typesReturns the WCS physical types that vary along each array axis.
baseline_modelReturns the computed baseline model or None if it has not yet been computed.
- bin_edges
combined_wcsThe WCS transform for the NDCube, including the coordinates specified in
.extra_coords.commentsGet the comment strings.
datandarray- like- dimensions
doppler_conventionString representation of the velocity (Doppler) convention
energyThe energy of the spectral axis as a
Quantityin units of eV.equivalenciesGet the spectral axis equivalencies that can be used in converting the axis
exclude_regionsThe baseline exclusion region(s) of this spectrum
extra_coordsCoordinates not described by
NDCubeABC.wcswhich vary along one or more axes.fdnumThe feed number.
fluxConverts the stored data and unit and mask into a
Quantityobject.frequencyThe
spectral_axisas aQuantityin units of GHzglobal_coordsCoordinate metadata which applies to the whole cube.
historyGet the history strings.
ifnumThe intermediate frequency (IF) number.
maskany type : Mask for the dataset, if any.
- meta
nchanThe number of channels in the Spectrum
observerReturns ——- observer :
BaseCoordinateFrameor derivative The coordinate frame of the observer if present.- obstime
photon_fluxThe flux density of photons as a
Quantity, in units ofplnumThe polarization number.
- plotter
psfImage representation of the PSF for the dataset.
quantityUnitful representation of the NDCube data.
radial_velocityThe radial velocity(s) of the objects represented by this spectrum.
redshiftThe redshift(s) of the objects represented by this spectrum.
rest_valueRest frequency used in velocity conversions.
scanThe scan number.
- shape
spectral_axisReturns the SpectralCoord object.
- spectral_axis_direction
- spectral_axis_index
spectral_wcsReturns the spectral axes of the WCS
subtractedHas a baseline model been subtracted?”
targetThe target object of this spectrum.
tscaleThe descriptive brightness unit of the data.
tscale_facThe factor by which the data have been scale from antenna temperature to corrected antenna temperature or flux density.
twarmVane temperature in K.
uncertaintyany type : Uncertainty in the dataset, if any.
unitUnit: Unit for the dataset, if any.velocityConverts the spectral axis array to the given velocity space unit given the rest value.
velocity_conventionReturns the velocity convention
velocity_frameString representation of the velocity frame
wavelengthThe
spectral_axisas aQuantityin units of Angstromswcsany type : A world coordinate system (WCS) for the dataset, if any.
weightsThe 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
Spectrumwith respect toother.average(spectra[, weights, align])Average this
Spectrumwithspectra.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
Spectrumby 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
Spectrumwithother.from_spectrum(spectrum, scan, fdnum, ifnum, ...)Returns a
VaneSpectrumobject given aSpectrumobject.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.targetin a new velocity frame.make_spectrum(data, meta[, use_wcs, ...])Factory method to create a
Spectrumobject from a data and header.merge_commentary(other)Merge the history and comments from another HistoricalBase instance.
meta_as_table()Return
Spectrum.metaas anTable.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_velocitywithout changing the values of thespectral_axis.set_redshift_to(redshift)This sets the redshift of the spectrum to be
redshiftwithout changing the values of thespectral_axis.shift(s[, remove_wrap, fill_value, method])Shift the
Spectrumbyschannels 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
unitintoframeusingdoppler_conventionif 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
Spectrumwith a new coordinate reference frame.with_spectral_axis_and_flux_units(...[, ...])Perform
with_spectral_axis_unit()andwith_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
Spectrumwith 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
VaneSpectrumobject given aSpectrumobject.- Parameters:
- spectrum
Spectrum Spectrum object. Its attributes will be copied into the
VaneSpectrumobject, except for thedataandfluxattributes which can be defined by thevaneparameter.- 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
fluxattribute ofspectrum. If set, the values will define thedataattribute of theVaneSpectrumobject.- tcalNone or float
The calibration temperature in K. If
None, it will be estimated usingget_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). IfNoneand not at GBO,tcalwill equaltwarm(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). IfNoneand not at GBO,tcalwill equaltwarm(accurate to approximately 10%).- tbkgfloat or None
The background temperature in K. Default is the CMB temperature at 3 mm (2.725 K).
- spectrum
- Returns:
VaneSpectrumA
VaneSpectrumobject.
- 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:
- ref
Spectrum Reference spectrum used to derive \(T_{\mathrm{cal}}\).
- mjdfloat or None
Modified Julian date. If None, will use DATE-OBS in
ref.meta.- freq
Quantityor None Frequency at which to compute the calibration temperature. If None, will use OBSFREQ in
ref.meta.- elev
Quantityor 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). IfNoneand not at GBO,tcalwill equaltwarm(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). IfNoneand not at GBO,tcalwill equaltwarm(accurate to approximately 10%).- tbkgfloat or None
The background temperature in K. Default is the CMB temperature at 3 mm (2.725 K).
- ref
- Returns:
- tcalfloat
Calibration temperature for the vane in K.
- get_tsys(ref, tcal=None)[source]#
Compute the system temperature.
- Parameters:
- ref
Spectrum The reference spectrum.
- tcalNone or float
The calibration temperature in K. If
None, it will be estimated usingget_tcal().
- ref
- 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.