castor_etc.transit
Transit Calulations
The castor_etc.transit package provides methods and classes to simulate
a transit event such as observations.
Module Contents
Classes
Observation class. |
Functions
Usage: pixels=addflux2pix(px,py,pixels,fmod) |
|
Data
API
- castor_etc.transit._OPTIMAL_APER_FACTOR = 1.4
- castor_etc.transit.addflux2pix(px, py, pixels, fmod)
Usage: pixels=addflux2pix(px,py,pixels,fmod)
Drizel Flux onto Pixels using a square PSF of pixel size unity px,py are the pixel position (integers) fmod is the flux calculated for (px,py) pixel and it has the same length as px and py pixels is the image.
- castor_etc.transit.gen_unconv_image(pars, starmodel_flux, xcoo, ycoo)
- class castor_etc.transit.Observation(TelescopeObj, SourceObj, BackgroundObj, stellar_model_dir)
Observation class.
Initialization
Initialize class for transit calculations.
Note that the
Sourceobject (i.e., theSourceObjparameter) should be a point source.Parameters
TelescopeObj ::
castor_etc.Telescopeobject Thecastor_etc.Telescopeobject containing the telescope parameters.SourceObj ::
castor_etc.Sourceobject Thecastor_etc.Sourceobject contaning the target source parameters.BackgroundObj ::
castor_etc.Backgroundobject Thecastor_etc.Backgroundobject containing the background parameters. Dictionary keys must match the TelescopeObj.passbands keys.stellar_model_dir :: str Path to the stellar models directory.
Attributes
TelescopeObj ::
castor_etc.Telescopeobject Thecastor_etc.Telescopeobject containing the telescope parameters.SourceObj ::
castor_etc.Sourceobject Thecastor_etc.Sourceobject contaning the target source parameters.BackgroundObj ::
castor_etc.Backgroundobject Thecastor_etc.Backgroundobject containing the background parameters.Returns
Transitinstance- calc_sky_background_erate()
Noise associated with the sky background. This calculation is copy and pasted from calc_snr_or_t function in the photometry class.
Attributes
sky_background_noise :: dict of float Sky background noise (electron/s/pixel) associated with each passband nameReturns
None
- _photon_count(temp=5780.0, metallicity=0.0, logg=4.44, Gmag=7.0, Gmag_abs=4.635, radius=1.0)
Calculate photon count from model for chosen passband name.
Parameters
temp :: float Effective temperature of the stellar atmosphere model metallicity :: float Metallicity of the stellar atmosphere model logg :: float logg value of the stellar atmosphere model Gmag :: float Gaia G magnitude of the stellar atmoshpere model Gmag_abs :: float Absolute Gaia G magnitude of the stellar atmosphere model radius :: float Radius of the star dpc :: float Distance to the star. Included for testing *Not currently used*Returns cnt_rate ::
gaia_flux ::
- specify_bandpass(passband_name=None)
Set bandpass specific parameters
Parameters
passband_name :: str The bandpass id to determine bandpass specific parametersAttributes
passband_name :: str The bandpass id to determine bandpass specific parametersReturn
None
- id_guide_stars(gs_criteria=None, plot_SN=False)
Parameters
gs_criteria :: dict Criteria for guide star SN_pix :: int or float Minimum S/N per pixel associated with each guide star exptime :: int or float Assume 2 Hz for guide camera, i.e., 0.5 sec ccd_aperture :: int or float Radius [pxl] to evaluate max S/N associated with each source, ask Dr. Woods plot_SN :: bool If True, then a Max. S/N per pixel vs. Gaia G [mag] graph is plotted.Return
None
- _remove_aper_mask_nan_row_col(center)
Remove columns and rows of the aperture mask containing all NaNs. Modifies the following attributes:
_aper_mask,source_weights,sky_background_weights,dark_current_weights,_aper_xs,_aper_ys. Also updates_aper_extentto reflect changed arrays.Parameters
center :: 2-element 1D array of floats The (x, y) center of the aperture relative to the center of the source in arcsec. Positive values means the source is displaced to the bottom/left relative to the aperture center.
Attributes
_aper_mask :: (M x N) 2D array of floats The aperture mask, including fractional pixel weights. The aperture mask shows the fractional overlap between the aperture and the pixel, ranging from (0, 1]. A pixel that is wholly contained in the aperture has an aperture weight equal to 1. Similarly, a pixel that is partially contained in the aperture has a weight between 0 and 1 (exclusive) directly proportional to the area of the aperture that overlaps the pixel. A pixel that is wholly outside the aperture has a weight of NaN. Now without rows and columns containing only NaNs.
source_weights :: (M x N) 2D array of floats The pixel weights for the source. Now without rows and columns containing only NaNs (based on _aper_mask). Note that changing the source weights for a point source will not affect the final photometry calculation. Instead, set the
encircled_energyparameter in thecalc_snr_or_t()method.sky_background_weights :: (M x N) 2D array of floats The pixel weights for the sky background. Now without rows and columns containing only NaNs (based on _aper_mask).
dark_current_weights :: (M x N) 2D array of floats The pixel weights for the dark current. Now without rows and columns containing only NaNs (based on _aper_mask).
_aper_xs :: (M x N) 2D array of floats The aperture array containing the x-coordinates (in arcsec) relative to the center of the aperture. Now without rows and columns containing only NaNs (based on _aper_mask).
_aper_ys :: (M x N) 2D array of floats The aperture array containing the y-coordinates (in arcsec) relative to the center of the aperture. Now without rows and columns containing only NaNs (based on _aper_mask).
_aper_extent :: 4-element 1D list of floats The [xmin, xmax, ymin, ymax] extent of the aperture in arcsec (for plotting the weight arrays). Updated to reflect the extent containing only rows and columns with at least 1 non-NaN value.
Returns
None
- _calc_source_weights(center)
Calculate the source weights for the given profile.
Parameters
center :: 2-element 1D array of floats The (x, y) center of the aperture relative to the center of the source in arcsec. Positive values means the source is displaced to the bottom/left relative to the aperture center.
Returns
source_weights :: (M x N) 2D array of floats The source weights for each pixel in the aperture. These represent the flux of the source at each pixel relative to the flux at the center of the source.
- _create_aper_arrs(half_x, half_y, center, overwrite=False)
Parameters
half_x, half_y :: floats The half-widths (in arcsec) of the aperture in the x- and y-directions, respectively. (e.g., semimajor/semiminor axes, half of a rectangle’s length/width, etc.)
center :: 2-element 1D array of floats The (x, y) center of the aperture relative to the center of the source in arcsec. Positive values means the source is displaced to the bottom/left relative to the aperture center.
overwrite :: bool If True, allow overwriting of any existing aperture arrays.
Attributes
_aper_xs :: (M x N) 2D array of floats The aperture array containing the x-coordinates (in arcsec) relative to the center of the aperture.
_aper_ys :: (M x N) 2D array of floats The aperture array containing the y-coordinates (in arcsec) relative to the center of the aperture.
_aper_extent :: 4-element 1D list of floats The [xmin, xmax, ymin, ymax] extent of the aperture in arcsec (for plotting the weight arrays).
sky_background_weights :: (M x N) 2D array of floats The pixel weights for the sky background (incl. Earthshine, zodiacal light, geocoronal emission). This is currently all ones (1) (i.e., uniform noise).
dark_current_weights :: (M x N) 2D array of floats The pixel weights for the dark current. This is currently all ones (1) (i.e., uniform noise).
Returns
center_px :: 2-element 1D list of floats The (x, y) center index of the aperture coordinates arrays (i.e., _aper_xs and _aper_ys). To be very explicit, this is not (0, 0) but rather the center of the 2D arrays.
- _use_optimal_aperture(factor=_OPTIMAL_APER_FACTOR, overwrite=False)
Parameters
factor :: int or float The factor by which to scale the telescope’s FWHM. The radius of the optimal aperture will be
R = factor * (FWHM/2).quiet :: bool If False, print a message if the point source’s diameter is larger than the telescope’s FWHM as well as print the encircled energy fraction.
overwrite :: bool If True, allow overwriting of any existing aperture associated with this
Photometryobject.Attributes
_aper_mask :: (M x N) 2D array of floats The aperture mask, including fractional pixel weights. The aperture mask shows the fractional overlap between the aperture and the pixel, ranging from (0, 1]. A pixel that is wholly contained in the aperture has an aperture weight equal to 1. Similarly, a pixel that is partially contained in the aperture has a weight between 0 and 1 (exclusive) directly proportional to the area of the aperture that overlaps the pixel. A pixel that is wholly outside the aperture has a weight of NaN.
source_weights :: (M x N) 2D array of floats The pixel weights for the source. Note that changing the source weights for a point source will not affect the final photometry calculation. Instead, set the
encircled_energyparameter in thecalc_snr_or_t()method.sky_background_weights :: (M x N) 2D array of floats The pixel weights for the sky background.
dark_current_weights :: (M x N) 2D array of floats The pixel weights for the dark current.
Returns
None
- _point_source_sim(target_flux_fraction, scene_phot_count)
Parameters
target_flux_fraction :: int or float Used to reduce target star flux when injecting transit signal
scene_phot_count :: int or float Photon count from the source
Returns
pixels_final.T :: array of floats point source simulation pixels_err.T :: array of floats error associated with the point source simulation
- scene_sim(all_sources=True, return_scene=False, update_gaia=True, quiet=None, return_SN_only=False)
Generate simulated scene using sources listed in self.SourceObj.gaia
Parameter
all_sources :: Boolean True -> Include all Gaia sources in scene False -> Include only the target return_scene :: Booleans True -> scene_flux = self.scene_sim() quiet :: Boolean To print 'Generating scene...' return_SN_only :: Boolean Return S/N without updating object (used for guide star identification)Return
if return_SN_only: SN_pix,SN_ap if return_scene: pixels_final.T,pixels_err.T
- plot_fov(plot_guide_stars=True, vmin=None, vmax=None, add_scene_sim=True)
Ask James
Parameters
pa :: plot_guide_stars :: Boolean vmin :: vmax :: plot_grid :: Boolean add_scene_sim :: Boolean
Return
None
- specify_pl_model(RpRs, P, t0, b, aRs)
Model planet for transit simulation
Parameters
RpRs :: int or float Planet-star radius ratio P :: int or float Orbital period <Need to read pytransit for units> t0 :: int of float Zero epoch <Need to read pytransit for units> b :: int or float Impact parameter, which is the projected distance between the planet disk and the stellar disk at mid-transit aRs :: int of float Ratio of the semi-major axis to the stellar radiusAttributes
pl_model :: dict of arrays of floats Planet model parametersReturn
None
- specify_exposure_parameters(exptime=60 * u.second, nstack=10, tstart=0.0 * u.d, tend=6.0 / 24.0 * u.d)
Exposure parameters for planet transit simulation
Parameters
exptime :: int Exposure time nstack :: int Number of exposures to stack (t_tot = exptime*nstack) tstart :: int of float Light curve start time [days] tend :: int or float Light curve end time [days]Attributes
exptime :: int Exposure time nstack :: int Number of exposures to stack (t_tot = exptime*nstack) tstart :: int of float Light curve start time [days] tend :: int or float Light curve end time [days]Return
None
- calc_pl_model(model='pytransit_QuadraticModel', t_grid=[], exp_time=-1)
Parameters
Planet model t_grid :: array exp_time ::
Return
_pl_lc_tot ::