castor_etc.uvmos_spectroscopy

UVMOS Spectroscopy

castor_etc.uvmos_spectroscopy package simulates the effects of the currently proposed design for the UVMOS instrument.

.. caution:: The UVMOS design is currently undergoing active study so this code will likely undergo drastic changes frequently for the foreseeable future.

Module Contents

Classes

UVMOS_Spectroscopy

UVMOS_Spectroscopy class.

Functions

Gaussian

Gaussian2D

Data

UVMOS_DATAPATH

API

castor_etc.uvmos_spectroscopy.UVMOS_DATAPATH = 'join(...)'
castor_etc.uvmos_spectroscopy.Gaussian(x, x0, sigma, a)
castor_etc.uvmos_spectroscopy.Gaussian2D(x, y, sigma, a=1, x0=0, y0=0)
class castor_etc.uvmos_spectroscopy.UVMOS_Spectroscopy(TelescopeObj: castor_etc.telescope.Telescope, SourceList: list[castor_etc.sources.Source], BackgroundObj: castor_etc.background.Background, fieldRA, fieldDEC, **kwargs)

UVMOS_Spectroscopy class.

Initialization

Initializes the UVMOS_Spectroscopy class

params

TelescopeObj = The telescope object. Must be a TelescopeObj class object.

SourceList = A list of SourceObj. Must have the same length as thetaList, deltaRA, and deltaDEC.

BackgroundObj = The background object. Must be a BackgroundObj class object.

fieldRA = The field centre in degrees.

fieldDEC = The field centre in degrees.

kwargs (optional params)

thetaList = A list of angles that can range from 0 to 180 degrees. If thetaList==None, then all slits will have an orientation of 0 degrees.

deltaRA = The angular separation in RA from the fieldCentre. If deltaRA==None, then one source will be placed at the field centre.

deltaDEC = The angular separation in DEC from the fieldCentre. If deltaDEC==None, then one source will be placed at the field centre.

case = (int) The two different dmd orientations. Case 1 is for the DMD at a 45 degree tilt and case 2 is for the DMD at a 0 degree tilt.
See documentation for more details.

_check_source_separation()

Checks for sources that are less than 5 sigma apart.

_specify_DMD_FOV()

Creates an array the size of the DMD

returns

dmdMask = (array) array the dimensions of the DMD

self.dmdArea -> should get rid of this

_make_pixel_source_catalog()

Makes a catalog of sources with their ra and decs in pixel coordinates.

returns

sourceCatalog = (list of PixCoords) the source coordinates in pixels

_generate_slits()

Creates a list of slits (RectanglePixelRegions)

returns

slitCatalog = (list of RectanglePixelRegions) the slits

_check_slits()

Checks that no slits are off the detector and that no slits are overlapping.

Note: This works, but it is very slow.

show_slits()

Shows the position and orientation of the slits and sources on the detector.

show_individual_slits()

Plot the slit transmission visualization. This is the non-pixel based visualization, so the orientation of the list if not taken into account.

_calc_slit_transmission(print_transmission_fact=False)

Calculates the slit transmission percentage.

params

print_transmission_fact = (bool) if True, prints the transmission.

returns

transmission = (list of floats) the transmissions for each slit

calc_source_pix_weights()

Determines the source pixel weights

returns

pix_dist_list = (list of arrays) list of the slit arrays

show_source_pix_weights()

This plots the results of the calc_source_pix_weights() function.

show_slit_image(wavelength)

Shows the smeared out slit. This is accomplished by rotating the slit to be vertical, then smearing out the slit horizontally, then rotating the smeared out slit back to it’s original position.

params

wavelength = (float) wavelength in angstroms

returns

detector_list = (list of arrays) a list of the smeared out slits

center_pix_list = (list of int) a list of the center pixels of the smeared out slits

_extraction(detector, pix_waves, extraction_width, extraction_lowerlim, extraction_upperlim)

Extracts the wavelengths, flux, and number of pixels from the smeared slit.

params

detector = (array of floats)

pix_waves = ()

extraction_width = (int) width of the extraction box along the wavelength axis in pixels. By default this is 1.

extraction_lowerlim = (int) Lower limit of the extraction box along the spatial axis in pixels.

extraction_upperlim = (int) Upper limit of the extraction box along the spatial axis in pixels.

returns

extracted_waves = (array of floats) wavelengths

extracted_flux = (array of floats) the flux extracted from the slit

extracted_numpix = (int) number of pixels in slit

_getTransmission(x)

Unpacks spectrographTransmission_CASTOR.txt. Fits it with a cubic spline.

params

x = (array) an array of wavelengths

returns

the transmission values from the cubic spline

_getDispersion(x)

Unpacks dispersion_resolution2.dat and fits it with a cubic spline.

params

x = (array) array of wavelengths in angstroms

returns

the dispersion values from the cubic spline

showTransmission()

Plots the transmission as a function of wavelength

_calc_sigmaPix(dispersion)

Calculate the sigma value of a Gaussian fit to a pixel with a width in wavelength equal to the provided dispersion

params

dispersion = ()

returns

absolute value of cf_sigma = ()

_calc_sigmaPSF(dispersion)

Calculate the sigma value of the Gaussian PSF on the detector

params

dispersion = ()

returns

sigma_psf_wave = ()

_calcR(x, disp)

Calculate the resolving power

Parameters

x = array of wavelength values

disp = array of dispersion values corresponding to the wavelenghts in x

Returns

Array of resolving power values corresponding to x

showResolvingPower()
calc_source_CASTORSpectrum(extraction_width=1, extraction_lowerlim=1, extraction_upperlim='max')

Calculates the source spectrum. Done for non-vertical slits by rotating the slit to be vertical and then smearing out the slit horizontally.

params

extraction_width = (int) width of the extraction box along the wavelength axis in pixels. By default this is 1.

extraction_lowerlim = (int) Lower limit of the extraction box along the spatial axis in pixels.

extraction_upperlim = (int) Upper limit of the extraction box along the spatial axis in pixels.

calc_background_CASTORSpectrum(extraction_width=1, extraction_lowerlim=1, extraction_upperlim='max')

Calculates the background spectrum. Assumes an evenly illuminated background.

params

extraction_width = (int) width of the extraction box along the wavelength axis in pixels. By default this is 1.

extraction_lowerlim = (int) Lower limit of the extraction box along the spatial axis in pixels.

extraction_upperlim = (int) Upper limit of the extraction box along the spatial axis in pixels.

calc_snr_from_t(t, wave, nread=1)

Calculates the signal to noise ratio from the exposure time.

params

t = (float) time in seconds

wave = (float) wavelength in angstroms

Returns

snr_list = (list of floats) signal to noise ratio

calc_t_from_snr(snr, wave, nread=1)

Calculates the exposure time required to obtain a specified signal to noise ratio

params

snr = (float) signal to noise ratio

wave = (float) wavelength in angstroms

Returns

t_list = (list of floats) exposure time in seconds