UVITTools.jl
A package for AstroSat/UVIT grating spectroscopy and aperture photometry.
Package Features
- Extract flux calibrated UVIT FUV/NUV grating spectra.
- Generate source and background FUV/NUV grating spectral PHA data compatible with XSPEC/Sherpa.
- Perform aperture photometry of FUV/NUV sources in any of the broadband filters.
- Generate single channel PHA source and background spectral data for any of the FUV/NUV broadband filters.
- Saturation correction for point sources.
UVIT Grating Spectroscopy
The Indian multi-wavelength astronomy satellite carries four co-aligned instruments. One of them, the Ultra-Violet Imaging Telescope (UVIT; Tandon et al. (2017,2020)) is equipped with two gratings in the FUV channel and a single grating in the NUV channel in addition to a number of broadband filters. The slitless gratings are useful for low resolution far and near UV spectroscopy of a variety of cosmic sources such as hot stars, interacting binaries, active galactic nuclei, etc. The UVITTools.jl
package includes tools for the UVIT grating spectroscopy based on updated calibration following the method described in Dewangan (2021). The calibration files are included in this package in the caldata
directory and are directly used by the tools within the package.
The UVITTools.jl
package has been designed to use the processed UVIT data generated with the CCDLAB pipeline (Postma & Leahy 2017), hence the users first need to process the level-1 UVIT data with the CCDLAB. The UVITTools.jl
package provides functions for each of the steps in generating the calibrated spectra (i. e., $f_\lambda$ Vs $\lambda$) as well as single tools to generate the final calibrated spectra for different gratings and orders. The package also provides functions to generate source and background PHA spectral files and the associated instrument response file (response matrix + effective area) for each of the gratings. The grating PHA spectral data are treated in the same as the X-ray spectral data, and are useful for simultaneous UV/X-ray spectral modelling using XSPEC and SHERPA.
Extraction of 1d count spectra from 2d images
The CCDLAB pipeline has the option of generating images from the grating observations either in the detector coordinates left unrotated or rotated to align the dispersion axis with the X-axis. The 1d spectral extraction functions for the FUV gratings (fuv_grating1_count_spec
and fuv_grating2_count_spec
) include two parameters disp_aligned_to_xaxis
and angle_xaxis_disp_deg
($\theta$) that can be used to specify if the grating images are rotated and the angle between the X-axis and the dispersion direction towards the negative orders (for more details, please see the function documentation). The default values of the angles should work fine, otherwise users can measure the angle of the dispersion direction towards negative orders with respect to the X-axis and specify in the command line.
The 1d spectral extraction tools construct a linear relation $y = mx +c$ (with $m = \tan{\theta}$) that defines the spectral trace. The coordinates along the dispersion direction are defined relative to the zero order position provided by the user in the form of a SAOImage/DS9 region file. The 1d count spectrum is then extracted by integrating the counts along the spatial direction within a cross dispersion width provided by the user.
The following steps can be followed to generate 1d count spectrum of a source from a grating image generated with the CCDLAB pipeline.
Create region file for a source of interest using DS9 in the detector coordinates. Use a circular region centred at the zero order position, the size of the circle is immaterial.
To extract 1d count spectrum of NGC40 in the -2 order of FUV-Grating1 using a 40 pixel width along the spatial direction, issue the following command.
julia> (rel_pixels, count_rate) = fuv_grating1_count_spec("NGC40_FUV_Grating1_IMAGE.fits","src.reg", order=-2, cross_disp_width_pixels = 40, angle_xaxis_disp_deg=0.0, rate=true) ([-629, -628, -627, -626, -625, -624, -623, -622, -621, -620 … -422, -421, -420, -419, -418, -417, -416, -415, -414, -413], Measurements.Measurement{Float64}[0.0068 ± 0.0022, 0.0091 ± 0.0026, 0.0068 ± 0.0022, 0.0105 ± 0.0028, 0.009 ± 0.0026, 0.0083 ± 0.0025, 0.0105 ± 0.0028, 0.0105 ± 0.0028, 0.0067 ± 0.0022, 0.0075 ± 0.0024 … 0.006 ± 0.0021, 0.0067 ± 0.0022, 0.006 ± 0.0021, 0.0045 ± 0.0018, 0.006 ± 0.0021, 0.0067 ± 0.0022, 0.0037 ± 0.0017, 0.0075 ± 0.0023, 0.0074 ± 0.0023, 0.0075 ± 0.0023])
In addition to the screen output, a DS9 region file used for the grating order and the count spectrum are written to files
src_fuv_grating1_m2.reg
andsrc_fuv_grating1_m2_count_spec.dat
. The region files can be loaded in DS9 to cross-check the used grating order.Similarly, one can use the function
fuv_grating1_net_countrate_spec
to extract the background-corrected net count rate spectrum of a source by additionally using a DS9 region background file.julia> (rel_pixels, net_count_rate) = fuv_grating1_net_countrate_spec("NGC40_FUV_Grating1_IMAGE.fits","src.reg", "bgd.reg",order=-2, cross_disp_width_pixels = 40, angle_xaxis_disp_deg=0.0) ([-629, -628, -627, -626, -625, -624, -623, -622, -621, -620 … -422, -421, -420, -419, -418, -417, -416, -415, -414, -413], Measurements.Measurement{Float64}[0.0053 ± 0.0025, 0.0068 ± 0.0029, 0.0045 ± 0.0026, 0.006 ± 0.0033, 0.0075 ± 0.0028, 0.006 ± 0.0028, 0.0083 ± 0.0031, 0.0098 ± 0.0029, 0.003 ± 0.0028, 0.0045 ± 0.0028 … 0.003 ± 0.0026, 0.003 ± 0.0028, 0.0045 ± 0.0023, 0.003 ± 0.0021, 0.0045 ± 0.0023, 0.0022 ± 0.0029, -0.00073 ± 0.0025, 0.006 ± 0.0026, 0.0045 ± 0.0028, 0.0052 ± 0.0027])
Wavelength Calibration
The relative pixel coordinates along the dispersion direction are converted using linear dispersion relations $\lambda = c_0 + c_1 \times pixel$, where the coefficients $c_0$ and $c_1$ are derived from wavelength calibration based on observations of the planetary nebula NGC40. The UVITToools.jl functions fuv_grating1_pixel2lamA
, fuv_grating1_wavelength_calib
for FUV-Grating1 and similar functions for other gratings use updated wavelength calibrations compared to those provided in Dewangan (2021).
One can convert the relative pixel coordinates to wavelength using the command
julia> fuv_grating1_pixel2lamA(-500, order=-2)
1440.3065041673246
julia> fuv_grating1_pixel2lamA(-250, order=-1)
1440.2665
and perform wavelength calibration of a count spectrum as follows.
julia> (rel_pixels, net_count_rate) = fuv_grating1_net_countrate_spec("NGC40_FUV_Grating1_IMAGE.fits","src.reg", "bgd.reg",order=-2, cross_disp_width_pixels = 40, angle_xaxis_disp_deg=0.0)
([-629, -628, -627, -626, -625, -624, -623, -622, -621, -620 … -422, -421, -420, -419, -418, -417, -416, -415, -414, -413], Measurements.Measurement{Float64}[0.0053 ± 0.0025, 0.0068 ± 0.0029, 0.0045 ± 0.0026, 0.006 ± 0.0033, 0.0075 ± 0.0028, 0.006 ± 0.0028, 0.0083 ± 0.0031, 0.0098 ± 0.0029, 0.003 ± 0.0028, 0.0045 ± 0.0028 … 0.003 ± 0.0026, 0.003 ± 0.0028, 0.0045 ± 0.0023, 0.003 ± 0.0021, 0.0045 ± 0.0023, 0.0022 ± 0.0029, -0.00073 ± 0.0025, 0.006 ± 0.0026, 0.0045 ± 0.0028, 0.0052 ± 0.0027])
Flux calibration
The count rates at each wavelength are converted to flux using the effective area derived from the grating observations of spectrophotometric standards. The effective area files for three grating and calibrated orders are provided in the caldata
directory, these files are used by the flux calibration functions fuv_grating1_flux_calib
, fuv_grating2_flux_calib
and nuv_grating1_m1_flux_calib
(see the function documentation for more details). These functions assume that the extraction width along the spatial direction include all the source flux as the aperture correction is not built-in.
Flux calibration of a wavelength-calibrated count rate spectrum for a -2 order FUV-Grating1 can be performed as follows.
julia> (λ, f_λ)=fuv_grating1_flux_calib(λ, net_count_rate, order=-2)
([1800.1595912456048, 1797.3700324310446, 1794.5804736164841, 1791.790914801924, 1789.0013559873637, 1786.2117971728032, 1783.422238358243, 1780.6326795436828, 1777.8431207291223, 1775.0535619145621 … 1222.7209166316204, 1219.9313578170602, 1217.1417990024997, 1214.3522401879395, 1211.5626813733793, 1208.7731225588188, 1205.9835637442586, 1203.1940049296982, 1200.404446115138, 1197.6148873005777], Measurements.Measurement{Float64}[6.5e-14 ± 3.0e-14, 8.3e-14 ± 3.5e-14, 5.5e-14 ± 3.1e-14, 7.1e-14 ± 4.0e-14, 8.8e-14 ± 3.3e-14, 6.9e-14 ± 3.2e-14, 9.2e-14 ± 3.4e-14, 1.06e-13 ± 3.1e-14, 3.1e-14 ± 2.9e-14, 4.6e-14 ± 2.8e-14 … 5.4e-14 ± 4.6e-14, 6.3e-14 ± 5.9e-14, 1.11e-13 ± 5.8e-14, 8.7e-14 ± 6.1e-14, 1.49e-13 ± 7.8e-14, 8.3e-14 ± 1.1e-13, -2.9e-14 ± 9.6e-14, 2.3e-13 ± 9.9e-14, 1.59e-13 ± 9.9e-14, 1.64e-13 ± 8.4e-14])
Generating wavelength and flux calibrated spectra in one step
The UVITTools.jl
package provides functions for direct generation of background-corrected, wavelength and flux calibrated spectra in one shot without going through the individual steps. Users can use the functions fuv_grating1_fluxed_spec
, fuv_grating2_fluxed_spec
, and nuv_grating_m1_fluxed_spec
for this purpose (see function documentation for more details). For example, to extract background-correced, wavelength and flux-calibrated spectrum in the -2 order of FUV-Grating1, one can use the following command.
julia> (lam, flam, err_flam) = fuv_grating1_fluxed_spec("ngc40", "NGC40_FUV_Grating1_IMAGE.fits","src.reg","bgd.reg", order=-2, cross_disp_width_pixels = 40, angle_xaxis_disp_deg=0.0)
-----------------------------------
target=ngc40
UVIT channel=FUV
Grating=Grating1
OBS_ID=C07_015T01_9000005256
order=-2
Exposure time=1353.258 seconds
---------------------------------------
Wrote spectral ascii file: ngc40_C07_015T01_9000005256_FUV_Grating1m2_crossdisp40pix_xax_disp_0.0deg_spec.dat
Similar functions for FUV-Grating2 and NUV-Grating are also available.
XSPEC/Sherpa-compatible PHA spectral data
Working with data from different instruments onboard AstroSat require tools and techniques to facilitate joint analysis of multi-wavelength data. In particular, the broadband spectral coverage of AstroSat, from near UV to hard X-rays, requires tools for simultaneous fitting of spectral models to the multi-wavelength data. For this purpose, UVITTools.jl
package provides functions to generate grating PHA spectral data for the source and background; it also includes the associated response files in the caldata
directory. The functions available for the extraction of PHA spectral data are fuv_grating1_phafile
, fuv_grating2_phafile
and nuv_grating_phafile
. These functions will automatically use the appropriate response files from the caldata directory. See the function documentation for more details. To generate PHA spectral dataset (source and background spectral data, and response file) for a source from -2 order of FUV-Grating1 image, run the following command. The background and response files are automatically written in the header of the spurce spectral file.
julia> fuv_grating1_phafile("ngc40", "NGC40_FUV_Grating1_IMAGE.fits","src.reg","bgd.reg", order=-2, cross_disp_width_pixels = 40, angle_xaxis_disp_deg=0.0)
-----------------------------------
target=ngc40
UVIT channel=FUV
Grating=Grating1
OBS_ID=C07_015T01_9000005256
order=-2
Exposure time=1353.258 seconds
---------------------------------------
Writing source and background PHA files..
Using respfile/home/gulabd/work/julia_dev/UVITTools/caldata/fuv_grating1_m2_12nov22.rmf
Using /home/gulabd/work/julia_dev/UVITTools/caldata/fuv_grating1_m2_12nov22.rmf
("ngc40_C07_015T01_9000005256_FUV_Grating1_m2_crossdisp40pix_xax_disp_0.0deg_src.pha", "ngc40_C07_015T01_9000005256_FUV_Grating1_m2_crossdisp40pix_xax_disp_0.0deg_bgd.pha")
Redistribution matrix and ancillary response files
The UVITTools.jl
package includes updated response files generated using the method described in Dewangan (2021). The response files are available in the caldata directory. Users are not required to download these files as the PHA spectral functions will automatically download the relevant response file. Users can utilise the response files to simulate grating spectal data in the usual way with XSPEC or SHERPA.
UVIT Aperture Photometry
The UVIT is primarily a high resolution imaging instrument in a number of broadband filters (see https://uvit.iiap.res.in/Instrument/Filters). The photometric calibration of all the broadband filters are performed in Tandon et al. (2017, 2020). The UVITTools.jl
provides functions for aperture photometry (see uvit_aphot
) using simple apertures such as circular, elliptical, annular regions. The aperture photometry task output count rate, flux and magnitude based on the photometric calibration. Currently, uvit_aphot
does not account for aperture correction, hence users will need to use large enough extraction region (a circular region with radius at least 25 pixels) to include almost all counts from point sources.
To perform aperture photometry including saturation correction (see below) of a source in FUV/BaF2 image, one can run the following command.
julia> uvit_aphot("NGC4593_FUV_BaF2___MASTER.fits","src.reg","bgd.reg",satu_corr=true)
---------count rates, flux and magnitude------------
Detector: FUV
Filter: BaF2
Exposure time: 17129.3 seconds
source+background rate = 4.2 ± 0.016 counts/s
background rate = 0.051 ± 0.0 counts/s
net source count rate = 4.149 ± 0.016 counts/s
Saturation corrected net source count rate= 4.452 ± 0.016 counts/s
Saturation corrected f_λ [BaF2]= 1.591e-14 ± 1.6e-16 ergs/cm2/s/A
Saturation corrected magnitude[BaF2] (AB system) = 16.15 ± 0.011
------------------------------------------------------
Mean BJD: 2.457588076583e6
------------------------------------------------------
(2.457588076583e6, 4.451869565968372, 0.016218003910273074)
Saturation correction
The FUV/NUV channels operate in the photon counting mode. If multiple photon events fall within $3\times 3$ pixels in a frame, then these photon events can not be detected individually but recorded as arising due to a single photon. Such saturation of photon events cannot be avoided unless the photon rate per frame is much less than 1. Tandon et al. (2017,2020) have devised an algorithm to correct for the saturation. This algorithm is implemented in the UVITTools.jl
function uvit_saturation_corr
, which is called by the aperture photometry task uvit_aphot
if the option for saturation correction is provided. The algorithm for the saturation correction is applicable to point sources only, and users need to use a circular extraction region of radius about 12 arcsec (see Tandon et al. 2020 for details).
XSPEC/Sherpa compatible single channel spectral data and responses
The UVITTools.jl
package also includes function to extract single channel PHA spectral data from FUV/NUV images in any of the broadband filters. This function also uses appropriate response files available in the caldata directory, the users do not need to select or separately download the response files. These response files can also be used to simulate count rate in any of the filters using XSPEC or SHERPA. All the filter response files were created from the updated calibration provided in Tandon et al. (2020). The single channel spectra can be used along with X-ray spectral data for broadband spectral fitting in XSPEC or SHERPA.
Single channel source and background count spectra (and the corresponding response) can be generated as follows.
julia> uvit_filter2pha("ngc4593","NGC4593_FUV_BaF2___MASTER.fits","src.reg","bgd.reg")
---------count rates------------
Detector: FUV
Filter: F2
Exposure time: 17129.3 seconds
source+background rate = 4.2+/-0.0157 counts/s
background rate = 0.051+/-0.0004 counts/s
net source count rate = 4.149+/-0.0157 counts/s
Saturation corrected net source count rate= 4.452 ± 0.016 counts/s
--------------------------------
---Writing PHA file-----
Dict{String, Vector}("GROUPING" => Int16[1], "COUNTS" => [77132.30772409608], "CHANNEL" => Int32[1], "QUALITY" => Int16[0])
Dict{String, Vector}("GROUPING" => Int16[1], "COUNTS" => [874.8137822323066], "CHANNEL" => Int32[1], "QUALITY" => Int16[0])
("ngc4593_G05_219T01_9000000_FUV_F2_spec_src.pha", "ngc4593_G05_219T01_9000000_FUV_F2_spec_bgd.pha")
Function Documentation
FUV-Grating1
UVITTools.fuv_grating1_count_spec
— Functionfuv_grating1_count_spec(fuv_grating1_image_file, ds9regfile[, order = -1, angle_xaxis_disp_deg=0.0, cross_disp_width_pixels = 40, rate = true])
Extract count rate spectrum from AstroSat/UVIT FUV-Grating1 dispersed image generated from CCDLAB processing pipeline.
...
Arguments
Required parameters
fuv_grating1_image_file::String
: Name of the FUV-Grating1 image file in FITS format generated using CCDLAB.ds9regfile::String
: Name of the ds9 region file with center as the zero order position.
Optional parameters
order::Int
: -2 (default), Grating order to be used to extract the spectrum. Allowed orders=-1 and -2.angle_xaxis_disp_deg
: 0.0 (default), angle between dispersion axis and x-axis.cross_disp_width_pixels::String
: 40 (default), width in pixels in the cross-dispersion direction.rate::Bool
: true (default) for count rate spectrum, otherwise false for count spectrum.
Output
- count spectrum file
- region file compatible with ds9 that can be used to verify the extraction region for requested order.
- Count spectrum as (pixel numbers relative to zero order, counts/s or counts, errors)
...
UVITTools.fuv_grating1_net_countrate_spec
— Functionfuv_grating1_net_countrate_spec(fuv_grating1_image_file::String, ds9srcregfile::String, ds9bgdregfile::String; order::Int = -2, angle_xaxis_disp_deg::Float64=0.0, cross_disp_width_pixels::Int = 40)
fuv_grating1_net_countrate_spec(fuv_grating1_image_file, ds9srcregfile, ds9bgdregfile[, order = -2, angle_xaxis_disp_deg=0.0, cross_disp_width_pixels = 40])
Extract background corrected, net count rate spectrum from AstroSat/UVIT FUV-Grating1 dispersed image generated from CCDLAB processing pipeline.
...
Arguments
Required parameters
fuv_grating1_image_file::String
: Name of the FUV-Grating1 image file in FITS format generated using CCDLAB.ds9srcregfile::String
: Name of the ds9 region file with source center as the zero order position.ds9bgdregfile::String
: Name of the ds9 region file with center in a source-free region of the image.
Optional parameters
order::Int
: -2 (default), Grating order to be used to extract the spectrum. Allowed orders=-1 and -2.angle_xaxis_disp_deg
: 0.0 (default), angle between dispersion axis and x-axis.cross_disp_width_pixels::Int
: 40 (default), width in pixels in the cross-dispersion direction.
Output
- DS9 Region files used for extraction source and background count spectra.
- Source and background count spectra in ascii files.
...
UVITTools.fuv_grating1_pixel2lamA
— Functionfuv_grating1_pixel2lamA(pixel_num_wrt_zero_order[, order = -2])
Convert pixel number relative to zero to wavelength in Angstrom.
This function is used for wavelength calibration of FUV-Grating1 count spectrum.
Required parameters
pixel_num_wrt_zero_order::Int
: Pixel numbers relative to zero order.
Optional parameters
order::Int
: -2 (default), Grating order. Allowed orders=-1 and -2.
...
UVITTools.fuv_grating1_wavelength_calib
— Functionfuv_grating1_wavelength_calib(pixels, netsrc_spec_counts_per_s[, order = -2])
Convert pixel numbers relative to zero order to wavelengths.
This function is used for wavelength calibration of FUV-Grating1 count spectrum.
...
Arguments
Required parameters
pixels::Array
: An array of pixel numbers relative to zero order.netsrc_spec_counts_per_s::Array
: An array of net count rates corresponding to the relative pixel numbers.
Optional parameters
order::Int
: -2 (default), Grating order. Allowed orders=-1 and -2.
...
UVITTools.fuv_grating1_flux_calib
— Functionfuv_grating1_flux_calib(lamA, netsrc_spec_counts_per_s_A[,order=-2])
Flux calibrate the wavelength-calibrated count spectrum from FUV-Grating1.
This function calculates the effective area at each wavelength of the count spectrum, then uses the effective areas to convert net count rates to f_λ in CGS units.
...
Arguments
Required
-lamA::Array{Float64}
: Array of wavelengths in Å. -netsrc_spec_counts_per_s_A::Array{Float64}
: Array of background corrected counts/s/Å corresponding to wavelength array.
Optional
-Order::Number
: Grating order -2 (default) or -1.
...
UVITTools.fuv_grating1_fluxed_spec
— Functionfuv_grating1_fluxed_spec(target,fuv_grating1_image_file, ds9srcregfile, ds9bgdregfile[, order = -2, angle_xaxis_disp_deg=0.0, cross_disp_width_pixels = 40])
Extract flux calibrated spectrum from AstroSat/UVIT FUV-Grating1 dispersed image generated from CCDLAB processing pipeline.
This is a main function that uses other functions for extraction of source and background spectra, wavelenth and flux calibrations, and outputs fluxed spectrum. For details on grating orders, wavelength and flux calibrations, see Dewangan (2021). ...
Arguments
Required parameters
target::String
: Name of the target available in the observed UVIT field.fuv_grating1_image_file::String
: Name of the FUV-Grating1 image file in FITS format generated using CCDLAB.ds9srcregfile::String
: Name of the ds9 region file with source center as the zero order position.ds9bgdregfile::String
: Name of the ds9 region file with center in a source-free region of the image.
Optional parameters
order::Int
: -2 (default), Grating order to be used to extract the spectrum. Allowed orders=-1 and -2.angle_xaxis_disp_deg::Float64
: 0.0 (default), angle between dispersion axis and x-axis.cross_disp_width_pixels::String
: 40 (default), width in pixels in the cross-dispersion direction.
Output
(λ, f_λ, err_f_λ)
- Fluxed spectrum saved in an ascii file.
- DS9 source and background region files used for spectral extraction.
- Source and background count spectral data in ascii files
- Net source count spectrum in ascii file
...
UVITTools.fuv_grating1_phafile
— Functionfuv_grating1_phafile(target,fuv_grating1_image_file, ds9srcregfile, ds9bgdregfile[,order = -2, angle_xaxis_disp_deg=0.0, cross_disp_width_pixels= 40])
Extract XSPEC/Sherpa compatible source and background PHA spectral files from AstroSat/UVIT FUV-Grating1 dispersed image generated from CCDLAB processing pipeline.
This function extracts source and background count spectra using the zero order positions provided in the DS9 region files and converts them into PHA spectral files. For details on grating orders and spectral responses, see Dewangan (2021).
...
Arguments
Required parameters
target::String
: Name of the target available in the observed UVIT field.fuv_grating1_image_file::String
: Name of the FUV-Grating1 image file in FITS format generated using CCDLAB.ds9srcregfile::String
: Name of the ds9 region file with source center as the zero order position.ds9bgdregfile::String
: Name of the ds9 region file with center in a source-free region of the image.
Optional parameters
order::Int
: -2 (default), Grating order to be used to extract the spectrum. Allowed orders=-1 and -2.angle_xaxis_disp_deg::Float64
: 0.0 (default), angle between dispersion axis and x-axis.cross_disp_width_pixels::Int
: 40 (default), width in pixels in the cross-dispersion direction.
#read necessary keywords`
Output
- Source and background PHA files with RESPFILE key updated in the source spectral file
- Source and background DS9 region files used extract count spectra
- Source and Background count spectra in ascii files
- Net source count spectrum in ascii file
- Some relevant information are also printed on the screen.
...
UVITTools.fuv_grating1_ea
— Functionfuv_grating1_ea(lamA[,order = -2])
Calculate effective area in cm^2 at a desired wavelength (Angstrom) and grating order -1 or -2.
The calculation of the effective area is based on the updated grating calibration using the procedures described in Dewangan (2021). This function is used for flux calibration of count spectrum.
...
Arguments
Required
lam::Number
: Wavelength in Angstrom.
Optional
-order::Int
: Grating order -1 or -2. ...
Example
julia> fuv_grating1_ea(1450.4,order=-2)
4.071442845470301
FUV-Grating2
UVITTools.fuv_grating2_count_spec
— Functionfuv_grating2_count_spec(fuv_grating2_image_file, ds9regfile[, order = -2, disp_aligned_to_xaxis = false, angle_xaxis_disp_deg = 267.479, cross_disp_width_pixels = 40, rate = true])
Extract count rate spectrum from AstroSat/UVIT FUV-Grating2 dispersed image generated from CCDLAB processing pipeline.
...
Arguments
Required parameters
fuv_grating2_image_file::String
: Name of the FUV-Grating2 image file in FITS format generated using CCDLAB.ds9regfile::String
: Name of the ds9 region file with center as the zero order position.
Optional parameters
order::Int
: -2 (default), Grating order to be used to extract the spectrum. Allowed orders=-1 and -2.disp_aligned_to_xaxis
: false (default), true if the dispersion axis is rotated to align to x-axis in the detector coordinates, false if dispersion axis left unrotated.angle_xaxis_disp_deg
: 267.479 (default), the angle in degrees between dispersion direction (from zero to minus orders) and the x-axis.
If the dispersion axis is left unrotated in the detector coordiantes, the default value should be appropriate.
If the dispersion axis is rotated to align to x-axis, the angle should be set to 180 or zero degrees.
cross_disp_width_pixels::Int
: 40 (default), width in pixels in the cross-dispersion direction.rate::Bool
: true (default) for count rate spectrum, otherwise false for count spectrum.
Output
- count spectrum file
- region file compatible with ds9 that can be used to verify the extraction region.
- Count spectrum as (pixel numbers relative to zero order, counts/s or counts, errors)
...
UVITTools.fuv_grating2_net_countrate_spec
— Functionfuv_grating2_net_countrate_spec(fuv_grating2_image_file, ds9srcregfile, ds9bgdregfile[, order = -2, disp_aligned_to_xaxis=false, angle_xaxis_disp_deg=267.479, cross_disp_width_pixels = 40])
Extract background corrected, net count rate spectrum from AstroSat/UVIT FUV-Grating2 dispersed image generated from CCDLAB processing pipeline.
...
Arguments
Required parameters
fuv_grating2_image_file::String
: Name of the FUV-Grating2 image file in FITS format generated using CCDLAB.ds9srcregfile::String
: Name of the ds9 region file with source center as the zero order position.ds9bgdregfile::String
: Name of the ds9 region file with center in a source-free region of the image.
Optional parameters
order::Int
: -2 (default), Grating order to be used to extract the spectrum. Allowed orders=-1 and -2.disp_aligned_to_xaxis
: false (default), true if the dispersion axis is rotated to align to x-axis in the detector coordinates, false if dispersion axis left unrotated.angle_xaxis_disp_deg
: 267.479 (default), the angle in degrees between dispersion direction (from zero to minus orders) and the x-axis.
If the dispersion axis is left unrotated in the detector coordiantes, the default value should be appropriate.
If the dispersion axis is rotated to align to x-axis, the angle should be set to 180 or zero degrees.
cross_disp_width_pixels::Int
: 40 (default), width in pixels in the cross-dispersion direction.
...
UVITTools.fuv_grating2_pixel2lamA
— Functionfuv_grating2_pixel2lamA(pixel_num_wrt_zero_order[, order = -2])
Convert FUV-Grating2 pixel number relative to zero order to wavelength in Angstrom.
This function is used for wavelength calibration of FUV-Grating2 count spectrum.
Required parameters
pixel_num_wrt_zero_order::Int
: Pixel numbers relative to zero order.
Optional parameters
order::Int
: -2 (default), Grating order. Allowed orders=-1 and -2.
...
UVITTools.fuv_grating2_wavelength_calib
— Functionfuv_grating2_wavelength_calib(pixels, netsrc_spec_counts_per_s[, order = -2])
Convert pixel numbers relative to zero to wavelengths.
This function is used for wavelength calibration of FUV-Grating2 count spectrum.
...
Arguments
Required parameters
pixels::Array
: An array of pixel numbers relative to zero order.netsrc_spec_counts_per_s::Array
: An array of net count rates corresponding to the relative pixel numbers.
Optional parameters
order::Int
: -2 (default), Grating order. Allowed orders=-1 and -2.
...
UVITTools.fuv_grating2_flux_calib
— Functionfuv_grating2_flux_calib(lamA, netsrc_spec_counts_per_s_A[,order=-2])
Flux calibrate the wavelength-calibrated count spectrum from FUV-Grating2.
This function calculates the effective area at each wavelength of the count spectrum, then uses the effective areas to convert net count rates to f_λ in CGS units.
...
Arguments
Required
-lamA::Array{Float64}
: Array of wavelengths in Å. -netsrc_spec_counts_per_s_A::Array{Float64}
: Array of background corrected counts/s/Å corresponding to wavelength array.
Optional
-Order::Number
: Grating order -2 (default) or -1. ...
UVITTools.fuv_grating2_fluxed_spec
— Functionfuv_grating2_fluxed_spec(target,fuv_grating2_image_file, ds9srcregfile, ds9bgdregfile[,order = -2, disp_aligned_to_xaxis=false, angle_xaxis_disp_deg=267.479, cross_disp_width_pixels= 40])
Extract flux calibrated spectrum from AstroSat/UVIT FUV-Grating2 dispersed image generated from CCDLAB processing pipeline.
This is a main function that uses other functions for extraction of source and background spectra, wavelenth and flux calibrations, and outputs fluxed spectrum. For details on grating orders, wavelength and flux calibrations, see Dewangan (2021). ...
Arguments
Required parameters
target::String
: Name of the target available in the observed UVIT field.fuv_grating2_image_file::String
: Name of the FUV-Grating2 image file in FITS format generated using CCDLAB.ds9srcregfile::String
: Name of the ds9 region file with source center as the zero order position.ds9bgdregfile::String
: Name of the ds9 region file with center in a source-free region of the image.
Optional parameters
order::Int
: -2 (default), Grating order to be used to extract the spectrum. Allowed orders=-1 and -2.disp_aligned_to_xaxis
: false (default), true if the dispersion axis is rotated to align to x-axis in the detector coordinates, false if dispersion axis left unrotated.angle_xaxis_disp_deg
: 267.479 (default), the angle in degrees between dispersion direction (from zero to minus orders) and the x-axis.
If the dispersion axis is left unrotated in the detector coordiantes, the default value should be appropriate.
If the dispersion axis is rotated to align to x-axis, the angle should be set to 180 or zero degrees.
cross_disp_width_pixels::String
: 40 (default), width in pixels in the cross-dispersion direction.
Output
(λ, f_λ, err_f_λ)
- Fluxed spectrum saved in an ascii file.
...
UVITTools.fuv_grating2_phafile
— Functionfuv_grating2_phafile(target,fuv_grating2_image_file, ds9srcregfile, ds9bgdregfile[, order = -2, disp_aligned_to_xaxis=false, angle_xaxis_disp_deg=267.479, cross_disp_width_pixels= 40])
Extract XSPEC/Sherpa compatible source and background PHA spectral files from AstroSat/UVIT FUV-Grating2 dispersed image generated from CCDLAB processing pipeline.
This function extracts source and background count spectra using the zero order positions provided in the DS9 region files and converts them into PHA spectral files. For details on grating orders and spectral responses, see Dewangan (2021).
...
Arguments
Required parameters
target::String
: Name of the target available in the observed UVIT field.fuv_grating2_image_file::String
: Name of the FUV-Grating1 image file in FITS format generated using CCDLAB.ds9srcregfile::String
: Name of the ds9 region file with source center as the zero order position.ds9bgdregfile::String
: Name of the ds9 region file with center in a source-free region of the image.
Optional parameters
order::Int
: -2 (default), Grating order to be used to extract the spectrum. Allowed orders=-1 and -2.disp_aligned_to_xaxis
: false (default), true if the dispersion axis is rotated to align to x-axis in the detector coordinates, false if dispersion axis left unrotated.angle_xaxis_disp_deg
: 267.479 (default), the angle in degrees between dispersion direction (from zero to minus orders) and the x-axis.
If the dispersion axis is left unrotated in the detector coordiantes, the default value should be appropriate.
If the dispersion axis is rotated to align to x-axis, the angle should be set to 180 or zero degrees.
cross_disp_width_pixels::Int
: 40 (default), width in pixels in the cross-dispersion direction.
Output
- Source and background PHA files.
- Some relevant information are also printed on the screen.
...
UVITTools.fuv_grating2_ea
— Functionfuv_grating2_ea(lamA[,order = -2])
Calculate FUV-Grating2 effective area in cm^2 at a desired wavelength (Angstrom) and grating order -1 or -2.
The calculation of the effective area is based on the grating calibration peformed in Dewangan (2021). This function is used for flux calibration of count spectrum.
...
Arguments
Required
lam::Number
: Wavelength in Angstrom.
Optional
-order::Int
: Grating order -1 or -2. ...
Example
julia> fuv_grating2_ea(1450.4,order=-2)
4.076758827954109
NUV-Grating
UVITTools.nuv_grating_m1_count_spec
— Functionnuv_grating_m1_count_spec(nuv_grating_image_file, ds9regfile[, cross_disp_width_pixels = 40, rate = true, outfile="nuv_grating_m1_count_spec.dat"])
Extract count rate spectrum from AstroSat/UVIT NUV-Grating dispersed image generated from CCDLAB processing pipeline.
...
Arguments
Required parameters
nuv_grating_image_file::String
: Name of the NUV-Grating image file in FITS format generated using CCDLAB.ds9regfile::String
: Name of the ds9 region file with center as the zero order position.
Optional parameters
order::Int
: -2 (default), Grating order to be used to extract the spectrum. Allowed orders=-1 and -2.cross_disp_width_pixels::String
: 40 (default), width in pixels in the cross-dispersion direction.rate::Bool
: true (default) for count rate spectrum, otherwise false for count spectrum.outfile::String
: Name of ascii output file name. Default file name: "nuv_grating_m1_count_spec.dat
".
...
UVITTools.nuv_grating_m1_net_countrate_spec
— Functionnuv_grating_m1_net_countrate_spec(nuv_grating_image_file, ds9srcregfile, ds9bgdregfile[, cross_disp_width_pixels = 40, outfile="nuv_grating_m1_net_countrate_spec.dat"])
Extract background corrected, net count rate spectrum from AstroSat/UVIT NUV-Grating dispersed image generated from CCDLAB processing pipeline.
...
Arguments
Required parameters
nuv_grating_image_file::String
: Name of the NUV-Grating image file in FITS format generated using CCDLAB.ds9srcregfile::String
: Name of the ds9 region file with source center as the zero order position.ds9bgdregfile::String
: Name of the ds9 region file with center in a source-free region of the image.
Optional parameters
cross_disp_width_pixels::String
: 40 (default), width in pixels in the cross-dispersion direction.outfile::String
: Name of ascii output file name. Default file name: "nuv_grating_m1_net_countrate_spec.dat
".
...
UVITTools.nuv_grating_m1_wavelength_calib
— Functionnuv_grating_m1_wavelength_calib(pixels, netsrc_spec_counts_per_s)
Convert pixel numbers relative to zero to wavelengths.
This function is used for wavelength calibration of NUV-Grating order=-1 count spectrum.
...
Arguments
Required parameters
pixels::Array
: An array of pixel numbers relative to zero order.netsrc_spec_counts_per_s::Array
: An array of net count rates corresponding to the relative pixel numbers.
Optional parameters
- None
...
UVITTools.nuv_grating_m1_flux_calib
— Functionnuv_grating_m1_flux_calib(lamA, netsrc_spec_counts_per_s_A)
Flux calibrate the wavelength-calibrated count spectrum from NUV-Grating1 order=-1.
This function calculates the effective area at each wavelength of the count spectrum, then uses the effective areas to convert net count rates to f_λ in CGS units.
...
Arguments
Required
-lamA::Array{Float64}
: Array of wavelengths in Å. -netsrc_spec_counts_per_s_A::Array{Float64}
: Array of background corrected counts/s/Å corresponding to wavelength array.
Optional
- None.
...
UVITTools.nuv_grating_m1_fluxed_spec
— Functionnuv_grating_m1_fluxed_spec(target,nuv_grating_image_file, ds9srcregfile, ds9bgdregfile[,order=-1, cross_disp_width_pixels= 40, outfile="default"])
Extract flux calibrated spectrum from AstroSat/UVIT NUV-Grating order=-1 dispersed image generated from CCDLAB processing pipeline.
This is a main function that uses other functions for extraction of source and background spectra, wavelenth and flux calibrations, and outputs fluxed spectrum. For details on grating orders, wavelength and flux calibrations, see Dewangan (2021). ...
Arguments
Required parameters
target::String
: Name of the target available in the observed UVIT field.nuv_grating_image_file::String
: Name of the NUV-Grating image file in FITS format generated using CCDLAB.ds9srcregfile::String
: Name of the ds9 region file with source center as the zero order position.ds9bgdregfile::String
: Name of the ds9 region file with center in a source-free region of the image.
Optional parameters
order::Int
: -1 (default), Grating order to be used to extract the spectrum. Allowed orders=-1. Order=-2 is not yet calibrated.cross_disp_width_pixels::String
: 40 (default), width in pixels in the cross-dispersion direction.
-outfile::String
:Name of the output file. A default file name based on the target name/grating will be generated if outfile="default".
Output
(λ, f_λ, err_f_λ)
- Fluxed spectrum saved in an ascii file.
...
UVITTools.nuv_grating_phafile
— Functionnuv_grating_phafile(target,nuv_grating1_image_file, ds9srcregfile, ds9bgdregfile[, cross_disp_width_pixels= 40])
Extract XSPEC/Sherpa compatible source and background PHA spectral files from AstroSat/UVIT NUV-Grating dispersed image generated from CCDLAB processing pipeline.
This function extracts source and background count spectra using the zero order positions provided in the DS9 region files and converts them into PHA spectral files. For details on grating orders and spectral responses, see Dewangan (2021).
...
Arguments
Required parameters
target::String
: Name of the target available in the observed UVIT field.nuv_grating_image_file::String
: Name of the NUV-Grating image file in FITS format generated using CCDLAB.ds9srcregfile::String
: Name of the ds9 region file with source center as the zero order position.ds9bgdregfile::String
: Name of the ds9 region file with center in a source-free region of the image.
Optional parameters
cross_disp_width_pixels::String
: 40 (default), width in pixels in the cross-dispersion direction.respdir::String
: Name of the directory containing the response matrices in the local machine. The response files can be downloaded from the GitHub page.
#read necessary keywords`
Output
- Source and background PHA files.
- Some relevant information are also printed on the screen.
...
Aperture Photometry
UVITTools.read_ds9reg
— Functionread_ds9reg(ds9regfile)
Read a DS9 region file.
This function reads a region file created with the DS9 tool, and outputs the region parameters. ...
Arguments
Required parameters
ds9regfile::String
: DS9 region file for a circular, annular or elliptical region.
...
UVITTools.uvit_aphot
— Functionuvit_aphot(imagefile,ds9srcregion, ds9bgdregion[, satu_corr=true, mst_or_bjd="mst"])
Perform aperture photometry of a source present in an UVIT FUV/NUV FITS image obtained from CCDLAB pipeline.
This function uses DS9 source and background region files and extracts count rates, corrects for any saturation, calculates the background net count rate, and then converts to flux density f_λ and AB magnitude using calibration information available in Tandon et al. (2020).
If the source region is a circle and satucorr is true, then the source count rate is also corrected for saturation using the function `uvitsaturation_corr.jl` (see below). For details, see Tandon et al. (2017).
...
Arguments
Required parameters
imagefile::String
: Name of the FUV or NUV image file in FITS format generated using CCDLAB.ds9srcregfile::String
: Name of the ds9 region file for the source.ds9bgdregfile::String
: Name of the ds9 region file for background.
Optional parameters
satu_corr::Bool
: true (default), Apply saturation correction only if source extraction region is circular. Valid for point sources only and if the redius of the circular extraction region is about 29 pixels or 12 arcsec (see Tandon et al. 2020).mst_or_bjd::String
: Mission time or barycentric julian day, default: "mst".
...
UVITTools.uvit_countrate2flux
— Functionuvit_countrate2flux(channel, filter, cps)
Convert net source count rate to flux density or magnitude for any of FUV/NUV broadband filters. This function is used by uvit_aphot.jl
.
...
Arguments
channel::String
: UVIT channel FUV or NUVfilter::String
: FUV or NUV filter e.g., "BaF2".cps::Float64
: Counts per second.
...
UVITTools.uvit_filter2pha
— Functionuvit_filter2pha(target,imagefile, ds9srcregfile, ds9bgdregfile[,satu_corr=true, respdir=""/soft/astrosat/resp/uvit/"])
Extract XSPEC/Sherpa compatible source and background PHA spectral files from AstroSat/UVIT broadband image generated from CCDLAB processing pipeline.
This function extracts source and background counts using the DS9 region files and converts them into PHA spectral files. For details on grating orders and spectral responses, see Dewangan (2021).
...
Arguments
Required parameters
target::String
: Name of the target available in the observed UVIT field.imagefile::String
: Name of the FUV or NUV image file in FITS format generated using CCDLAB.ds9srcregfile::String
: Name of the ds9 region file for source.ds9bgdregfile::String
: Name of the ds9 region file for background.
Optional parameters
satu_corr::Bool
: Apply saturation correction for point sources only if true (default).respdir::String
: Name of the directory containing the response matrices in the local machine. The response files can be downloaded from the GitHub page.
Output
- Source and background PHA files.
- Some relevant information are also printed on the screen.
...
UVITTools.uvit_saturation_corr
— Functionuvit_saturation_corr(count_rate[, frames_per_sec=28.717])
Correct UVIT source count rate for saturation effect.
This function is based on the algorithm provided in Tandon et al. (2017), and used by uvit_aphot.jl
for circular extraction region only.
UVITTools.uvit_zp_uc
— Functionuvit_zp_uc(channel, uvit_filter)
Obtain the magnitude zero point and unit conversation factor for FUV or NUV channel in any filter.
This function is based on the calibration information from Tandon et al. (2017) and (2020). The function is used by uvit_aphot.jl
to count rates to flux densities and magnitudes.
...
Arguments
channel::String
: UVIT channel either FUV or NUV.uvit_filter::String
: UVIT filter name. Different names can be used for the same filter e.g., "F1", "F148W", "CaF2-1".
...
Miscellaneous
UVITTools.xycen_from_ds9reg
— Functionxycen_from_ds9reg(ds9regfile)
Extract center coordinates (x,y) from a DS9 circular region file.
UVITTools.write_uvit_grating_phafile
— Functionwrite_uvit_grating_phafile(uvit_detector, uvit_grating, channels, counts, exptime_sec[, phafile="phafile.pha"])
Write OGIP compatible PHA spectral file from grating count spectra - channel vs counts.
This function is used by grating spectroscopy tools. ...
Arguments
uvit_detector::String
: FUV or NUV.uvit_grating::String
: One of the UVIT gratings - FUV-Grating1, FUV-Grating2, NUV-Grating.channels::Array{Int64}
: An array of spectral channels.counts::Array{Float64}
: An array of counts corresponding to the spectral channel array.exposure_time_sec::Float64
: Exposure time (s).
Optional
phafile::String
: Name of the PHA spectral file to be generated.
...
UVITTools.lambdaA2keV
— FunctionConvert wavelength in Angstrom to Energy in keV.
Convert wavelength in Angstrom to Energy in keV.
UVITTools.lambdaA2ergs
— FunctionConvert wavelength in Å to eargs.
UVITTools.flux_density_photons2cgs
— FunctionConvert photon number density nλ to flux density fλ.
UVITTools.flux_density_cgs2photons
— FunctionConvert flux density fλ (ergs/cm2/s/Å) to photon number density nλ (photons/cm2/s/Å).