Detailed StraKLIP API
straklip.config module
straklip.dataframe module
This module implements the DataFrame class, which manages the storage and manipulation of the data tables (multivisits detections, average visits detections, stamps, photometry, psf subtraction, false positives, etc) through all the pipeline
- class straklip.dataframe.DataFrame(path2data='', path2out='', path2database='', path2pam='', target='', inst='', pixscale=1, gain=1, PAMdict={}, tilebase=15, radec=[], filters=[], xyaxis=[], fitsext='_flt', skipphot=False, dq2mask=[], zpt={}, Av={}, dist=0, kmodes=[], type='type', maxsep=2, minsep=0, df_ext_in='.h5', df_ext_out='.h5', steps=[])[source]
Bases:
object
straklip.fake_star module
Fake star class to create singles and binaries for false positives analysis
straklip.input_tables module
straklip.photometry module
This module implements the Detection class, which defines the Detection object fundamental to perform photomerty, as well ass the photometry classes (aperture,PSF and matched filter) and lux2counts (and viceversa) transofrmations
- class straklip.photometry.Detection(data, x, y, edata=None, psf=None, fwhm=None, Sky=0, eSky=0, nSky=1, thrpt=1, ethrpt=0, Ei=1, grow_corr=0)[source]
Bases:
objectThis class define the master Detection object for photometry
- class straklip.photometry.flux_converter[source]
Bases:
objectThis class handle transnformation that can be applyed to the output of each photometry
- counts_and_errors()[source]
evaluate counts and uncertainties following DAOPHOT formula for aperture/MF photometry or the equivalent noise area for PSF photometry
- flux2mag(zpt=0.0, ezpt=0.0, exptime=1.0)[source]
Convert flux to magnitudes and uncertanties
Parameters
- zptfloat, optional
zeropoint for the observation. The default is 0.
- zptfloat, optional
error on the zeropoint. The default is 1.
- ezptfloat, optional
exposure time for this detection. The default is 1.
- exptimefloat, optional
exposure time for this detection. The default is 1.
Returns
None.
- radial_profile(max_rad=5, initial_guess=[1, 0, 1, 0], showplot=False)[source]
Evaluate the radial profile of the fistribution of counts in the tile
Parameters
- max_radint, optional
maximum distance from the target in pixels where to evaluate the profile. The default is 5.
- initial_guesslist, optional
initial guess for the gaussian fit. The default is [1,0,1,0].
- showplotbool, optional
choose to show pltos. The default is False.
Returns
None.
- class straklip.photometry.photometry_AP[source]
Bases:
objectThis class handle the aperture photometry
- aperture_mask(aptype='circular', method='exact', radius1=1, radius2=None, ap_x=2, ap_y=2)[source]
Create an aperture based on aptype selection
Parameters
- aptype(circular,square,4pixels), optional
defin the aperture type to use during aperture photometry. The default is ‘cirular’.
- methodInt or None, optional
The method used to determine the overlap of the aperture on the pixel grid. With center they are either 0 or 1, while exact produces partial-pixel masks (i.e., values between 0 and 1). With subpixel, a pixel is divided into subpixels, each of which are considered to be entirely in or out of the aperture depending on whether its center is in or out of the aperture. If subpixels=1, this method is equivalent to ‘center’. The aperture weights will contain values between 0 and 1. The default is ‘exact’.
- radius1Int, optional
radius of circula aperture in pixels or inner radius for annulus aperture. The default is 1.
- radius2Int or None, optional
outer radius for annulus aperture. if None use circular aperture. The default is None.
- ap_xInt, optional
widht of the square aperture. The default is 2.
- ap_y: Int or None, optional
hight of the square aperture. The default is 2.
Returns
None.
- aperture_stats(aperture=None, sigmaclip=False, sigma=2.5, fill=0, r=3, sat_thr=inf)[source]
Provide usefull stats about the aperture
Parameters
- apertureTYPE, optional
type of aperture performed. Can be either a list of positions in the tile or an aperture object. The default is None.
- sigmaclipbool, optional
choose perform sigma clip on data. The default is False.
- sigmafloat, optional
number of sigma clip. The default is 3.
- fillfloat, optional
fill the data outside the mask with this value. The default is 0.
- rint, optional
number of decimals to round to. The default is 3.
- sat_thrfloat, optional
threshold (in counts) above which the source is considered saturatated. The default is inf.
Returns
None.
- grow_curves(fig=None, ax=None, gstep=0.25, sigma=4.5, p=2, showplot=False, r_in=1, r_min=3, r_max=15)[source]
Evaluate grow curves for aperture photometry
Parameters
- figmatplotlib.pyplot
plot figure.
- axmatplotlib.pyplot
plot axis.
- gstepfloat, optional
step to create different growcurves. The default is 0.25.
- sigmafloat, optional
value of the sigma cut. The default is 3.
- pfloat, optional
create different growcurves in range -p, +p. The default is 2.
- showplotbool, optional
choose to show plots. The default is False.
- r_inint, optional
starting distance from the center of the tile to consider when evaluate the for growcurves. The default is 1.
- r_minint, optional
minimum distance from the center of the tile to consider when evaluate the flatness of the for growcurves. The default is 3.
- r_maxint, optional
maximum distance from the center of the tile to consider when evaluate the flatness of the for growcurves. The default is 15.
Returns
None.
- class straklip.photometry.photometry_MF[source]
Bases:
objectThis class handle the match filter photometry
- mf_stats(aperture=False, aptype='circular', method='exact', radius1=1, radius2=None, ap_x=1, ap_y=1)[source]
Provide usefull stats about the MF
Parameters
- aptype(circular,square,4pixels), optional
defin the aperture type to use during aperture photometry. The default is ‘cirular’.
- methodInt or None, optional
The method used to determine the overlap of the aperture on the pixel grid. With center they are either 0 or 1, while exact produces partial-pixel masks (i.e., values between 0 and 1). With subpixel, a pixel is divided into subpixels, each of which are considered to be entirely in or out of the aperture depending on whether its center is in or out of the aperture. If subpixels=1, this method is equivalent to ‘center’. The aperture weights will contain values between 0 and 1. The default is ‘exact’.
- radius1Int, optional
radius of circula aperture in pixels or inner radius for annulus aperture. The default is 1.
- radius2Int or None, optional
outer radius for annulus aperture. if None use circular aperture. The default is None.
- ap_xInt, optional
widht of the square aperture. The default is 1.
- ap_y: Int or None, optional
hight of the square aperture. The default is None.
Output
None
- class straklip.photometry.photometry_PSF[source]
Bases:
objectThis class handle the psf photometry
- equivalent_noise_area(weavelenght, pixelscale, telescope_aperture=2.3774)[source]
evaluate equivalent noise area for psf photometry noise estimation
Parameters
- weavelenghtfloat
filter wavelenght.
- pixelscalefloat
instrument pixelscale
- telescope_aperturefloat, optional
telescope aperture. The default is 2.3774.
Output
None
- psf_stats(fitshape, aperture_radius=5, flux=None, method='subpixel')[source]
Perform PSF photometry and provide usefull stats about the PSF photometry
Parameters
- fitshapeint,list
Rectangular shape around the center of a star which will be used to collect the data to do the fitting. Can be an integer to be the same along both axes. For example, 5 is the same as (5, 5), which means to fit only at the following relative pixel positions: [-2, -1, 0, 1, 2]. Each element of fitshape must be an odd number..
- aperture_radiusint, optional
The radius (in units of pixels) used to compute initial estimates for the fluxes of sources. aperture_radius must be set if initial flux guesses are not input to the photometry. The default is None.
- fluxfloat, optional
Estimated flux of the target for a better fit. The default is None.
- methodInt or None, optional
The method used to determine the overlap of the aperture on the pixel grid. With center they are either 0 or 1, while exact produces partial-pixel masks (i.e., values between 0 and 1). With subpixel, a pixel is divided into subpixels, each of which are considered to be entirely in or out of the aperture depending on whether its center is in or out of the aperture. If subpixels=1, this method is equivalent to ‘center’. The aperture weights will contain values between 0 and 1. The default is ‘subpixel’.
Returns
None.
straklip.showroom module
straklip.stralog module
- class straklip.stralog.MakeFileHandler(filename, mode='a', encoding=None, delay=0)[source]
Bases:
FileHandler
straklip.tiles module
This module implements the Tile class, which help create/load/save tiles cubes centered around each target (data, error, dq, modles, residuals)
- class straklip.tiles.Tile(data=[], delta=0, x=nan, y=nan, tile_base=1, inst=None, dqdata=[], Python_origin=True, raise_errors=False)[source]
Bases:
object- append_tile(path2tile, Datacube=None, verbose=False, name='SCI', header=None, return_Datacube=False, write=True)[source]
- load_tile(path2tile, hdul_max=None, ext=None, verbose=False, return_Datacube=False, mode='readonly', raise_errors=True)[source]
- mk_tile(fig=None, ax=None, step=2, title='', cmap='viridis', xy_tile=False, xy_m=False, xy_cen=False, xy_dmax=3, box_size=3, fwhm=2.5, sigma=4, background=0, std=0, showplot=True, cbar=False, lpad=0.5, fx=5, fy=5, legend=False, mk_arrow=False, xa=None, ya=None, theta=0, PAV3=None, L=None, dtx=0.3, dty=0.15, head_width=0.5, head_length=0.5, width=0.15, fc='k', ec='k', tc='k', north=True, east=False, roll=True, simplenorm=None, min_percent=0, max_percent=100, power=1, log=1000, cr_remove=False, la_cr_remove=False, cr_radius=3, verbose=False, kill=False, close=True, vmin=None, vmax=None, pad_data=False, pad=None, keep_size=False, return_tile=False, kill_plots=False, path2savefig=None)[source]
Select a smaller portion of an imput image and create a new tile from it.
Parameters
- figmatplotlib, optional
outside figure. The default is None
- axmatplotlib, optional
outside axis. The default is None.
- stepint, optional
step of the axis ticks. The default is 1.
- titlestr, optional
title for the plot. The default is ‘’.
- cmapstr, optional
color map. The default is ‘Greys_r’.
- xy_tilebool, optional
choose to show the original coordinates on the tile frame. The default is False.
- xy_cenbool, optional
choose to evaluate and show the coordinate of the centroids on the tile frame. The default is False.
- xy_mbool, optional
choose to evaluate and show the coordinate of the maximum on the tile frame. The default is False.
- xy_dmax: int, optional
distance from the center to look for maximum. The default is 2
- showplotbool, optional
choose to show the plot. The default is True.
- cbarbool, optional
choose to show the colorbar. The default is False.
- lpadfloat, optional
legend border pad. The default is 0.5.
- fxint, optional
figure x dimemsion. The default is 5.
- fyint, optional
figure y dimension. The default is 5.
- legendbool, optional
choose to show the legend. The default is False.
- mk_arrowbool, optional
choose to show arrows on tile. The default is False.
- xafloat, optional
x arrow anchoring point. The default is None.
- yafloat, optional
y arrow anchoring point. The default is None.
- thetafloat, optional
arrow angle. The default is 0.
- PAV3float, optional
PAV3 of the telescope. The default is None.
- Lfloat, optional
length of the arrow. The default is None.
- dtxfloat, optional
add x space between arrow and text. The default is 0.3.
- dtyfloat, optional
add y space between arrow and text. The default is 0.3.
- head_widthgloat, optional
arrow head width. The default is 0.5.
- head_lengthfloat, optional
arrow head lenght. The default is 0.5.
- widthfloat, optional
arrow body width. The default is 0.15.
- fcstr, optional
arrow face color. The default is ‘k’.
- ecstr, optional
arrow edge color. The default is ‘k’.
- tcstr, optional
arrow text color. The default is ‘k’.
- northbool, optional
choose to show the north arrow. The default is True.
- eastbool, optional
choose to show the east arrow. The default is False.
- rollbool, optional
choose to show the PA arrow. The default is True.
- simplenormTYPE, optional
use simplenorm normalization. The default is None.
- min_percent: float, optional
The percentile value used to determine the pixel value of minimum cut level. The default is 0.0. min_percent overrides percent.
- max_percent: float, optional
The percentile value used to determine the pixel value of maximum cut level. The default is 100.0. max_percent overrides percent.
- power: float, optional
The power index for stretch=’power’. The default is 1.0.
- log: float, optional
The log index for stretch=’log’. The default is 1000.
- cr_removebool, optional
choose to apply cosmic ray removal. The default is False.
- la_cr_removebool, optional
choose to apply L.A. cosmic ray removal. The default is False.
- cr_radiusint, optional
minimum distance from center where to not apply the cosmic ray filter. The default is 3.
- closebool, optional
choose to close plot istances. The default is True.
- killbool, optional
choose to kill bad pixels instead of using the median of the neighbouring pixels. The default is False.
- verbosebool, optional
choose to show prints. The default is False.
- vminfloat, optional
define the data range that the colormap covers. The default is None.
- vmaxfloat, optional
define the data range that the colormap covers. The default is None.
- pad_databool, optional
choose to pad the input data. The default is False.
- padint, optional
number of pixels to pad the data. If None use the base of the tile. The default is None.
- return_tile: bool, optional
choose to return the newly created tile as output of the fuction.
- kill_plots:
choose to kill all plots created. The default is False.
Returns
- im: numpy array. optional
new created tile.
- plot_tile(fig, ax, title=None, cmap='viridis', xy_tile=True, xy_cen=True, xy_m=True, cbar=False, bad_pixel_c='r', lpad=0.5, legend=False, tight=False, mk_arrow=False, xa=None, ya=None, theta=0, PAV3=None, L=None, dtx=0.3, dty=0.15, head_width=0.5, head_length=0.5, width=0.15, fc='k', ec='k', tc='k', north=True, east=False, roll=True, showplot=True, step=2, simplenorm=None, verbose=False, close=True, kill=False, vmin=None, vmax=None, min_percent=0, max_percent=100.0, power=1, log=1000, savename=None, extent=None, kill_plots=False)[source]
plot the input tile
Parameters
- figmatplotlib.pyplot
plot figure.
- axmatplotlib.pyplot
plot axis.
- titlestr, optional
title for the plot. The default is ‘’.
- cmapstr, optional
color map. The default is ‘Greys_r’.
- xy_tilebool, optional
choose to show the original coordinates on the tile frame. The default is False.
- xy_cenbool, optional (deprecated)
choose to evaluate and show the coordinate of the centroids on the tile frame. The default is False.
- xy_mbool, optional
choose to evaluate and show the coordinate of the maximum on the tile frame. The default is False.
- cbarbool, optional
choose to show the colorbar. The default is False.
- bad_pixel_cstr, optional
NaN pixel color for colorbar. The default is ‘r’.
- lpadfloat, optional
legend border pad. The default is 0.5.
- legendbool, optional
choose to show the legend. The default is False.
- tightbool, optional
choose to apply tight layout to plot. The default is False.
- mk_arrowbool, optional
choose to show arrows on tile. The default is False.
- xafloat, optional
x arrow anchoring point. The default is None.
- yafloat, optional
y arrow anchoring point. The default is None.
- thetafloat, optional
arrow angle. The default is 0.
- PAV3float, optional
PAV3 of the telescope. The default is None.
- Lfloat, optional
length of the arrow. The default is None.
- dtxfloat, optional
add x space between arrow and text. The default is 0.3.
- dtyfloat, optional
add y space between arrow and text. The default is 0.3.
- head_widthgloat, optional
arrow head width. The default is 0.5.
- head_lengthfloat, optional
arrow head lenght. The default is 0.5.
- widthfloat, optional
arrow body width. The default is 0.15.
- fcstr, optional
arrow face color. The default is ‘k’.
- ecstr, optional
arrow edge color. The default is ‘k’.
- tcstr, optional
arrow text color. The default is ‘k’.
- northbool, optional
choose to show the north arrow. The default is True.
- eastbool, optional
choose to show the east arrow. The default is False.
- rollbool, optional
choose to show the PA arrow. The default is True.
- showplotTYPE, optional
DESCRIPTION. The default is True.
- stepTYPE, optional
DESCRIPTION. The default is 1.
- simplenormTYPE, optional
use simplenorm normalization. The default is None.
- verbosebool, optional
choose to show prints. The default is False.
- closebool, optional
choose to close plot istances. The default is True.
- killbool, optional
choose to kill bad pixels instead of using the median of the neighbouring pixels. The default is False.
- vminfloat, optional
define the data range that the colormap covers. The default is None.
- vmaxfloat, optional
define the data range that the colormap covers. The default is None.
- min_percent: float, optional
The percentile value used to determine the pixel value of minimum cut level. The default is 0.0. min_percent overrides percent.
- max_percent: float, optional
The percentile value used to determine the pixel value of maximum cut level. The default is 100.0. max_percent overrides percent.
- power: float, optional
The power index for stretch=’power’. The default is 1.0.
- log: float, optional
The log index for stretch=’log’. The default is 1000.
- savenamestr, optional
path and file name to save the plot. The default is None.
- kill_plots:
choose to kill all plots created. The default is False.
Returns
- im: numpy array.
new created tle.