CCFCenter
This script is used to find the center an meaure the width of a CCF peak.
|
This module finds the center and width of a MARVELS ccf. More...
Functions | |
def | cutccf |
Choose which section of the ccf to fit based on width parameter or automatically using percent. | |
def | gaussfunc |
Takes x points and returns a Gaussian function. | |
def | gausstest |
Creates a Gaussian signal and then fits it to see if I can recover the input parameters. | |
def | fitgauss |
Use a Levenberg-Marquadt non-linear least-squares fitter to fit a Gaussian to Xin and Yin. | |
def | make_gauss |
Generate Gaussian data using Gaussian. | |
def | ccfcenter |
This function is the main() program for this module. | |
Variables | |
list | filename = sys.argv[1] |
width = None | |
tuple | ret = ccfcenter(filename,width) |
This module finds the center and width of a MARVELS ccf.
This module uses a non-linear least-squares optimizer from scipy to fit a Gaussian to the central pixels of a ccf file.
def ccfcenter::ccfcenter | ( | filename, | |
width = None |
|||
) |
This function is the main() program for this module.
filename | String name of MARVELS ccf file to process |
width | Integer number of pixels to fit around peak; None: Automatically choose |
ret | 0 for success or an error message |
Definition at line 247 of file ccfcenter.py.
def ccfcenter::cutccf | ( | pixel, | |
ccf, | |||
width = None , |
|||
percent = 0.30 |
|||
) |
Choose which section of the ccf to fit based on width parameter or automatically using percent.
pixel | Numpy array of pixel positions |
ccf | Numpy array of ccf values |
width | Integer number of pixels to include, if None: then automatically determine. |
percent | Floating point percentage of the singal amplitude above the noise that a point must be to be included in the fit. |
pixel | Numpy array of pixel positions |
ccf | Numpy array of ccf values |
lmargin | Integer index of the left margin of the input arrays |
rmargin | Integer index of the right margin of the input arrays |
noiselevel | Floating point values of the CCF plot noise level |
Definition at line 52 of file ccfcenter.py.
def ccfcenter::fitgauss | ( | xin, | |
yin, | |||
inerror = [] , |
|||
inguess = [1 |
|||
) |
Use a Levenberg-Marquadt non-linear least-squares fitter to fit a Gaussian to Xin and Yin.
The scipy module optimize is used to find the smallest residual to Error Function which is compared to the Gaussian function.
xin | Numpy array of x-values |
yin | Numpy array of y-values |
inerror | Numpy array of error values |
inguess | A 3 element list (Amplitude,Offset,Sigma) of starting values for Gaussian parameters |
Params | A 3 element Numpy array of Gaussian Parameters (Amplitude,Offset,Sigma) |
perror | A 3 element Numpy array of parameter errors calculated from the covariance matrix |
red_chi | A float giving the reduced \(\chi^{2}\) of the fit. |
Definition at line 151 of file ccfcenter.py.
def ccfcenter::gaussfunc | ( | P, | |
x | |||
) |
Takes x points and returns a Gaussian function.
P | A 3 element array (Amplitude,Offset,Sigma) |
x | Numpy array of x positions |
y | Numpy array of y values |
Definition at line 77 of file ccfcenter.py.
def ccfcenter::gausstest | ( | ) |
Creates a Gaussian signal and then fits it to see if I can recover the input parameters.
Definition at line 95 of file ccfcenter.py.
def ccfcenter::make_gauss | ( | npts, | |
amp = 1 , |
|||
offset = 0 , |
|||
sigma = 1 , |
|||
error = 0 , |
|||
inflate_error = 1.0 , |
|||
randpts = False |
|||
) |
Generate Gaussian data using Gaussian.
npts | Integer number of points to create |
amp | Floating point amplitude of the Gaussian |
offset | Floating point offset of the Gaussian |
sigma | Floating point sigma of the Gaussian |
error | Floating point number or a Numpy array of sigmas for the error in each point |
inflate_error | Floating point factor to scale the real as versus reported error |
randpts | Bool True: Select x points from a uniform distribution; False Take from a regular grid. |
x | Numpy Array of x positions |
y | Numpy Array of y positions |
y_err | Numpy Array of y errors |
Definition at line 220 of file ccfcenter.py.
list ccfcenter::filename = sys.argv[1] |
Definition at line 328 of file ccfcenter.py.
tuple ccfcenter::ret = ccfcenter(filename,width) |
Definition at line 334 of file ccfcenter.py.
ccfcenter::width = None |
Definition at line 333 of file ccfcenter.py.