simulation module
This modules contains classes for simulating Imaging, Mosaicing, and Spectroscopic modes
- class pista.simulation.Imager(df, coords=None, tel_params=None, n_x=1000, n_y=1000, exp_time=100, plot=False, user_profiles=None)[source]
Bases:
AnalyzerImager class uses dataframe containing position and magntidue information to simulate image based on user defined telescope and detector characteristics
- compute_shot_noise(array, type_='Poisson')[source]
- Parameters:
array (numpy.ndarray) – input array
type (str, optional) – The default is ‘Poisson’.
- Returns:
shot_noise – Return array with shot noise
- Return type:
numpy.ndarray
- create_wcs(n_x, n_y, ra, dec, pixel_scale, theta=0)[source]
- Parameters:
n_x (int) – number of pixels in RA direction
n_y (int) – number of pixels in Dec direction
ra (float (degrees)) – right ascension of center of image.
dec (float (degrees)) – declination of center of image.
pixel_scale (floats) – arcsecs/pixel.
- Returns:
w
- Return type:
wcs object
- dark_current(T, DFM, pixel_area)[source]
- Parameters:
T (float) – Detector Temperature
DFM (float) – Dark current figure of merit
pixel_area (float) – Area of pixel
- Returns:
DR – Dark current rate e/s/pixels
- Return type:
float
- property dark_frame
- property flat_frame
- generate_photons(image, patch_width, df)[source]
This function creates sims based on ABmag on a small patch (2D array) of size n_pix_s*n_pix_s.
The patch with the sim is then added to the image array of size n_pix_m*n_pix_m using wcs object.
- Parameters:
image (numpy.ndarray) – base image array for inserting star sims
patch_width (int) – number of pixels (length) in sim patch image
df (pandas.dataframe) – Dataframe containing source list
- Returns:
image – Array with sims added based on df
- Return type:
numpy.ndarray
- generate_sim_field(plot)[source]
This function creates array with FoV a bit wider than user defined size for flux conservation
- init_df(df, n_x, n_y, x_left, x_right, y_left, y_right)[source]
Bounds sources to boundary defined by x and y limits
- class pista.simulation.Mosaic(df=None, coords=None, ras=None, decs=None, tel_params=None, exp_time=100, n_x=1000, n_y=1000, mos_n=1, mos_m=1, **kwargs)[source]
Bases:
ImagerA class to split bigger images to tiles and stitch them together
analysis module
This module contains classes that can be utilized for visualizing and analyzing the simulated images and spectra
- class pista.analysis.Analyzer[source]
Bases:
object- aper_photometry(data, wcs, df, fwhm, sigma, detect, ZP)[source]
Function to perform Aperture photometry
- Parameters:
data (np.ndarray,) – image to perform photometry on
wcs (astropy.wcs.WCS) – WCS object of the image
df (pandas.DataFrame,) – Source catalog of source in the image from simulation for reference
fwhm (float, pixels) – During aperture photometry, fwhm corresponds to FWHM circular aperture for aperture photometry During PSF photometry, fwhm corresponds FWHM kernel to use for PSF photometry
sigma (float,) – The numbers of standard deviations above which source has to be detected
detect (bool,) –
If true, DARStarFinder is used to detect sources for aperture photometry
if false, input catalog is used for getting positions of sources for aperture photometry
ZP (float,) – zero point of the telescope.
- Returns:
phot_table – table containing photometry of the souces
Columns ‘x-centeroid’ ‘y-centeroid’ ‘sky’ ‘flux’ ‘mag_in’ ‘mag_out’ ‘mag_err’ ‘SNR’
- Return type:
astropy.table.Table
- getImage(source='Digital')[source]
Function of retrieving image array at different stages of simulation.
- Parameters:
Source (str,) –
- Choose from
’Digital’ : Final digial image ‘Charge’ : electrons, Light(Source + sky)
Dark Current + Noises
’Source’ : Source + Sky + Noises ‘Sky’ : Sky + shot_noise ‘DC’ : Dark Current + DNFP ‘QE’ : Quantum efficiency fluctuation across
detector
’Bias’ : Charge offset ‘PRNU’ : Photon Response Non-Uniformity ‘DNFP’ : Dark Noise Fixed Pattern ‘QN’ : Quantization Noise
- show_field(figsize=(10, 10), marker='.', cmap='jet')[source]
Function for creating a scatter plot of sources within the FoV
- Parameters:
figsize (tuple,) – Figure size
- Return type:
fig, ax
- show_hist(source='Digital', bins=None, fig=None, ax=None, figsize=(15, 8))[source]
Function for plotting histogram of various stages of simulation
- Parameters:
Source (str,) –
- Choose from
’Digital’ : Final digial image ‘Charge’ : electrons, Light(Source + sky)
Dark Current + Noises
’Source’ : Source + Sky + Noises ‘Sky’ : Sky + shot_noise ‘DC’ : Dark Current + DNFP ‘QE’ : Quantum efficiency fluctuation across
detector
’Bias’ : Charge offset ‘PRNU’ : Photon Response Non-Uniformity ‘DNFP’ : Dark Noise Fixed Pattern ‘QN’ : Quantization Noise
bins (numpy.array,) – bins for making histogram
fig (matplotlib.pyplot.figure) – User defined figure
ax (matplotlib.pyplot.axes) – User defined axes
figsize (tuple) –
- show_image(source='Digital', fig=None, ax=None, cmap='jet', figsize=(15, 10), download=False, show_wcs=True, overlay_apertures=False)[source]
Function for plotting the simulated field image
- Source: str,
- Choose from
‘Digital’ : Final digial image ‘Charge’ : electrons, Light(Source + sky) +
Dark Current + Noises
‘Source’ : Source + Sky + Noises ‘Sky’ : Sky + shot_noise ‘DC’ : Dark Current + DNFP ‘QE’ : Quantum efficiency fluctuation
across
detector
‘Bias’ : Charge offset ‘PRNU’ : Photon Response Non-Uniformity ‘DNFP’ : Dark Noise Fixed Pattern ‘QN’ : Quantization Noise
- figmatplotlib.pyplot.figure
User defined figure
- axmatplotlib.pyplot.axes
User defined axes
- cmapstr,
matplotlib.pyplot colormap
figsize : tuple download : bool show_wcs : bool
If true adds WCS projection to the image
- Returns:
Image
fig, ax
- writeto(name, source='Digital', user_source=None, with_dark_flat=False)[source]
Function for downloading a fits file of simulated field image
- Parameters:
name (str) – filename, Example : simulation.fits
Source (str,) –
- Choose from
’Digital’ : Final digial image ‘Charge’ : electrons, Light(Source + sky)
Dark Current + Noises
’Source’ : Source + Sky + Noises ‘Sky’ : Sky + shot_noise ‘DC’ : Dark Current + DNFP ‘Bias’ : Charge offset ‘PRNU’ : Photon Response Non-Uniformity ‘DNFP’ : Dark Noise Fixed Pattern ‘QN’ : Quantization Noise
user_source (numpy.ndarray) – 2D numpy array user wants to save as FITS
with_dark_flat (bool) – True : Output fits will provide dark and flat frames
utils module
This module contains additional functions for the package
- pista.utils.Xmatch(df1, df2, r=1)[source]
Function for crossmatching two catalogs using RAs and Decs
- pista.utils.bandpass(wav, flux, inputs, plot=True, fig=None, ax=None)[source]
Function to convolve response functions
- Parameters:
wav (numpy.ndarray) – wavelenth in angstrom
flux (numpy.ndarray) – flux normalized to [0,1]
plot (bool,) – If true shows plots with input and convolved response functions
fig (matplotlib.pyplot.figure) – User defined figure
ax (matplotlib.pyplot.axes) – User defined axes
- Returns:
fig, ax, data, params
data (tuple,) – (wavelenth array, flux_array, convolved flux array)
params (tuple,) – (effective wavelength, integrated flux, Effective Width)