Reference/API

tayph Package

Functions

RV(dp[, vorb, vsys, p])

This program calculates the radial velocity in km/s for the planet in the data sequence provided in dp, the data-path.

RV_star(dp)

This calculates the radial velocity in km/s for the star in the data sequence provided in dp.

SNR(dp)

This retrieves the SNR tabulated in the obs_times table.

airmass(dp)

This retrieves the airmass tabulated in the obs_times table.

airtovac(wlnm)

This converts air wavelengths to vaccuum wavelengths.

apply_telluric_correction(inpath, ...[, ...])

This applies a set of telluric spectra (computed by molecfit) for each exposure in our time series that were written to a pickle file by write_telluric_transmission_to_file.

astropyberv(dp)

This does the same as berv(dp), but uses astropy to compute the BERV for the dates of observation given a data parameter file.

berv(dp)

This retrieves the BERV corrcetion tabulated in the obs_times table.

bin(x, y, n[, err])

A simple function to quickly bin a spectrum by a certain number of points.

bin_avg(wl, fx, wlm)

A simple function to bin a high-res model spectrum (wl,fx) to a lower resolution wavelength grid (wlm), by averaging the points fx inside the lower-resolution wavelength bins set by wlm.

blur_rotate(wl, order, dv, Rp, P, inclination)

This function takes a spectrum and blurs it using a rotation x Gaussian kernel which has a FWHM width of dv km/s everywhere.

box(x, A, c, w)

This function computes a box with width w, amplitude A and center c on grid x.

calculateberv(date, earth_coordinates, ra, dec)

This is a copy of the astropyberv above, but as a function for a single date in mjd.

check_dp(dp)

This is a helper function that checks for the presence of a config file and an obs_times file at path dp.

check_molecfit(dp[, instrument, configfile])

This allows the user to visually inspect the telluric correction performed by Molecfit, and select individual spectra that need to be refit.

check_path(filepath[, varname, exists])

This is a short function that handles file paths when input to other functions.

clean_block(wl, block[, deg, w, nsigma, ...])

This quickly cleans a spectral block by performing trimming of zeroes at the edges, setting zeroes and negative values to NaN, normalising the flux along both axes, rejecting outlier values by using a running MAD, and optionally detrending using polynomials.

constant_velocity_wl_grid(wl, fx[, ...])

This function will define a constant-velocity grid that is (optionally) sampled a number of times finer than the SMALLEST velocity difference that is currently in the grid.

convolve(array, kernel[, edge_degree, fit_width])

It's unbelievable, but I could not find the python equivalent of IDL's /edge_truncate keyword, which truncates the kernel at the edge of the convolution.

dRV(dp)

This program calculates the change in radial velocity in km/s for the planet in the data sequence provided in dp, the data-path.

derivative(x)

This computes the simple numerical derivative of x by convolving with kernel [-1,0,1].

dimtest(var, sizes[, varname])

This function tests the dimensions and shape of the input array var.

end(start[, id, silent, quiet])

Short-hand for ending a timing measurement and printing the elapsed time.

envelope(wlm, fxm, binsize[, selfrac, mode, ...])

This routine measures the top or bottom envelope of a spectrum (wl,fx), by chopping it up into bins of size binsze (unit of wl), and measuring the mean of the top n-% of values in that bin.

eval_poly(x, f)

This evaluates a polynomial using fitting coefficients f that were found via np.polyfit(x,y).

execute_molecfit(molecfit_prog_root, ...[, ...])

This actually calls the molecfit command in bash

findgen(n[, integer])

This is basically IDL's findgen function.

fit_rotation_broadened_line(RV, CCF[, ...])

This fits a rotation broadened profile following Gray (2005), with a polynomial for the continuum.

gaussfit(x, y[, nparams, startparams, yerr, ...])

This is a wrapper around lmfit to fit a Gaussian plus a polynomial continuum using the LM least-squares minimization algorithm.

gaussian(x, *args)

get_molecfit_config()

This is the central place where the location of the molecfit configuration file is defined.

get_phoenix_model_spectrum(T_eff[, log_g, cache])

Download a PHOENIX model atmosphere spectrum for a star with given properties.

get_phoenix_wavelengths([cache, vacuum])

Download a PHOENIX model atmosphere's wavelength grid

get_term_width()

guide_plot(dp[, dv, frame])

ladfit(x, y[, t])

This is a wrapper for LAD regression with sklego, implemented in a way such that it returns the linear coefficients a,b from y=ax+b.

lentest(var, length[, varname])

This function tests the length of the input list.

local_v_star(phase, aRstar, inclination, ...)

This is the rigid-body, circular-orbt approximation of the local velocity occulted by the planet as it goes through transit, as per Cegla et al. 2016.

make_project_folder([pwd])

max2D(arr)

This returns the indices of the maximum of a 2D array, similar to np.argmax for 1D arrays.

min2D(arr)

This returns the indices of the minimum of a 2D array, similar to np.argmin for 1D arrays.

minlength(var, n[, varname, warning_only])

molecfit(dataname[, mode, instrument, ...])

This is the main wrapper for molecfit that pipes a list of s1d spectra and executes it.

nan_helper(y)

Helper function to handle indices and logical indices of NaNs.

nantest(var[, varname])

This function tests for the presence of NaNs and infinites.

normalize_orders(list_of_orders, list_of_sigmas)

If deg is set to 1, this function will normalise based on the mean flux in each order.

notnegativetest(a[, varname])

This function tests that all elements in the input variable are zero or positive.

paramget(keyword, dp[, full_path, force_string])

This code queries a planet system parameter from a config file located in the folder specified by the path dp; or run configuration parameters from a file speciefied by the full path dp, if full_path is set to True.

phase(dp[, start, end])

Calculates the orbital phase of the planet in the data sequence provided using the parameters in dp/config and the timings in dp/obstimes.

polysinfit(x, y, polydeg[, lmfit, ...])

This fits a polynomial modulated by a sine-wave to a 1D array of points.

postest(a[, varname])

This function tests that all elements in the input variable are strictly positive.

read_binary_kitzmann(inpath[, double])

This reads a binary model spectrum (those created by Daniel Kitzmann) located at path inpath.

read_e2ds(inpath, outname[, read_s1d, ...])

This is the workhorse for reading in a time-series of archival 2D echelle spectra from a couple of instrument pipelines that produce a standard output, and formatting these into the order-wise FITS format that Tayph uses.

read_telluric_transmission_from_file(inpath)

read_wave_from_e2ds_header(h[, mode])

This reads the wavelength solution from the HARPS header keywords that encode the coefficients as a 4-th order polynomial.

readfits(filename[, i])

This is a replacement for fits.getdata, closing the file after reading to prevent too many open file errors.

rebinreform(a, n)

This works like the rebin(reform()) trick in IDL, where you use fast array manipulation operations to transform a 1D array into a 2D stack of itself, to be able to do operations on another 2D array by multiplication/addition/division without having to loop through the second dimension of said array.

remove_output_molecfit(path, name)

This cleans the molecfit project folder

retrieve_output_molecfit(path)

This collects the actual transmission model created after a pass through molecfit is completed

rotation_broadened_line(RV, *args)

run_instance(p[, parallel, xcor_parallel])

This runs the entire cross correlation analysis cascade.

running_MAD(z, w[, parallel])

Computers a running standard deviation of a 1-dimensional array z.

running_MAD_2D(z, w[, verbose, parallel])

Computers a running standard deviation of a 2-dimensional array z.

running_mean_2D(D, w)

This computes a running mean on a 2D array in a window with width w that slides over the array in the horizontal (x) direction.

running_median_2D(D, w)

This computes a running median on a 2D array in a window with width w that slides over the array in the horizontal (x) direction.

running_std_2D(D, w)

This computes a running standard deviation on a 2D array in a window with width w that slides over the array in the horizontal (x) direction.

save_stack(filename, list_of_2D_frames)

This code saves a stack of fits-files to a 3D cube, that you can play through in DS9.

sel2D(arr, xrange, yrange[, x, y])

This is used to make a sub-selection of a 2D numpy array based on conditions (limits) of the X and Y axes of the array.

selmax(y_in, p[, s])

This program returns the p (fraction btw 0 and 1) highest points in y, ignoring the very top fraction s (default zero, i.e. no points ignored), for the purpose of outlier rejection.

set_molecfit_config(configpath)

shift_exclusion_regions(inpath, instrument, v)

sigma_clip(array[, nsigma, MAD])

This returns the n-sigma boundaries of an array, mainly used for scaling plots.

smooth(fx, w[, mode, edge_degree])

This function takes a spectrum, and blurs it using either a Gaussian kernel or a box kernel, which have a FWHM width of w px everywhere.

start()

Short-hand for starting a timing measurement.

start_run(configfile[, parallel, ...])

This is the main command-line initializer of the cross-correlation routine provided by Tayph.

statusbar(i, x)

This provides a little status indicator for use in long forloops.

strided_window(a, L[, pad])

This function computes the rolling window over a rectangular (i.e.

sysrem(data, sigma, N[, init, v, c_limit, ...])

This runs Sysrem on a 2D frame of spectra; i.e. a time series of spectra or of a spectral order or of a cross-correlation function.

t_eff(M, R)

This function computes the mass and radius of a star given its mass and radius relative to solar.

test(**kwargs)

Run the tests for the package.

test_alias(alias)

This tests whether an alias exists on the system.

test_molecfit_config(molecfit_config)

This tests the existence and integrity of the system-wide molecfit configuration folder.

transit(dp[, p])

This code uses Ians astro python routines for the approximate Mandel & Agol transit lightcurve to produce the predicted transit lightcurve for the planet described by the configfile located at dp/config.

typetest(var, vartype[, varname])

This function tests the type of var against a requested variable type and raises an exception if either varname is not a string, or if type(var) is not equal to vartype.

typetest_array(var, vartype[, varname])

This function tests the types of the elements in the array or list var against a requested variable type and raises an exception if either varname is not a string, type(var) is not equal to numpy.array or list, or the elements of var are not ALL of a type equal to vartype.

v_orb(dp)

This program calculates the orbital velocity in km/s for the planet in the data sequence provided in dp, the data-path.

vactoair(wlnm)

This converts vaccuum wavelengths to air wavelengths.

voigt(x, x0, sigma, gamma)

Return the Voigt line shape at x with Lorentzian component HWFM gamma and Gaussian sigma.

write_file_to_molecfit(molecfit_folder, ...)

This is a wrapper for writing a spectrum from a list to molecfit format.

write_telluric_transmission_to_file(wls, T, ...)

This saves a list of wl arrays and a corresponding list of transmission-spectra to a pickle file, to be read by the function below.

writefits(filename, array)

This is a fast wrapper for fits.writeto, with overwrite enabled.

Classes

molecfit_gui(wls, fxc, trans)

This class defines most of the behaviour of the GUI to inspect the molecfit output.

Class Inheritance Diagram

Inheritance diagram of tayph.tellurics.molecfit_gui