API Reference

This page introduces to the classes and functions in the irgsctool package. The main class is the irgsc class which has several subclasses like GetData, ReadData, StarGalaxyClassification, ExtinctionCorrection, GenerateIRGSC, ValidateIRGSC.

Figure (1) shows the UML diagram of the irgsctool package.

uml
Figure 1: The UML diagram of the irgsctool package.

irgsc(ra, dec, validate=None)


Initialisation of parent irgsc class . This class has several child classes.

This method described using input ra and dec. It checks whther the data from PANSTARRS DR2, UKISS DR11 and Gaia DR3 can be obtained.

RAISES DESCRIPTION
ValueError

if the data is not available in UKIDSS or PANSTARRS 3-pi survey. The code will not proceed further.

Warning

if the data is not available in the Gaia DR3 survey. In the IRGSC, the Gaia values will be replaces with -999.

GetData(ra, dec)

GetData class contains methods to obtain PANSTARRS DR2 stacked optical photometry data, UKIDSS NIR observed data and GAIA DR3 astrometry data. The default search radius is 0.25 degrees due to the limitation of pyvo. The data retrieved is stored in .csv format with the name of the survey + str(ra) + str(dec)

Examples:

>>> irgsctool.GetData.get_panstarrs_data(0.0,0.0)
'PS1_RA_0_0_DEC_0_0.csv'
>>> irgsctool.GetData.get_gaia_data(0.0,0.0)
'GAIA_RA_0_0_DEC_0_0.csv'
>>> irgsctool.GetData.get_ukidss_data(0.0,0.0)
'UKIDSS_RA_0_0_DEC_0_0.csv'

get_gaia_data()

irgsctool.GetData.get_gaia_data()

This function sends a query to obtain GAIA DR3 data using the astroquery module. The ROW_LIMIT is set to -1 which implies that the query retriees all the rows in the given field.

get_panstarrs_data()

irgsctool.GetData.get_panstarrs_data()

This function sends a query to obtain the PANSTARRS data from DR2 database. The query uses pyvo TAPService module for retrieving the data. The data is selected from StackObjectView db and the maximum search radius is 0.25 degrees.

get_ukidss_data()

irgsctool.GetData.get_ukidss_data()

This function sends a query to obtain UKIDSS DR11 NIR data using astroquery. UKIDSS consists of five sub-surveys viz. UDS, GPS, GCS, DXS and LAS. The query loops over this surveys and retrieves the data for the given coordinates. The surveys which do not contain J and H band data, the function sends an alert. <\justify>

ReadData(ra, dec)

ReadData class contains methods to read the photometric data from PS1 DR2, GAIA DR3 and UKIDSS DR11.

read_gaia_data()

Reads the input GAIA DR3 data. The number of columns are 12.

read_nir_data()

Reads the input UKIDSS NIR data. The number of columns are 8.

Returns the input optical data with nan values removed (if present) and restricts the data to the sources having SNR >= 5.

Some regions do not have J or H band data especially DXS or GCS surveys. For these regions, only K band data is imported.

read_optical_data()

irgsctool.ReadData.read_optical_data()

This function reads the input optical PANSTARRS data. The number of columns in the input file are 32. After reading the input data, this function filters it for nan values (if present) and restricts the data to the sources having detection in all the five bands and that have SNR atleast 5. This data is then fed to the Star-Galaxy classification routine to seperate stars and galaxies in the data. <\justify>

RAISES DESCRIPTION
FileNotFoundError

if the optical input data file is not available.

StarGalaxyClassification(ra, dec)

StarGalaxyClassification class contains star_galaxy_classification() method which is used to seperate the stars and galaxies in the PANSTARRS optical data.

star_galaxy_classification()

irgsctool.StarGalaxyClassification.star_galaxy_classification()

This method is used to seperate stars and galaxies using the condition applied to all the five optical filters:

$$ (psf-kron) < 0.05 $$

This relation filters the input optical data for only probable stellar sources. The (psf-kron) diagram showing stars and galaxies in the data as well as (g-r) vs (r-i) CCD is also plotted by this method.

RETURNS DESCRIPTION
ndarray

PANSTARRS data containing most probable stellar sources

ExtinctionCorrection(ra, dec)

ExtinctionCorrection class has two methods; one to obtain the reddening and NIR extinction coefficients, while the other to correct the PANSTARRS data for extinction in each optical filter.

extinction_corrected_photometry()

irgsctool.ExtinctionCorrection.extinction_correctdd_photometry()

This method corrects the input optical PANSTARRS data for reddening and extinction along the line of site.

RETURNS DESCRIPTION
ndarray

Extinction corrected PANSTARRS optical photometry.

get_reddening()

irgsctool.ExtinctionCorrection.get_reddening()

This method obtains the reddening value for a given set of input coordinates from Schelgel et.al. 1998 (sfd) reddening map. irgsctool uses Schlafly & Finkbeiner 2011 (snf) reddening map which is snf = 0.86*sfd.

RAISES DESCRIPTION
FileNotFoundError

if the sfd files are not present.

RETURNS DESCRIPTION
ebv

Reddening from Schlafly & Finkbeiner 2011

err_ebv

Uncertinty in reddening

aj

J-band extinction coefficient.

ah

H-band extinction coefficient.

ak

K-band extinction coefficient.

Models(use_sam=None)

Models class reads and selects the required Kurucz and Phoenix stellar atmospheric models in the generation of IRGSC.

read_sam_file()

irgsctool.Models.read_sam_file(use_sam=None)

This method reads the model parameters and results from the interpolated Kurucz or the Phoenix model files. use_sam is bool and decides which model file to be read. To use the interpolated Kurucz models, set use_sam = Kurucz . Similarly, use_sam = Phoenix to use interpolated Phoenix models.

RAISES DESCRIPTION
AttributeError

if use_sam is None.

FileNotFoundError

if the model files are not found.

select_sam_range(teff_range=None, logg_range=None, feh_range=None)

irgsctool.Models.select_sam_range(teff_range=None, logg_range=None, feh_range=None, use_optimal_method=False)

This method selects the range of the models to be used in the generation of IRGSC.

If use_optimal_method is set to True, the following range of model parameters is selected:

Model Name (T_{eff}) (K) log(g) (dex) [Fe/H] (dex)
Phoenix (C1) 2800 - 5000 3.0 - 5.5 -5.0 - -1.5
Phoenix (C2) 2800 - 4000 0.0 - 3.0 -0.5 - 1.5
KuruczCastelli-Kurucz (K0) 4000 - 10000 --- ---
RETURNS DESCRIPTION
sam_params

type: ndarray: Selected model parameters and model

magnitudes to generate IRGSC

RAISES DESCRIPTION
TypreError

if range of parameters is not given.

GenerateIRGSC(ra, dec)

The GenerateIRGSC class hosts method to generate a catalog of probable stellar sources in the PANSTARRS data with their computed magnitudes, astrometric information from GAIA DR3 data, best fitted model parameters and flags.

generate_irgsc(use_optimal_method=True)

irgsctool.GenerateIRGSC.generate_irgsc(use_optimal_method=True)

This method finds the best fitting model to the observed colors of the stellar source. The best fitting model is chosen from a combination of Kurucz/Castelli-Kurucz and Phoenix synthetic spectra convolved with the PANSTARRS response function (or BANDPASS) which is integrated w.r.t. the wavelength and normalised to the product of the PANSTARRS response function and wavelength. This is also called as Effective Stimulus (ES).

$$ ES = \frac{\int{F_{\lambda}P_{\lambda}{\lambda} d{\lambda}}}{\int{P_{\lambda}{\lambda}d{\lambda}}} $$

The spectra is obtained from pysynphot (More information here).

RETURNS DESCRIPTION
irgsc_data

The generated IRGSC.

ValidateIRGSC(ra, dec)

The Validate class includes methods to validate the generated irgsc, generate a validated catalog and plot the comparison of the observed and computed NIR magnitudes.

read_irgsc()

irgsctool.validate.read_irgsc()

This function reads the generated IRGSC for a given set of coordinates.

RAISES DESCRIPTION
FileNotFoundError

This error arises if there is no generated IRGSC

validate(validate=None)

irgsctool.ValidateIRGSC.calidate(validate=True)

This method compares the observed and computed NIR magnitudes for a given field. If this is set to True, the method first obtains the UKIDSS data for the given field. The output is a validated IRGSC and plots showing the comparison of the computed NIR magnitudes with the observed ones.

RAISES DESCRIPTION
ValueError

if validate is False